PDA

View Full Version : Music Synthesizer object with General MIDI sound set



Ariba
04-07-2009, 08:01 AM
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

Ariba
04-07-2009, 08:07 AM
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 :). 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)
04-07-2009, 08:33 AM
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 (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Bob Lawrence (VE1RLL)
04-07-2009, 08:58 AM
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. http://forums.parallax.com/images/smilies/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 (http://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! http://forums.parallax.com/images/smilies/yeah.gif

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

Post Edited (Bob Lawrence (VE1RLL)) : 4/8/2009 4:26:23 AM GMT

mpark
04-07-2009, 09:44 AM
Wow, way to go, Andy!

BradC
04-07-2009, 09:56 AM
Whooooboy! That is *excellent*! Well done indeed :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!

Phil Pilgrim (PhiPi)
04-07-2009, 10:01 AM
Andy,

Most impressive! Nice demo mp3, too! (I especially liked the Bach at the end. http://forums.parallax.com/images/smilies/smile.gif )

-Phil

potatohead
04-07-2009, 10:30 AM
Man, this thing sounds great!

Nicely done!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net (http://propeller.wikispaces.com/Join+us+on+IRC%21/)
Safety Tip: Life is as good as YOU think it is!

virtuPIC
04-07-2009, 01:05 PM
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 (http://www.airspace-v.com/ggadgets) for tools & toys

Baggers
04-07-2009, 03:58 PM
WOW, Andy, that's brilliant, well done :)

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


Baggers
04-07-2009, 05:12 PM
Bob, Andy, I tried that link on a few of the Midi files I have, and none of them worked :(
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 :)

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



Post Edited (Baggers) : 4/7/2009 10:20:44 AM GMT

Wurlitzer
04-07-2009, 07:19 PM
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.

Rayman
04-07-2009, 08:13 PM
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...

Cluso99
04-07-2009, 08:15 PM
Hey Andy, this is fantastic http://forums.parallax.com/images/smilies/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 (http://forums.parallax.com/showthread.php?p=786418), SixBladeProp (http://forums.parallax.com/showthread.php?p=780033), website (Multiple propeller pcbs) (http://bluemagic.biz/cluso.htm)
∑ Single Board Computer:∑3 Propeller ICs∑and a∑TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
∑ Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
∑ Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427))
∑ Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)
My cruising website is: ∑www.bluemagic.biz (http://www.bluemagic.biz)∑∑ MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

Oldbitcollector (Jeff)
04-07-2009, 09:24 PM
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/ (http://www.anvilstudio.com/)

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Baggers
04-07-2009, 11:40 PM
OBC, you're a resource star ;) thanks, downloaded it, and it did a fine job on the first few files I've tested :) Cheers.
and Ariba, Thanks! a great app, and such a small footprint for what it does :)

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


AntoineDoinel
04-08-2009, 01:28 AM
Just tried it, it's great!

guys, the ground keep on shaking here... just had another wave a few minutes ago :-\

Ariba
04-08-2009, 02:07 AM
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? http://forums.parallax.com/images/smilies/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)
04-08-2009, 11:26 AM
@Andy

I tried it out on the Hybrid board . It's got a fantastic sound. Wow!! http://forums.parallax.com/images/smilies/jumpin.gif

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

Coley
04-08-2009, 03:11 PM
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 http://forums.parallax.com/images/smilies/yeah.gif )

Regards,

Coley

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX (http://www.propgfx.co.uk) - The home of the Hybrid Development System and PropGFX Lite

QuattroRS4
04-08-2009, 03:50 PM
Great job Andy .. well done.

Regards,
John Twomey

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

Those who can, do.Those who can’t, teach.

Bamse
04-10-2009, 09:16 AM
Awesome...

Great job...

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

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

/Bamse

Joel Rosenzweig
04-12-2009, 07:07 AM
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 Long
04-12-2009, 10:53 AM
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 (http://www.lil-brother.com)

Post Edited (James Long) : 4/12/2009 8:02:38 AM GMT

Joel Rosenzweig
04-12-2009, 11:34 AM
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 Long
04-12-2009, 02:49 PM
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 (http://www.lil-brother.com)

Post Edited (James Long) : 4/12/2009 8:06:10 AM GMT

Baggers
04-12-2009, 06:24 PM
Joel, thanks for sharing, yes the did turn out pretty decent :)

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


Ariba
04-13-2009, 01:33 PM
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

Ariba
04-13-2009, 01:39 PM
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 (http://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 Long
04-13-2009, 01:49 PM
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 (http://www.lil-brother.com)

Post Edited (James Long) : 4/13/2009 6:58:15 AM GMT

dossic
04-16-2009, 02:17 AM
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

TreeLab
04-16-2009, 03:50 AM
Would it be feasible to transfer the MIDI file from the SD to the EEPPROM, then read the track chunks from there? Would the speed be adequate?

Cheers!
Paul Rowntree

James Long
04-16-2009, 04:24 AM
TreeLab said...
Would it be feasible to transfer the MIDI file from the SD to the EEPPROM, then read the track chunks from there? Would the speed be adequate?

Cheers!
Paul Rowntree


I don't see an advantage to that. Especially because an EEPROM only can be written so many times. There may be some speed advantage, but the writing issue is a bigger one for me.

James L

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

Lil Brother SMT Assembly Services (http://www.lil-brother.com)

TreeLab
04-16-2009, 04:53 AM
Perhaps I do not understand the problem. If the trouble with the existing SD drivers is that they are essentially sequential readers, then a solution is to transfer the information once into a more flexible media format, then play the MIDI from there. RAM is out fro the Prop 1, so why not use the EEPROM? I think that the number of write cycles is still essentially infinite (10^6 plays at several minutes each should give several years of music before EEPROM failure, assuming every play required a re-write to memory).

Have I missed something here?

Cheers!
Paul Rowntree

James Long
04-16-2009, 05:00 AM
TreeLab said...
Perhaps I do not understand the problem. If the trouble with the existing SD drivers is that they are essentially sequential readers, then a solution is to transfer the information once into a more flexible media format, then play the MIDI from there. RAM is out fro the Prop 1, so why not use the EEPROM? I think that the number of write cycles is still essentially infinite (10^6 plays at several minutes each should give several years of music before EEPROM failure, assuming every play required a re-write to memory).

Have I missed something here?

Cheers!
Paul Rowntree


Paul,

I consider several years of viable use a problem. I think using up an eeprom just to get around the multi-read of an SD card not smart. I would rather stick with the format 0 than to burn up an eeprom.

James L

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

Lil Brother SMT Assembly Services (http://www.lil-brother.com)

Ariba
04-16-2009, 02:50 PM
@dossic

> - 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?

The synthesizer engine is designed to use a minimum of parameters, to get as much voices in 1 cog as possible. For a midi
file player the number of voices is more important than a voice architecture which allows detailed modelling of the sound.
When 20 voices plays, you can't hear if the release is a bit shorter than the decay time, or if there is an LFO modulation.
The cog ram is very limited, and the current implementation uses the whole ram (not 1 register/instruction left free).

It is possible to make a more advanced synthesizers, with lower voice count. Perhaps one voice in one cog and with external
analog filter hardware. Sometimes I dream of this, but had not the time so far...

What I miss most in the current design are the continous controllers, like expression and pitch bending. Many midi files uses
such controllers, and this results in wrong notes and wrong mixing balance of the voices.

Andy

Ariba
04-16-2009, 03:06 PM
TreeLab, James Long

Writing to the tracks to an EEPROM would be possible, but only for short midi files. But I have here files up to 400 kByte, to
big for an EEPROM.
As I said before, it will be possible to play a file in format 1, with a lot of effort on the SD card driver. One way will be, to have the midi files with contiguous sectors, and access the tracks with low level sector reads.

But I really don't see, why it is so important to play Format 1 files. Converting the files to format 0 is easy, and makes the software so much simpler.
The format 1 is mainly ment as a portable file format between sequencers. The tracks are separated in the file so that another sequencer can reconstruct the track structure. Playing the file is always a mix down to one midi stream, which makes the sequencer in realtime while playing.

Andy

Oldbitcollector (Jeff)
04-16-2009, 08:47 PM
Injected comment:

We're all going to need to adopt an add-on RAM option like
that of the SRAM interface by Ray, or Andre. Like those many
who are using an SD interface, this would solve many of the
problems like this one. Andy if you had some memory you
could spool it off to, problem with playback of midi 1 would
be pretty much solved.

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Oldbitcollector (Jeff)
04-20-2009, 04:18 AM
Ariba said...

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.



Finally got a chance to set this up.. VERY NICE.

Here's the exact changes for adjusting Media Player (and others) for proper Midi output.
START-->Control Panel-->Sounds and Audio Devices-->Audio Tab
Pull down the "Midi Playback Device" and choose the Roland device.

Great Job Andy!

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Oldbitcollector (Jeff)
04-20-2009, 09:01 AM
After playing with this for a while I thought it might be a little more interesting
with some sort of color display. Attached is a version of "Midi Expander" with
a sort of multicolor display player. (ie: simple lightshow)

It brought a smile to my face, so I thought I'd share it. I thinking I might incorporate
this into some sort of PropDOS midi player with a fun display.

Follow Andy's instructions above for setting up the Roland Serial Driver for this.

BTW, there's a pretty nice midi site at www.midimole.com (http://www.midimole.com)

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Chris Micro
04-22-2009, 02:21 AM
What's about compressing the Midi-File and to have an uncompressing algorithm in the propeller? If we take a look on the Lins Akkeson demo, there should be a possibility to write a simple compressing algorithm.

Chris Micro
04-23-2009, 06:41 PM
Hey Ariba,

I tried a little bit to play arround with your synthesizer object, but I do not realy understand the parameter list of your methods. Can you explain how I can generate the different instruments voices? I don't know the midi parameters, so I couldn't unterstand what paramter the functions need. Here is my little test program with which I could generate different pitches ( in your term notes ). But how could I alter the instrument?




CON

_clkmode = xtal1 + pll16x

_xinfreq = 5_000_000

OneSecond = 80_000_000



Left = 10 '<-- Audio Out pins

Right = 11

LedPin = 16



OBJ

synth : "pm_synth_20"

VAR

LONG i



PUB Main

Pins for your hardware)

synth.start(Left,Right,2) 'start synth with 20 voices

dira[LedPin]:=1

i:=1

repeat 50

synth.noteOn(50+i,2,100) 'pitch,midichannel,velocity

waitcnt(OneSecond/10+cnt)

i++

!outa[LedPin]

synth.allOff

Ariba
04-24-2009, 07:25 AM
You can change the sound with the prgChange methode of the object: synth.prgChange(SoundNumber,MidiChannel).
MIDI has 16 different channels (0..15), and every channel can play another sound. The General MIDI standard defines 128 sound numbers, look in the table inside the object to see the assigned Instruments. If you set a sound for a channel, then all notes sent with noteOn to this channel play this sound.
Every note you play needs also a noteOff to stop the the note. You can see the noteOn as pressing a key on a keyboard and noteOff for release the key. If you only use noteOn, it's like pressing many,many keys and never release theme.

Channel 10 is special in that it is for the drums, and every note plays another sound. Again the table shows the drum sound numbers.

Be aware that MIDI defines the number range different from the real passed number: The instruments 1..128 are in reality 0..127, and the channels 1..16 are 0..15 (to play drums you must pass 9 as channel number).

There are also methodes in the object to set the Main volume and the panorama position per channel, both with values from 0..127.

If you want change the instrument sounds itself, then you have to edit parameters in the table of the object, this is not possible with MIDI commands.

Andy

Chris Micro
04-24-2009, 08:36 PM
Thank you for the help. I made a new test program:


CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OneSecond = 80_000_000

Left = 10 '<-- Audio Out pins
Right = 11
TestLed = 16

OBJ
synth : "pm_synth_20"

VAR
LONG i
LONG Note
Long Channel
Long Instrument

PUB Main
synth.start(Left,Right,2) 'start synth with 20 voices
{
List of commands for pm_synth_20
================================
start(Lpin, Rpin, Cogs) : okay ==> start synthesizer in a COG
stop == stop synthesizer
noteOn(key, chan, vel)==> turn on sound (pitch,midichannel,velocity)
noteOff(key, chan)==>turn off sound
prgChange(num, chan)==> change the instrument in a channel, instruments: 0..127
volContr(vo, chan)==> volume control
panContr(pa, chan)
allOff ==> all channels off
channel 10 ==> drum channel, every note plays another sound
}
dira[TestLed]:=1

'fast note on/off test
Channel:=1
Note:=70
repeat 50
synth.noteOn(Note,Channel,100) 'pitch,midichannel,velocity
waitcnt(OneSecond/20+cnt)
synth.noteOff(Note,Channel)
waitcnt(OneSecond/20+cnt)

'test different instruments
Note:=80
Channel:=0
Instrument:=0
repeat 127
synth.prgChange(Instrument,Channel)
synth.noteOn(Note,Channel,100) 'pitch,midichannel,velocity
waitcnt(OneSecond/10+cnt)
synth.noteOff(Note,Channel)
waitcnt(OneSecond/10+cnt)
Instrument++
!outa[TestLed]

'play notes in an upcounting sequence
Channel:=2
Note:=60
i:=1
Instrument:=85 'instrument = a kind of flute?
synth.prgChange(Instrument,Channel)
repeat 50
synth.noteOn(Note+i,Channel,200) 'pitch,midichannel,velocity
waitcnt(OneSecond/20+cnt)
synth.noteOff(Note+i,Channel)
waitcnt(OneSecond/20+cnt)
i++
!outa[TestLed]

synth.allOff
synth.stop




I made some observations: in the first example, The sound seems to alter a little bit during the 50 repetitions.
I don't know how to interpret 'velocity': is it attack, decay? A value of 500 seems to give the maximum loudness, but sometimes also a little noise.
if I change to Channel 9 ( drums ) it seems not to work. http://forums.parallax.com/images/smilies/shakehead.gif ( at least in the example code )

chris

Ariba
04-24-2009, 09:45 PM
Chris Micro said...

I made some observations: in the first example, The sound seems to alter a little bit during the 50 repetitions.
I don't know how to interpret 'velocity': is it attack, decay? A value of 500 seems to give the maximum loudness, but sometimes also a little noise.
if I change to Channel 9 ( drums ) it seems not to work. http://forums.parallax.com/images/smilies/shakehead.gif ( at least in the example code )
chris


Yes it seams that the voices of the second cog play louder than the first cog. So after every 10 notes the sound change a little bit.

Velocity defines how hard a note is played. Soft=0...hard=127. Its called velocity or dynamic, because a synth keyboard measures the time between the released state of a key and the full pressed state. If you play harder, the key is faster pressed down, and therefore velocity is higher.
A high Velocity value makes the sound louder and also changes the harmonics a bit for some sounds.
It would help you if you study the MIDI specification a little bit:
en.wikipedia.org/wiki/General_MIDI (http://en.wikipedia.org/wiki/General_MIDI) and the links there.

Try the following examples for drums and chords: (copy it in your test loop)



'test chords
Note:=72
Channel:=0
Instrument:=49
repeat 8
synth.prgChange(Instrument,Channel)
synth.noteOn(Note,Channel,100) 'pitch,midichannel,velocity
synth.noteOn(Note+4,Channel,100) 'quart
synth.noteOn(Note+7,Channel,100) 'septime
waitcnt(OneSecond+cnt)
synth.noteOff(Note,Channel)
synth.noteOff(Note+4,Channel)
synth.noteOff(Note+7,Channel)
waitcnt(OneSecond*2+cnt)
Instrument+=2
!outa[TestLed]

'test drums
Channel:=9
repeat 16
synth.noteOn(40,Channel,100) 'SnareDrum,midichannel,velocity
waitcnt(OneSecond/2+cnt)
synth.noteOff(40,Channel)
synth.noteOn(40,Channel,100) 'SnareDrum,midichannel,velocity
synth.noteOn(44,Channel,120) 'HiHat,midichannel,velocity
waitcnt(OneSecond/2+cnt)
synth.noteOff(40,Channel)
synth.noteOff(44,Channel)
!outa[TestLed]




Andy

Oldbitcollector (Jeff)
04-26-2009, 03:09 AM
Still playing with Andy's Synth. :)

I wanted an easy way to experiment with creating different sounding instruments so I wrote this program.

Displays all of the variables for an instrument on the screen, allowing you to adjust them up/down
and try them out with a simple scale. Starts out with Grand Piano settings, then you take it from there.

{Personal favorite is dropping the PhaseMod to 0}

I'm hoping to come up with some nice 80's synth sounds this way. :)

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Chris Micro
05-01-2009, 08:56 PM
Hi ariba,

thanks for your help. As attachement, my beginners test programm.
Do you know, where I can find some free midi files in the net? ( yes I know google, but since midi files are used in cell phones, its very difficult to find some example midi files for free ). In earlier days I hat a 3,5inch disk with a lot of midi files for my Atari ST.
I'm thinking about some simple compressing algortihm which conpresses the midi-file to some microcontroller readable attachement ( C include file or spin data ).
It seems to me as if midi files are easy to compress. And the Linus Akkeson demo "turbulence" shows, that there a lot of music can be stored in the propeller. Probably it would be good to write a little java programm to generate the midi compressed resource.
Is anybody out there who knows if such a programm exists? At least Linus has done one.

chris

SSteve
05-01-2009, 10:18 PM
Chris Micro said...
Do you know, where I can find some free midi files in the net?


There are a lot at ClassicalArchives.com (http://www.classicalarchives.com/). I haven't been to the site in a while. I just took a quick look and it looks like they are more heavily into MP3 these days, but there are still MIDI files if you look closely.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows

links:
My band's website (http://www.theuniversalsteve.com)
Our album on the iTunes Music Store (http://click.linksynergy.com/fs-bin/stat?id=Nb9I3FbXETg&offerid=146261&type=3&subid=0&tmpid=1826&RD_PARM1=http%253A%252F%252Fitunes.apple.com%252FW ebObjects%252FMZStore.woa%252Fwa%252FviewAlbum%253 Fi%253D267294586%2526id%253D267293499%2526s%253D14 3441%2526partnerId%253D30)

Cluso99
05-10-2009, 08:47 PM
Ariba: Do you know if your simple circuit will drive headphones??

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

∑ Home of the MultiBladeProps: TriBladeProp (http://forums.parallax.com/showthread.php?p=786418), SixBladeProp (http://forums.parallax.com/showthread.php?p=780033), website (Multiple propeller pcbs) (http://bluemagic.biz/cluso.htm)
∑ Single Board Computer:∑3 Propeller ICs∑and a∑TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
∑ Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
∑ Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427))
∑ Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)
My cruising website is: ∑www.bluemagic.biz (http://www.bluemagic.biz)∑∑ MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

Ariba
05-11-2009, 01:37 AM
Chris Micro

Here is a search engine for free MIDI files:
www.midisite.co.uk/ (http://www.midisite.co.uk/)
Some post back OBC has recommended this site, and I have found some good files there:
www.midimole.com/ (http://www.midimole.com/)

Cluso99

The Audio circuit was ment as Line out. I use it with a pair of activ PC loudspeaker boxes.
But because you have asked, I tried it out with 2 Earphones from an old Walkman and an MP3 player.
I was surprised that it get a clear sound with one of the earphones, only a bit quiet (definitly no ear damage possible:)
The other one has a sound like thru a phone, but also not really bad.

One problem of the circuit is the missing decoupling C, so you have a lot of DC current thru the coil of the headphone.
Attached is version of the Audio out which should sound much better, but I have it not tried so far...

Andy

Cluso99
05-11-2009, 09:24 AM
Yes I was planning on putting a blocking cap - thought 1uF mono (no polarising). I was wondering if I could then use it as a stereo input??? (I am not proficient in analog)

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

∑ Home of the MultiBladeProps: TriBladeProp (http://forums.parallax.com/showthread.php?p=786418), SixBladeProp (http://forums.parallax.com/showthread.php?p=780033), website (Multiple propeller pcbs) (http://bluemagic.biz/cluso.htm)
∑ Single Board Computer:∑3 Propeller ICs∑and a∑TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
∑ Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
∑ Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427))
∑ Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)
My cruising website is: ∑www.bluemagic.biz (http://www.bluemagic.biz)∑∑ MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

Oldbitcollector (Jeff)
05-16-2009, 09:57 AM
Andy,

Still playing with the object. (Yes, I'm hooked!)

Question: Can you give an example of how to hold a note as long
as bit is switched? I'm using some PING))) sensors with this object
to create a very funky synth. At the moment I'm getting pauses
in the note which sound funny doing an organ or wind intrument
with this object.

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Ariba
05-16-2009, 11:50 AM
I don't know if I got this right, but here is a code which starts a note if a bit goes high and stops it when the bit goes low.
You can add as many bit tests you need in the repeat loop. Every bit can play another note, also on another channel, to get
different sounds.



...
key1 := 60
key2 := 64
ch1 := 0
sound1 := 18
synth.prgChange(sound1,ch1)
oldina := ina

repeat
if (ina ^ oldina) & 1<<bit1 'bit1 changed?
if ina[bit1]
synth.noteOn(key1,ch1,120) '0->1
else
synth.noteOff(key1,ch1) '1->0

if (ina ^ oldina) & 1<<bit2 'bit2 changed?
if ina[bit2]
synth.noteOn(key2,ch1,120) '0->1
else
synth.noteOff(key2,ch1) '1->0

oldina := ina



(This is not testet! )

Andy

Clock Loop
06-01-2009, 06:18 PM
Thank you for posting this example, I am new to the propeller but have gotten in deep due to awesome people who share their hard work.

Thank you.
:)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Meh. Nothing here, move along.

hinv
08-10-2009, 09:48 AM
Hi Andy,

Now that rokicki and lonesock have sdcard reads over 2MB/second (at 100MHz clock), maybe it would be possible for type1 midi files now?

Thanks,
Doug

hinv
08-10-2009, 10:46 AM
Wow!

I actually tried it out just now, and I am very impressed. I didn't know the propeller could do this! Great work Andy!

Doug

Ariba
08-11-2009, 04:26 AM
Thank you Doug.

Yes with the new FSRW a Format 1 player should be doable, not because it's faster, but because the driver allows to read several files at the same time. So it should also be possible to read the same file at several positions with the right number of instances of the FSRW object.

I just have not the time, to do it now. And I know, if I program something which produces music, this needs a lot of time, because every time a part works, I always get lost in hearing music instead of continue programming.

Andy

Oldbitcollector (Jeff)
08-11-2009, 05:05 AM
@Andy, If you do it, I'll include it in my midi player... Nudge.. Nudge.. :)

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

laserjones
09-22-2009, 03:29 AM
Hi Andy, this is absolutely awesome! Congratulations!

Could you explain, in a few words, the basic principle how you managed to implement as many as 20 oscillators (plus envelope) in one cog that has only two hardware timers? How do you get the frequencies right? And are you using the Propeller's built-in sine table?

Ariba
09-22-2009, 06:29 AM
Thank's laserjones

I will try to explain it:

The cog-counters are not used for the oscillators, they are used for the DACs (in DUTY mode).

The whole cog has a single loop which runs exactly with a rate of 32 kHz. The code in this loop is splitted in 12 time slices.
10 time slices calculates the 10 voices, 1 slice calculates a single envelope, and the 12.th slice calculates the mixing of the 10 voices, limits the max. and min. value and writes the samples to the DACs.

A voice has 2 oscillators. The Oscilllators are made with the DDS (Direct Digital Synthesis) principle, you will find a lot of informations in the NET about that, but here is my short explanation:


voices add phs02,frq02 'Osc 2 voice 0
abs t2,phs02 'Saw to Triangle
add phs01,frq01 'Osc 1
....



You have a phase and a frequency register. The freq.register is added to the phase register once every 32 kHz. So the phase-accumulator increases with a rate depending of the value of the freq.register. Because the register has a limited size (32bit) the phase register rolls over after a while (see (1) in my picture). The phase is a signed register, so the roll-over occures from $7FFF_FFFF to $8000_0000 (the most positive to the most negative value). The frequency off the roll overs is the frequency of the oscillator that you will hear. And because the value of phase is continuously increasing between the roll overs, you get a Sawthooth waveform. To produce higher or lower oscillator frequencies you need just to vary the freq-register value (2).
The right freq.register values for the notes are precalculated in the frqtab[ ] array.

To control the harmonics of a FM or PhaseMod- synthesis we need a sine like waveform from the oscillators. For that I use not the rom-sine-table, but take just the absolute value of the phase register. As you see in (3) the absolute value of a Saw-wave is a Triangle wave, and this is near to a sine. The Propeller has Assembly instructions like ADDABS which does an addition and a waveform translation in one cycle!.

In every 32 kHz periode only 1 envelope is calculated, but every time for another voice. So after 10 periodes the envelopes for all voices are done. Because the envelope is a slowly changing curve the resulting sample fequency of 3.2 kHz is good enough.

I hope this makes it a little more clear

Andy
http://forums.parallax.com/attachment.php?attachmentid=63946

Cluso99
09-22-2009, 06:56 AM
Nice description Andy, thanks http://forums.parallax.com/images/smilies/smile.gif

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

∑ Home of the MultiBladeProps: TriBlade (http://forums.parallax.com/showthread.php?p=786418),∑RamBlade (http://forums.parallax.com/showthread.php?p=838091), RetroBlade (http://forums.parallax.com/showthread.php?p=838053),∑TwinBlade (http://forums.parallax.com/showthread.php?p=806697),∑SixBlade (http://forums.parallax.com/showthread.php?p=780033), website (http://bluemagic.biz/cluso.htm)
∑ Single Board Computer:∑3 Propeller ICs∑and a∑TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
∑ Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
∑ Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427)) ZiCog (Z80) (http://forums.parallax.com/showthread.php?p=788511) , MoCog (6809) (http://forums.parallax.com/showthread.php?p=811043)
∑ Search the Propeller forums (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)∑(uses advanced Google search)
My cruising website is: ∑www.bluemagic.biz (http://www.bluemagic.biz)∑∑ MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

laserjones
09-22-2009, 04:05 PM
Thanks a lot, Andy!


Ariba said...
The whole cog has a single loop which runs exactly with a rate of 32 kHz.

How do you achieve this exact frequency (and the 12 time slices) if you don't use the hardware counters? Or are you using the same 32 kHz clock for the DACs?

Is the triangle generation considerably faster than using the sine table?

So you generate two triangle oscillators per voice, and then you modify the frequency register of one oscillator by the amplitude value of the other?

Ariba
09-23-2009, 12:51 AM
> How do you achieve this exact frequency (and the 12 time slices) if you don't use the hardware counters? Or are you using the same 32 kHz clock for the DACs?

I use the system counter CNT. The exact periode is done with the WAITCNT tm,rate at label loopend.
The time slices are just code parts in the loop, that are written one after the other, and every part needs a defined amount of time.
All the parts together must be a little bit shorter than the available ticks for the periode. The waitcnt then waits for the exact time.
The rate-ticks are calculated in the Spin start methode from the clkfreq, and passed to the assembly code.

> Is the triangle generation considerably faster than using the sine table?

Oh yes. Generating the absolute value is a single PASM instruction (or a half in case of ADDABS :). The ROM sine table stores only 1/4 of the sine and you need shifting and swapping to get a full sine cycle. You need minimal 8 instruction and one is a hub access (RDWORD) which can take a lot of time.

> So you generate two triangle oscillators per voice, and then you modify the frequency register of one oscillator by the amplitude value of the other?

Not exactly, this would be FM. The modulation is a mix of the OSC2-Triangle with the OSC1-Triangle and the DAC output multiplied with the modulation intensity (PM and FB). This modulation is added to the phase of OSC1 before I do the Saw to Triangle translation. That's why I call it Phase Modulation synthesis. The exact modulation path is shown in the diagram at begin of the source code.
(Yamaha's FM synthesis is in fact also a phase modulation synthesis, they just call it FM. You hear the difference at low modulation frequencies. With FM you would get a heavy vibrato, with PM just a phasing. Modulation with audio frequencies gives the same result with both types).

Andy

laserjones
10-21-2009, 05:15 PM
Hello again,

I've been thinking again about your design, and I wonder how you achieve the required frequency resolution with a master clock of only 32 kHz. For example, the highest note on a piano is 4.186 kHz. If we divide your 32 kHz by this, the result is 7.64 clock ticks per wave cycle. But since the phase register can only flip over at a whole-numbered clock cycle, we would need to round this to a divider of 8, which would result in 4.0 kHz instead of 4.186 kHz, which is an error of almost 5 %. Even worse: The second-highest piano note (3.951 kHz) would require a divider of 8.1 - if we round that, we have 8 again, i.e. the same frequency as for the other note. So this error is obviously too large, because the frequency difference between two adjacent notes is only about 6 %.

So I assume your program cannot play notes with such high frequencies? What is the highest note you can produce with sufficient accuracy?


EDIT: It just dawned on me that the DDS principle is probably even smarter than I thought. Am I right to assume that in case of the highest note mentioned above, the wave period would automatically vary between 7 and 8 master clock ticks with a ratio that would result in an average frequency of 4.186 kHz? But even if this is the case, these variations (jitter) are probably audible at high frequencies, right?

Kind regards,
Joerg

Post Edited (laserjones) : 10/21/2009 10:59:58 AM GMT

Ariba
10-23-2009, 10:18 AM
Hello Joerg

Yes, DDS is smart enough to compensate the error in the next periode, so it's no problem to play a note with 4.186 kHz.
The frequency resolution is in fact: 32kHz / 2^32 = 0.0000074 Hz for every oscillator. I.e. you can detune the 2 oscillators by 0.1 Hz and get a phasing with 10 seconds periode.
You should see it more like a 4.186 kHz Signal sampled with 32 kHz, the ratio between the 32kHz and the signal frequency is not important, the 32 kHz defines only the rate of the single computed samples.
If you have a 4.1 kHz sine then then all is OK, if you want a 4.1 kHz square wave then you will hear a lot of jitter (aliasing). So the highest frequency is theoretical 16 kHz, but in reality maybe 6..8 kHz for a sine wave (= 4..5 samples per periode).

Andy

laserjones
10-23-2009, 03:53 PM
Ah, OK - when I think about it, it's clear that the jitter is not such a big problem with sine or triangle waves, because the amplitude is low at the border between two periods, where the inaccuracies occur. Thanks a lot for the good explanation!

So if I want to make a synthesizer that also does square waves, I'd need a higher master frequency, which should be no problem if I use less oscillators per cog than your program. I'll let you know when I have something to show.

EDIT: Wait a minute - something must be wrong with your formula (32 kHz / 2^32 = 0.0000074 Hz), because increasing the master clock frequency should result in a better resolution, i.e. a smaller value, but in your formula the value increases with the clock frequency ...??

Joerg

Post Edited (laserjones) : 10/23/2009 9:01:33 AM GMT

Ariba
10-24-2009, 12:04 AM
laserjones said...
Wait a minute - something must be wrong with your formula (32 kHz / 2^32 = 0.0000074 Hz), because increasing the master clock frequency should result in a better resolution, i.e. a smaller value, but in your formula the value increases with the clock frequency ...??


No, the formula is correct. With frequency resolution, I mean how exactly can you define a desired frequency with the freq-register. Or in other words the effect of changing one LSB of the frequency value added to the phase register. With higher sampling frequency this resolution is lower (the LSB steps are higher), but still ways better than what you need for a synthesizer (thanks to the 32 Bit processor). To calculate the needed resolution:
Say the lowest note plays with 30 Hz, and we need 0.1% accuracy, then 30 / 1000 = 0.03Hz resolution is good enough. These would need a DDS with 20 Bits.

> So if I want to make a synthesizer that also does square waves, ...

No synthesizer or other music instrument (synthetic or accoustic) needs square waves with 4 kHz. This is just not hearable by our ears. A 4 kHz square wave has strong harmonics at 12, 20, 28 ... kHz and frequencies over 16..20 kHz can not be hear.
A subtractive synthesizer with square wave oscillators has a Low pass filter that filters out this high frequency to get accomodate sounds. A additive synthesizer like FM or my PM needs sine (or triangle) oscillators otherwise the harmonics, produced by the modulation, can't be controlled good enough. The original FM synthesis has Key-scaling of the modulation intensity for every oscillator, so that the modulation at higher frequencies goes to zero.

But with a higher sample frequency (48, or 64, 96 kHz) you will get a better sound quality anyway. Mainly because of the reduced aliasing. But then you need perhaps also better DACs and a strong 20 kHz Low pass filter at the output and a more detailed synthesis algorithm.

Andy

laserjones
10-24-2009, 02:28 AM
Ariba said...
With higher sampling frequency this resolution is lower

It took me a while to understand that you are right, but you definitely are. http://forums.parallax.com/images/smilies/smile.gif


Ariba said...
No synthesizer or other music instrument (synthetic or accoustic) needs square waves with 4 kHz. This is just not hearable by our ears.

OK, good point. But it would not be elegant having to switch the oscillator from square to triangle above a certain frequency. Well, another possibility would be a simple fixed low-pass filter that removes the higher harmonics. The question is whether that would remove the jitter to the same degree as if it had been a triangle right from the start. But since I'll go for a higher sample frequency, I probably won't run into the problem anyway.

Thanks again for the interesting discussion!
Joerg

Oldbitcollector (Jeff)
12-03-2009, 08:31 PM
@Andy,

I've got a little game in the Hydra forum which incorporated your midi player for
background music. (Christmas Catch) The midi file is actually only 8k in size.

Can you give an example of how to use your gm_synth, loading the midi file
as a DAT inclusion? Is this possible?

Thanks again for a great sound driver!

OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Baggers
12-03-2009, 09:02 PM
OBC, without looking at the code, I'd say change the the FSRW stuff in gm_synth, to a new func, and have POPEN, PREAD functions,

POPEN would set a pointer to the beginning of the dat inclusion, and PREAD would read the byte from where the pointer is and increase the pointer :D

You may need filesize possibly seek but maybe not, so don't quote me on that, as I've not looked at the source for gm_synth in a long while.

that's how I'd do it without modding the gm_synth too much, that way, you can just have a comment on the object you want.

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


Oldbitcollector (Jeff)
12-03-2009, 09:10 PM
Thanks Baggers..

Those two commands are significant gaps in my spin knowledge.
I'll be in the spin manual tonight! Do you happen to have any good examples
in any of your code on these commands?

Thanks
OBC

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Baggers
12-03-2009, 09:12 PM
tell you what OBC, mail me your source project so far, with the midi file included, and I'll get it working for you.

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


Ariba
12-03-2009, 10:02 PM
OBC

Attached is a version of the MIDI player which plays a MIDI file from HubRAM.
You can delete all the show-methode calls in the midiplay methode, and the show methode itself.
As you see, I have just replaced the pread to a local methode which reads from HubRAM, exactly as
Baggers suggested (but I've made it some month ago :)

Andy

Baggers
12-03-2009, 11:02 PM
Thanks Ariba :)

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


Oldbitcollector (Jeff)
12-04-2009, 12:48 AM
Positively perfect! Thank you Andy!

An excellent drop in for getting simple music/sound into games. AWESOME.

OBC


Edit: Still planning to sit down with the book and this source and read up on PREAD & POPEN.

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

Visit the: The Propeller Pages (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

Hanno
12-08-2009, 07:04 AM
Here's a great midi site: musicby.jw-music.net/midi.php?critere=taille&lang=us (http://musicby.jw-music.net/midi.php?critere=taille&lang=us)
Some need to be converted to format 0.
I do have problems getting ~60% of files to play correctly- many get stuck on one note.
What should I look out for?
I would love to include a "Play Midi" block in 12Blocks- is that ok? I might write a simple virtual keyboard that would let kids play music to later download to the Prop.
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

James Long
12-08-2009, 07:09 AM
Hanno said...
Here's a great midi site: musicby.jw-music.net/midi.php?critere=taille〈=us (http://musicby.jw-music.net/midi.php?critere=taille‚Ć©=us)
Some need to be converted to format 0.
I do have problems getting ~60% of files to play correctly- many get stuck on one note.
What should I look out for?
I would love to include a "Play Midi" block in 12Blocks- is that ok? I might write a simple virtual keyboard that would let kids play music to later download to the Prop.
Hanno


Hanno,

What happens is multi tracks get combined in to one. If the two tracks had a note of the same type, the note on and the note off create a mess in the single track (format 0). There are overlapping notes, and one of those needs to be removed, which can be a major chore. You need to find software to convert which knows to remove the overlapping notes. I found this out when I started playing with midi about a year ago.

James L

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services (http://www.lil-brother.com)

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits (http://www.savagecircuits.com). Learn to build your own Gizmos!

Ariba
12-09-2009, 11:33 AM
Hanno

I know there is a problem with some MIDI files. The critical part is the begin of the file. Depending on the Sequencer and Target synthesizer there are a lot of META events and SysEx (system exclusiv) messages at begin. From the description I had, when I
coded the Midi file interpreter, I found no general code which works for all MIDI files. If I debugged one file and made changes,
then another doesn't work anymore.

Because the MIDI file part was only meant as a demo for my Synthesizer object, I was happy how it worked with the demo files.
Now I have maybe 100 others on my SD card which work well.

What it needs to improve it is a better description of the special parts of a MIDI file, or perhaps just a MIDI converter which filters out all the SysEx messages.
If you want look into it, it's the CASE $F0 part of the MIDI byte decoder, that must be changed. Now it's a little mess and only
made to get the Tempo information out of the file.

A virtual keyboard that plays notes should not be a problem, the synthesizer object works well, only AllNotesOff seems to have
a little problem sometimes.

Andy

Hanno
12-09-2009, 01:48 PM
Thanks Andy- I thought as much.

12Blocks already includes graphical wizards to let you easily do things like draw graphic sprites and vector drawing. I'm thinking of coding up a simple virtual keyboard which reads/writes midi files. That would let people drag a block called "play midi" to their worksheet and click it's parameter to play music. Pressing "run" would compile the spin file and load the Propeller. Currently I support wav files, speech synthesis, tones, and recording wav files in the audio section of the library.
Got any links that would help me start? Sample program which outputs midi notes? A dll which does this? I'd prefer not to reinvent the wheel...

A link to 12blocks is in my sig...
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon (http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505)
Developer of ViewPort (http://hannoware.com/viewport), the premier visual debugger for the Propeller (read the review here (http://www.parallax.com/Portals/0/Downloads/docs/article/ROBOT_ViewPort.pdf), thread here (http://forums.parallax.com/showthread.php?p=760083)),
12Blocks (http://12blocks.com), the block-based programming environment (thread here (http://forums.parallax.com/showthread.php?p=819680))
and PropScope (http://hannoware.com/propscope), the multi-function USB oscilloscope/function generator/logic analyzer

James Long
12-20-2009, 08:53 AM
Does anyone know how fast Midi can output events.

Like, how many note on and note off events can Midi output per second?

I'm working to output the notes to a I2C bus with 8 chips. Each chip takes 3 bytes of info, and the bus runs at 400K.

I wondering if I have enough bandwidth to do it.

Anyone.....Andy??

James L

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services (http://www.lil-brother.com)

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits (http://www.savagecircuits.com). Learn to build your own Gizmos!

kerryw
12-20-2009, 09:58 AM
James Long said...
Does anyone know how fast Midi can output events.

Like, how many note on and note off events can Midi output per second?

I'm working to output the notes to a I2C bus with 8 chips. Each chip takes 3 bytes of info, and the bus runs at 400K.

I wondering if I have enough bandwidth to do it.

Anyone.....Andy??

James L


Midi runs a 31,250 baud. It uses 10 bits per frame (1 start, 8 bits of data, 1 stop). The various messages look like they take up from 1 to 3 frames each. This links seems to cover the spec fairly well : http://www.srm.com/qtma/davidsmidispec.html


Kerry

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Heaven help me Marge, I'm just not that smart." - Homer Simpson

James Long
12-20-2009, 10:24 AM
kerryw said...
Midi runs a 31,250 baud. It uses 10 bits per frame (1 start, 8 bits of data, 1 stop). The various messages look like they take up from 1 to 3 frames each. This links seems to cover the spec fairly well : http://www.srm.com/qtma/davidsmidispec.html

Kerry


Kerry,

Thanks for the link, that is exactly what I needed to figure out.

It looks like I have a very narrow margin but should be able to output to all 8 chips and still have a small amount of bandwidth left on the I2C bus.

For anyone interested here is how I calculated this:

400K bus
8 I2C chips on the bus

400,000 / 8 = 50,000 bps for each chip in reality.

It takes about 28 bits to set the outputs on the I2C chip (3 bytes plus start, stop and ack). We are going to use 32 to be safe.

50,000 / 32 = 1562.5 events per second.


Midi comes in at 31250 bps

If each event takes 30 bits then

31250 / 30 = 1041.6 events per second (note on/note off events).


All this above means if you want to output each note to an I2C bus with PCF 8575 chips, it is possible. It does require a fast I2C bus communication like Mike Green has in some of his objects. The bus must be run at maximum speed (400K) for it to work.

The above shows the bus at maximum speed (Fast speed of 400K) will have a speed advantage of 66% (approximately).

This is great news for the design I've been working on.

James L

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services (http://www.lil-brother.com)

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits (http://www.savagecircuits.com). Learn to build your own Gizmos!

John A. Zoidberg
10-20-2010, 02:59 PM
Hello there,

Sorry to bump up an old post, but I found the object very interesting, and I wished to include it into one of my projects.

However, the intended pins to the SD card (0-4) are already occupied, and I want to connected it to somewhere between pins 20-24.

Could it be possible? :)

K2
10-20-2010, 03:14 PM
I'm glad you bumped it up - I didn't know of its existence. It's fantastic!

John A. Zoidberg
10-20-2010, 03:21 PM
Thanks. I'm trying it for my musical clock, and also a Christmas present (it's an electronic Christmas tree) for my close friend.

In fact, I tried to design the DDS by myself, but ah, that package offered is better.

I sorted out the pins - I'll try it later tomorrow morning. I need to find a SD-card holder, or I have to homebrew it by using the header pins. :)

Ariba
10-20-2010, 06:22 PM
John

It should work with any set of pins as long as they are in the right order for the old FSRW object. The first parameter in the CON section defines the SD basepin (as you have noticed already).
It will be not very hard to change it to the new FSRW, then you can use any pins for the SD and also SD cards over 2GB.

But if you want to play only 1 MIDI file and this is under 22 kByte then you can use the attached Spin file. It includes the MIDI file into the HubRAM and plays it from there. No SD card is needed!
You find the "NUTRAC.MID" for this example in the ZIP file of the first post.

Andy

John A. Zoidberg
10-21-2010, 01:48 AM
John

It should work with any set of pins as long as they are in the right order for the old FSRW object. The first parameter in the CON section defines the SD basepin (as you have noticed already).
It will be not very hard to change it to the new FSRW, then you can use any pins for the SD and also SD cards over 2GB.

But if you want to play only 1 MIDI file and this is under 22 kByte then you can use the attached Spin file. It includes the MIDI file into the HubRAM and plays it from there. No SD card is needed!
You find the "NUTRAC.MID" for this example in the ZIP file of the first post.

Andy

Thanks for the help. By the way, could it be possible to switch files inside during playing? Or it's only programmed to play one MIDI file in the SD-card? :)

Ariba
10-21-2010, 03:00 AM
What do you mean with "switch files inside during playing" ?
The player from the first post plays 5 midi files from a list. It's prgrammed to play always the whole file and then the next.
You can not mix two files or play parts of a file with the existing code. But you can use a MIDI Editor (Sequencer) to mix and cut MIDI files.

Andy

John A. Zoidberg
10-21-2010, 04:07 AM
What do you mean with "switch files inside during playing" ?
The player from the first post plays 5 midi files from a list. It's prgrammed to play always the whole file and then the next.
You can not mix two files or play parts of a file with the existing code. But you can use a MIDI Editor (Sequencer) to mix and cut MIDI files.

Andy

Don't worry, I'm not trying to play parts of the MIDI files or mix it altogether.

I mean, I'll program a supplemental interface (like press button) for me to select which song to play (or to skip a song) - is it feasible in the system? :D

Ariba
10-21-2010, 05:20 AM
Ah, OK this is easy.

The midiplay methode plays a whole file, you need to pass only the filename.
So your a simplified repeat loop in the Main methode can look like that:

repeat
'get buttons
case buttons
1: midiplay(string("file1.mid"))
2: midiplay(string("file2.mid"))
3: midiplay(string("file3.mid"))
4: midiplay(string("file4.mid"))

The 'get buttons' and the case values depends on your button hardware.

Andy

John A. Zoidberg
10-21-2010, 05:27 AM
Ah, OK this is easy.

The midiplay methode plays a whole file, you need to pass only the filename.
So your a simplified repeat loop in the Main methode can look like that:

repeat
'get buttons
case buttons
1: midiplay(string("file1.mid"))
2: midiplay(string("file2.mid"))
3: midiplay(string("file3.mid"))
4: midiplay(string("file4.mid"))

The 'get buttons' and the case values depends on your button hardware.

Andy

Ah I see. Danke for the great code. I'll test it by today, provided if I manage to make my home-made SD-card cradle first. :)

Lord Steve
12-18-2010, 03:35 AM
Ariba,

Could you go over how the idea in general and the code in particular of how you affect the phase accumulator (or is it the frequency register?) of the first operator by the amplitude(?) of the second?

Also, what is the difference between what you do here (phase modulation) and real frequency modulation? How can we do real FM?

Thanks!

Ariba
12-18-2010, 04:44 PM
Ariba,

Could you go over how the idea in general and the code in particular of how you affect the phase accumulator (or is it the frequency register?) of the first operator by the amplitude(?) of the second?


Neither the phase accumulator nor the freq register is affected by the modulation. The modulation is done after the DDS calculation by adding the modulation wave to the phase before looking up the waveform from the wave-table (OK I have no wave-lookup tables but something similar, and its easier to visualize it with a table).
http://forums.parallax.com/attachment.php?attachmentid=76453&d=1292694213

If the modulation is zero, the phase increases linear and reads out the Triangle wave from the lookup table. With modulation the phase iincreases no more linear. If the modulation sample is negativ the phase grows slower otherwise faster. The following picture shows 2 modulation intensities in blue and red. Here the modulation wave is in sync and has the same frequency to make it simple.
As you see the read out waveform from the table gets changed from a triangle to a sawtooth wave. If the modulation frequency is not the same as the carrier you get totally different waveforms, but all these waveforms go back to a triangle if you lower the modulation intensity. So compared with a normal subtractiv synthesizer we can say: The frequency ratio defines the waveform and the modulation intensity the cutoff frequency.
http://forums.parallax.com/attachment.php?attachmentid=76454&d=1292694214



Also, what is the difference between what you do here (phase modulation) and real frequency modulation? How can we do real FM?

You can do a real FM if you accumulate the modulated phase value in the PHASE register instead of the unmodulated (the green line in the first picture). But this is very uncommon, because it can result in odd frequencies if the modulation is not totally symmetrical. Also Yahama does in reality a Phase modulation, also if they call it FM.
The big difference to the real FM-Synthesizers is that they work with Sinus instead of Triangle waves and that they have more oscillators in more combinations per voice.
It may be possible to do a more advanced FM synthesis but I think you get then only 1 voice per cog.

Andy

76453 76454

Lord Steve
12-18-2010, 04:55 PM
Ah! I was multiplying the frequency0 register by the phase1 register before looking up phase0. I tried just adding the phases like you said and it worked! Much faster than a multiply, too! Thanks a lot, this is so cool.

I've been working on modeling sine waves with parabola segments (just for the fun of it) and wanted to integrate that idea with ideas from your synth. Great object, and very inspirational. Thanks for making it.

John A. Zoidberg
04-06-2012, 06:46 AM
Hello Andy,

I've looked in through the code, especially the synthesizer part, and I'm very amazed that you used triangle wave instead of a sine. Looking at the fourier transform of the triangle wave, the other harmonics are quite "diminished", hence of the "sine-wave sounding".

However, I'm curious about how did you manage to manually calculate the triangle wave without using any branches.

All I went on the pseudocode was this:

if(accumulator < pi)
accumulator += phase
else
accumulator -= phase

if(accumulator > max_accumulator)
accumulator = 0;

The code is inefficient of course, and yours are much more better than mine.

I'm using this into the dsPIC, cranked up to 80MHz of course. :)

average joe
04-06-2012, 08:20 AM
Andy, great work! I just loaded up the midi moul on my synth hardware and ended up playing with it for about half an hour! I could only find a handful of patches. I'm curious as to which patches are actually implemented.

Ahle2
04-06-2012, 08:35 AM
@John A. Zoidberg
(http://forums.parallax.com/member.php?61172-John-A.-Zoidberg)
Making a triangle wave is easy.


If MSB of accumulator is set
sample := accumulator << 1
else
sample := (~accumulator) << 1

And using the awesome Propeller instruction set it's even easier:

abs sample, phaseAccumulator
shl sample, #1

Rayman
04-06-2012, 10:58 AM
I just re-read this first post and noticed this code requires converting midi from type 1 to type 0.

The program I use now to do this is called "gn1to0". This is what VLSI.com recommends for use with their VS1003 MP3/midi player chip.
Haven't tried it with this code, but I think it will work...

John A. Zoidberg
04-06-2012, 11:31 AM
@Ahle2

Thanks for the pseudocode. I'll just translate it and modify for my dsPIC in the interrupt. :)

average joe
04-06-2012, 11:45 AM
I was just playing around with this object and loaded up a song for S&G. So here's "Tool -Stinkfist" on the GM sound set. I did use "real" drums and bass, because the drums didn't come out well on the GM set.
Any comments, suggestions or requests appreciated!
http://soundcloud.com/joe-heinz/stinkfest-on-proper-midi-synth
Thanks again Andy for this wonderful object!

John A. Zoidberg
04-06-2012, 12:40 PM
I was just playing around with this object and loaded up a song for S&G. So here's "Tool -Stinkfist" on the GM sound set. I did use "real" drums and bass, because the drums didn't come out well on the GM set.
Any comments, suggestions or requests appreciated!
http://soundcloud.com/joe-heinz/stinkfest-on-proper-midi-synth
Thanks again Andy for this wonderful object!

I like the soundtrack. It's very in a 80s in style. It would fit certain 90s old video games for sure too. :)

GordonMcComb
04-06-2012, 03:31 PM
So here's "Tool -Stinkfist" on the GM sound set. I did use "real" drums and bass, because the drums didn't come out well on the GM set.
Any comments, suggestions or requests appreciated!

Nice sample! Thanks for posting. Can you post the mid file? Is it sharable? What synth did you use for the bass and percussion?

-- Gordon

average joe
04-06-2012, 04:01 PM
A big thanks! Here's the midi file I used. I have a VERY complex setup, so I won't get into all the details. Basically I use Ableton LIVE to map and playback the midi file. I use Reason 4.0 for the sounds. I also did a sample of Skrillex - Scary Monsters and Nice Sprites
http://soundcloud.com/joe-heinz/skrillex-scary-monsters-and
Also, I remixed an original song with as well
http://soundcloud.com/joe-heinz/give-me

GordonMcComb
04-06-2012, 04:46 PM
Also, I remixed an original song with as well
http://soundcloud.com/joe-heinz/give-me

Love it! Angry bees!! This reminds me of the classic analog synth licks that you just don't hear today. Catchy tune, too.

I take it the lead piano isn't from the FM synthesis.

-- Gordon

average joe
04-06-2012, 04:55 PM
Thanks again! Actually it's ALL the FM *well PM but why split hairs* except drums and the "wobble" bass. I think I might have had a "piano/strings" layer mixed in slightly for a little extra phatness!
I will get to your PM in a bit, gotta change a water pump on a POS Ford first :(

Ariba
04-06-2012, 05:26 PM
Hello Andy,

I've looked in through the code, especially the synthesizer part, and I'm very amazed that you used triangle wave instead of a sine. Looking at the fourier transform of the triangle wave, the other harmonics are quite "diminished", hence of the "sine-wave sounding".

However, I'm curious about how did you manage to manually calculate the triangle wave without using any branches.

All I went on the pseudocode was this:

if(accumulator < pi)
accumulator += phase
else
accumulator -= phase

if(accumulator > max_accumulator)
accumulator = 0;

The code is inefficient of course, and yours are much more better than mine.

I'm using this into the dsPIC, cranked up to 80MHz of course. :)

Hi John

I also have some dsPICs here intendet for sound synthesis (there is one with a 16Bit stereo DAC). But I had not the time to play with them, so far...

Regarding Triangle: As Ahle says the simplest way is just to build the absolute value of the sawtooth which you get directly from a DDS generator. See post #60 of this thread, I tried to explain it there. The resulting triangle has a DC offset so you should also subtract this offset:
abs tri,saw
sub tri,offset
...
offset long $4000_0000

Andy

Ariba
04-06-2012, 05:38 PM
@average joe

It's nice to hear that someone with MIDI equipment plays with my little synth. I know the drums are not the highlight of the object, drums really need sound-samples today, FM or PM is a bad architecture for that. Also the accoustic guitar sounds could need some improvements.

I did some experiments with single cycle wave samples, which are played by one cog and modified by a second cog (filtered, envelope volume). These experiments may result in another MIDI synth object one day.
Another idea is to play long wave samples from SD card for drums together with PM synthesis for instruments, I think playing 4 samples at the same time should be enough for that.

Andy

average joe
04-06-2012, 06:07 PM
Midi drums are always difficult to make sound right. The drum samples I use are HEAVILY processed. Guitars are another story completely. Being a guitar player, I despise midi guitars. Even the most expensive synths I've played don't sound right, even playing the RIGHT NOTES! I have tried sampling my guitar and come up with better results, but only after extensive work. Getting FM guitars and drums sounding GOOD is not something I consider possible. I do think your drums could be used for noise generation, but need to play around a bit more.

I have been thinking about building a hardware base for DDS or DCO based system. I've got some ssm 2044 LPF chips I want to build a filter for. I also have several VCA's that would go well in an analog synth. I would be really interested in checking out your sampled-based synth when you get around to working on it. Playing long samples from an SD card would be ok, but I would go for loading samples to RAM and from RAM to DAC. I know this requires more hardware, but I think it offers some unique benefits. I have been thinking about adapting a circuit similar to the counter based RAM Dr Acula and I are working. This thread http://forums.parallax.com/showthread.php?137999-LCD-touchscreen-A-development-thread has a bit about the hardware I'm working on. My current hardware is similar to post #84. The new hardware will be something like post #144. Any thoughts? I'm still waiting for parts to get started, but will keep you updated!

Ariba
04-06-2012, 06:52 PM
I only compare my synth with other synthesizers, not with real accustic instruments. You never reach the sound of a real guitar especially if played solo.
And for sure if my synth were as good as the best commercial synths, I never would release it for free as an object ;-)

I've made already a lot of hand drawing schematics for Propeller driven analog synthesizers. But not realized one so far.
The Propeller is ideal to produce DCOs with it's counters and then control some analog filters and VCAs. Something like my Oberheim Matrix 6. At the same time another cog can play some sound samples. Another cog can decode the MIDI stream and control all the synthesis cogs.

Yes if you have a big RAM for sound samples, you can play more of them at the sime time than direct from SD card. With some Hub-FIFO buffer for every voice (=caching) you don't need a complicated hardware for the RAM.

But when I think about it, I always came to the conclusion that the Prop 2 will be much better to do what I want. There are a lot of DACs and Hardware multipliers and SD-RAM interface and ... I just not knew that I have to wait so long...

Andy

Ahle2
04-06-2012, 07:30 PM
@average joe
Why not use a bounce of CEM3394 as a basis for a Propeller controller polyfonic analog synthesizer?
It may be a little bit like cheating, but it's an easy way to get started.
I know it sounds good because it's the chip used in Doepfer Dark Energy; And I happen to have a Dark Energy sitting next to me right now. :)
91426

average joe
04-06-2012, 07:52 PM
@Johannes, the CEM 3394 is a great chip, but a bit difficult to find. If I ever get my hands on one, I will have to get it working. There are several chips that would provide a jump start, but I think in the end they would limit flexibility. Of course I could be wrong.

@Andy, I did a side by side comparison with my Roland CM-64 (MT-32 and PCM) and it is on par with MT-32 IMO... *gotta run, TBC*