Music Synthesizer object with General MIDI sound set
Ariba
Posts: 2,689
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
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
zip
82K
Comments
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.
Post Edited (Ariba) : 4/7/2009 1:13:18 AM GMT
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.
I'm not sure how well this works but I converted a few files and they played back ok. It's at least FREE.
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!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
Post Edited (Bob Lawrence (VE1RLL)) : 4/8/2009 4:26:23 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
Most impressive! Nice demo mp3, too! (I especially liked the Bach at the end. )
-Phil
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!
Wonderful work! I like it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
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
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...
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
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.
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
·
guys, the ground keep on shaking here... just had another wave a few minutes ago :-\
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? )
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 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). 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 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
I tried it out on the Hybrid board . It's got a fantastic sound. Wow!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
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 )
Regards,
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX - The home of the Hybrid Development System and PropGFX Lite
Regards,
John Twomey
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Those who can, do.Those who can’t, teach.
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
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-
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
Two that worked out pretty well were Star Wars, and Bach's Invention #13.
Enjoy.
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
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
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
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
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