Shop OBEX P1 Docs P2 Docs Learn Events
Music Synthesizer object with General MIDI sound set — Parallax Forums

Music Synthesizer object with General MIDI sound set

AribaAriba Posts: 2,689
edited 2012-04-06 12:52 in Propeller 1
Hello Propeller musicians

I have worked on a Propeller music synthesizer, and will present here my result.
The goal was to have a synthesizer object which is good enough to play
MIDI files. For that you need a synth with min. 24 voices and a GM1 soundset
(General-MIDI soundset) with 128 different instrumental sounds and a drum
sound set (another 46 sounds).
Normally such a synthesizer works with Sound samples, but this is not possible
with the 32k RAM of the Propeller. So I designed a voice architecture, with
2 oscillators and PhaseModulation synthesis (FM like). See attachement 1. I was
surprised, how many different sounds this relatively simple arrangement, can produce.
Only 10 parameter bytes to define a sound are necessary. You get also a lot of
noise sounds, thanks to the Feedback parameter (good for drums).
Because the Propeller has no hardware multiplier, I use only 1 multiplication with
7*32 bit for the DCA, and all other attenuators are done with single right shifts.

At the end I got a Spin object, which can produce 10 voices in 1 cog, or 20 voices in
2 cogs. This is quite a bit under 24 voices, but the lack of voices is mostly not
noticeable. More noticeable is the missing pitch bender support, so some MIDI files
can produce odd notes from time to time.

Supported are the volume and panorama controller, thats why I recommend a stereo output.
It was a hard work to find the parameters for all this sounds, and many are still not
optimal.

The Interface methodes of the Synthesizer object are easy to use and takes direct the
MIDI values for Note, Dynamic, Volume and so on. It should not be hard to make a
MIDI synthesizer expander, with a Propeller and a MIDI input.

Included in the ZIP is a MIDI player demo, which plays a list of '*.mid' files (5 are
included). For that you need an SD card. The MIDI player reads the MIDI data direct
from SD card, without buffering in RAM, therefore the MIDI files must be in Format 0
(all tracks mixed down to one). Copy the midi files first to the SD card, and set the
SD card basepin and your Audio output pins in the CON section of the demo, before you
start the demo.

Most MIDI files, you find on the NET are in Format 1, so I have used the software
WaveMaker III to convert the files (the Edit function lets you save a file in Format 0).
If somebody knows a better (free) Tool for that, I like to here it, because I have some
files which are to big for WaveMaker.

Listen to the music, and enjoy

Andy
381 x 160 - 2K
«134

Comments

  • AribaAriba Posts: 2,689
    edited 2009-04-07 01:07
    For the people with no SD card or Audio output, here is a MP3 file. It contains sound snippets
    of the Synthesizer output. All what you hear is directly recorded from the Propeller output
    into the PC Line input. (I must say this snippets are carefully selected from good
    sounding MIDI files [noparse]:)[/noparse]. The havy compession to a short MP3 affects the sound quality a bit,
    especially for the high drum noise sounds.

    My Audio output:
    
    Pin ───────┳──────── Left out
           470Ω  10nF
    Pin ───────┼─┳────── Right out
           470Ω   │10nF
                    
    
    

    Post Edited (Ariba) : 4/7/2009 1:13:18 AM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-07 01:33
    Made my day! I was hoping someone skilled in music was working on a project like this!

    Great job! Sounds Perfect!

    (Somewhere I've got a program that does Type 1 to Type 0, I'll see if I can dig it up
    and see if it was a freebie.)

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2009-04-07 01:58
    Ariba said...
    If somebody knows a better (free) Tool for that, I like to here it, because I have some
    files which are to big for WaveMaker.

    I'm not sure how well this works but I converted a few files and they played back ok. It's at least FREE. turn.gif

    convert.php

    Converts MIDI files of type 1 to type 0. uses a simple child class.

    EDIT: A few of us tried it and it does not convert properly. Try the program OBC suggests below.

    Use this URL:
    staff.dasdeck.de/valentin/midi/convert.php

    Thanks! for the work you did . I'm looking forward to trying it out. The demo sounds great! yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob

    Post Edited (Bob Lawrence (VE1RLL)) : 4/8/2009 4:26:23 AM GMT
  • mparkmpark Posts: 1,305
    edited 2009-04-07 02:44
    Wow, way to go, Andy!
  • BradCBradC Posts: 2,601
    edited 2009-04-07 02:56
    Whooooboy! That is *excellent*! Well done indeed [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-07 03:01
    Andy,

    Most impressive! Nice demo mp3, too! (I especially liked the Bach at the end. smile.gif )

    -Phil
  • potatoheadpotatohead Posts: 10,261
    edited 2009-04-07 03:30
    Man, this thing sounds great!

    Nicely done!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
  • virtuPICvirtuPIC Posts: 193
    edited 2009-04-07 06:05
    Great sound!!! I wonder how much money Jean Michel Jarre has spent for the synths he used for his early albums. Now we are getting almost the same almost for free.

    Wonderful work! I like it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • BaggersBaggers Posts: 3,019
    edited 2009-04-07 08:58
    WOW, Andy, that's brilliant, well done [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • BaggersBaggers Posts: 3,019
    edited 2009-04-07 10:12
    Bob, Andy, I tried that link on a few of the Midi files I have, and none of them worked [noparse]:([/noparse]
    they converted ok, and worked in the player on the pc, but it's like one note every few seconds on the prop.
    any ideas?

    edit: btw, I'm running on 6Mhz if that makes any difference, and I've changed the _xinfreq ;D oh, and all the ones that came with the demo, work fine [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite



    Post Edited (Baggers) : 4/7/2009 10:20:44 AM GMT
  • WurlitzerWurlitzer Posts: 237
    edited 2009-04-07 12:19
    Andy, fantastic! I have 2 props for my Wurlitzer Pipe (real pipes) organ (1 for all the console stuff and 1 for all the pipes and percussion) and this might be an application for a 3rd to give some synth sounds.
  • RaymanRayman Posts: 14,537
    edited 2009-04-07 13:13
    Great job! Puts my little midi player to shame...

    Do you see major problems extending this to level 1 midi? As I recall, I was worried that the notes might not come in temporal order, requiring buffering the entire file...

    It sounds as though you already have multiple instruments at the same time...
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-04-07 13:15
    Hey Andy, this is fantastic jumpin.gif· And such a simple output circuit too!

    Wonder if Chip ever though his prop would be able to do this??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-04-07 14:24
    That online music converter didn't work for me, but Anvil Studio did a fine job
    of converting type 1 to type 0 midi for this project.

    www.anvilstudio.com/

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • BaggersBaggers Posts: 3,019
    edited 2009-04-07 16:40
    OBC, you're a resource star [noparse];)[/noparse] thanks, downloaded it, and it did a fine job on the first few files I've tested [noparse]:)[/noparse] Cheers.
    and Ariba, Thanks! a great app, and such a small footprint for what it does [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • AntoineDoinelAntoineDoinel Posts: 312
    edited 2009-04-07 18:28
    Just tried it, it's great!

    guys, the ground keep on shaking here... just had another wave a few minutes ago :-\
  • AribaAriba Posts: 2,689
    edited 2009-04-07 19:07
    Thank you all for the nice comments

    and sorry for the late reaction, but after I have uploaded the files, my internet access was broken for half a day (had the music industry a finger in the pie? smilewinkgrin.gif )

    OBC
    I will try anvil studio, I know I had a look at it, when I searched for MIDI utilities, but was scared by the modules to pay for.

    virtuPIC
    some Jean Michel Jarre midi files are really the best sounding files with my Synth object. And that's fine, he was the one that brought me to synthesizers back in the 80-ties.

    Baggers
    This converter works also not for me, I must look closer why. 6MHz crystal is fine, the object respect the clock frequency and should work down to ~70MHz.

    Rayman
    Rayman said...
    Do you see major problems extending this to level 1 midi?
    Yes, the midi files are to big to load in RAM, and in a Type 1 file, the tracks are stored serially, but we have to play theme in parallel. You need to have multiple read accesses to the file (one for each track).
    Rayman said...
    It sounds as though you already have multiple instruments at the same time...
    Yes, every voice can play another sound, on every NoteOn the necessary sound parameters are written to the voice. Normally you have 1 sound per MIDI channel and on channel 10 (Drums) one sound per key.

    Cluso99
    Cluso said...
    Wonder if Chip ever though his prop would be able to do this?
    Only he can answer this question, but I wish he had implemented the hardware multiplication (or even better: multiply-accumulate with limiter), for this kind of applications.

    Andy
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2009-04-08 04:26
    @Andy

    I tried it out on the Hybrid board . It's got a fantastic sound. Wow!! jumpin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob
  • ColeyColey Posts: 1,110
    edited 2009-04-08 08:11
    Andy,

    Absolutely fabulous, it sound great in stereo on my new HybridX3 board, well done!

    (You know Baggers was so excited by this yesterday that he rang me and played the music down the phone to me lol, I understand why now yeah.gif )

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX - The home of the Hybrid Development System and PropGFX Lite
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2009-04-08 08:50
    Great job Andy .. well done.

    Regards,
    John Twomey

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'

    Those who can, do.Those who can’t, teach.
  • BamseBamse Posts: 561
    edited 2009-04-10 02:16
    Awesome...

    Great job...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Living on the planet Earth might be expensive but it includes a free trip around the sun every year...

    Experience level:
    [noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
    [noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
    [noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
    [noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
    [noparse][[/noparse] ] I dream in SX28 assembler...

    /Bamse
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2009-04-12 00:07
    Andy,

    I am blown away at how fantastic this is! I just wired up an SD socket just so I could try it out. What a treat. The synth sounds fantastic. I'm going to try it with a few of my MIDI files that I've managed to keep over the years.

    Thanks for sharing this. It's wonderful.

    Joel-
  • James LongJames Long Posts: 1,181
    edited 2009-04-12 03:53
    Andy,

    Do you think it would be possible to convert this to be able to play different format Midi files (Like format 1 for example)?

    I do not think it would be real hard to do, but you are the one who wrote this object, and would have better understanding of the obstacles.


    I didn't read close enough. I guess you already answered my question.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services

    Post Edited (James Long) : 4/12/2009 8:02:38 AM GMT
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2009-04-12 04:34
    I converted a few MIDI files to try, and a few of them worked out decently.

    Two that worked out pretty well were Star Wars, and Bach's Invention #13.

    Enjoy.
  • James LongJames Long Posts: 1,181
    edited 2009-04-12 07:49
    I have played with the Midi file, and have a question.

    Does Midi format 1 have it's tracks intermingled, or does the file have one full track (sequentially in the file), then another?

    If they are intermingled, I can see where a buffer would need to be written.

    If they are not, couldn't we use a pointer for the other tracks? Still a buffer would need to be included, I figure.

    I'm just brain storming at this point. I've been trying to figure out the different formats, but reading isn't telling me much.


    Ok, now that my question has been answered (way back, before my first post), can some of you memory guru's estimate how many tracks could be read and played?

    I figure you would need at least an 8 byte buffer for each track (one long). So I figure with other items, 16 tracks could probably be done.

    Just thinking here,

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services

    Post Edited (James Long) : 4/12/2009 8:06:10 AM GMT
  • BaggersBaggers Posts: 3,019
    edited 2009-04-12 11:24
    Joel, thanks for sharing, yes the did turn out pretty decent [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • AribaAriba Posts: 2,689
    edited 2009-04-13 06:33
    James Long

    The problem is that the MIDI files are mostly to big to load into the RAM of the propeller. So you need to read it in real time from the SD card while playing. For such reads, the existing SD card drivers allows only sequential read of the bytes in the file. You have no random access to all the bytes in the file.
    A MIDI file in format 0 has all the events to play just in the right order, so you need only read byte per byte from the card and wait the right time between the notes. But a file in format 1 has stored all the tracks to play in single chunks in the file. This chunks are stored one after the other in the file, but you need to play them all at the same time.
    I don't say its impossible to play such a file, but you need to program a special SD card driver, which allows reading several positions in a file at the same time, or has a fast seek command.

    If you just search a way to play the files easier, without conversion - see my next post...

    Andy
  • AribaAriba Posts: 2,689
    edited 2009-04-13 06:39
    After playing with the free sequencer software Anvil Studio (thanks to OBC), I wished I can load and edit the MIDI
    files and play it directly from the sequencer, without export it as a MIDI file, save it on SD card, and put the
    card in the Propeller system.
    So I have made another Spin application which turns the propeller into a MIDI sound module. It uses the same Synthesizer
    object, but plays MIDI notes received over a serial input. This can be a MIDI Input hardware, or in my case just the
    PropPlug with a MIDI to serial driver.
    On this site I have found the information, how to install a Roland Serial MIDI driver (you need the PropPlug on a
    COM port 1..4):
    tomscarff.110mb.com/USB_MIDI/USB_MIDI.htm

    After that you have another MIDI port in Windows, which you can select to send or receive MIDI data over the PropPlug.
    Set this port in Anvil studio as MIDI output port, start the attached Spin code on the propeller, and Anvil studio
    is a player for the Propeller synthesizer. You can edit all the sounds the volume and panorama, or also compose new
    songs in the sequencer. At the end you can save the MIDI file in format 0 and use it from the SD card with the player
    from first post of this thread.

    It is also possible to change the settings of the Windows Mediaplayer, so that it plays MIDI files always over the
    Serial MIDI port, then you can hear all the MIDI files from the NET direct on the propeller by simply clicking on
    the link.

    Andy
  • James LongJames Long Posts: 1,181
    edited 2009-04-13 06:49
    Ariba said...
    James Long

    The problem is that the MIDI files are mostly to big to load into the RAM of the propeller. So you need to read it in real time from the SD card while playing. For such reads, the existing SD card drivers allows only sequential read of the bytes in the file. You have no random access to all the bytes in the file.
    A MIDI file in format 0 has all the events to play just in the right order, so you need only read byte per byte from the card and wait the right time between the notes. But a file in format 1 has stored all the tracks to play in single chunks in the file. This chunks are stored one after the other in the file, but you need to play them all at the same time.
    I don't say its impossible to play such a file, but you need to program a special SD card driver, which allows reading several positions in a file at the same time, or has a fast seek command.

    If you just search a way to play the files easier, without conversion - see my next post...

    Andy

    Andy,

    I knew the serial data stream would work. I was really wanting to read the file from an SD card and play it in format 1.

    I'm with you on the read problem. The more tracks iin the Midi file, the faster the reads need to be. I figure format 1 is not possible without some ultra-fast communications with the SD card. Even with ultra-fast communications the card may not be fast enough to parse the data out fast enough.

    But some of the major SD card guru's may have an idea we don't know about. They have amazed me to this point. It may be a limitation of SD cards in general.

    James L

    On a secondary note, would it be possible to step through a Midi file and assign pointers to each track. Then the specific pointer would read that particular track? Can that be done in the same file?

    I know each track has a header that could be found.

    I speaking to the major guys like Mike Green. I know he has dealt with SD cards a bunch.

    I'm reaching for a limb here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services

    Post Edited (James Long) : 4/13/2009 6:58:15 AM GMT
  • dossicdossic Posts: 38
    edited 2009-04-15 19:17
    That's incredible!!! A MIDI expander with good old sounds......
    I tried it, and I felt younger, I remembered myself more than 20 years ago, when I got a chance to attend an evening class in electronic music... subtractive synthesis, FM synthesis, the Yamaha DX-7 and a MSX-based computer with an 8-bit FM sound card!

    I should study more on Propeller assembly language to understand all (and time is always short), but I have a couple of (perhaps) stupid questions/curiosities :
    - why decay and release time values are the same? Maybe it would be great having two different values.
    - why not adding an LFO to modulate DCA and or PM?

    Anyway, a great piece of software!!!!!

    Yours Carlo
Sign In or Register to comment.