Go Down

Topic: Arduino Polyphonic Synth (Read 10307 times) previous topic - next topic

amacmullen14

Alright, HUGE progress!

I went from using 2 timers for monophonic sound, to using only one timer for 4 part polyphony!

I haven't written the midi handling code yet to handle polyphony, but the synth is capable of playing 4 notes.

Right now it plays the root note (as sent by the midi keyboard), a major third, a perfect fifth, and an octave.  I just chose these notes arbitrarily, it's not limited to certain intervals or notes, it's just a test for now.

Here's a sound sample:
POLYPHONY WOOO

I can officially say this arduino synth have surpassed the audio production capabilities of a gameboy!

sushyoshi

Very nice.

I´ve just ordered my Arduino to start playing with stuffs like that. I was feeling very limited doing sequencers with analog compnents such as CMOS. Anyway i did make a good Atari Punk Console like sequencer that had some good sounds to it but it uses so much electronics.
I guess the road to synthesizers is really throuh uC.

Anyway keep posting with improvements as I am looking foward to see them. :P

amacmullen14

A little progress today, and I filmed a simple demo of the synth so far.  I got the arduino doing sprite-based graphics (to display numbers) at the same time it's acting as a MIDI polyphonic synth.  The 4x4 characters that I made for it to display are convenient since each can be stored in a single unsigned int.

There are 4 numbers on the screen, each turns on when a corresponding voice on the synth is playing.
Songs:  Dr wily stage 1 theme, megaman 2; UN owen was her, embodiment of scarlet devil.
http://www.youtube.com/watch?v=o7_udMf-5h8

joemarshall

Blimey, that looks pretty neat.

I dunno if you'd be interested, but I've put up some code for an 8 voice + 1 filter synth that I'm building - see the thread below.
http://arduino.cc/forum/index.php/topic,80569.0.html

The oscillator etc. code is hacked together in assembler to be extremely efficient, whilst using a nice 256 byte wavetable, and with 64 volume levels per oscillator for nice polyphonic playback.

I really need to get a nice box sorted for mine - that looks so much cooler with the lovely well built box. Hmm.

Joe


amacmullen14


Blimey, that looks pretty neat.

I dunno if you'd be interested, but I've put up some code for an 8 voice + 1 filter synth that I'm building - see the thread below.
http://arduino.cc/forum/index.php/topic,80569.0.html

The oscillator etc. code is hacked together in assembler to be extremely efficient, whilst using a nice 256 byte wavetable, and with 64 volume levels per oscillator for nice polyphonic playback.

I really need to get a nice box sorted for mine - that looks so much cooler with the lovely well built box. Hmm.

Joe




Thanks, and well done on your project.  I would look at the code, but I like figuring things out on my own!   :)

I was thinking about rewriting my ISR in assembly for speed, I might get around to that sometime.  First I'd have to learn assembly...   :smiley-roll-sweat:

The 16 byte wavetable was a bit arbitrary, I could easily set it to do more (within the frequency limits of my code; I would probably just have it step by powers of 2 for higher frequencies) but I just haven't made up the larger wavetables.  I just typed up some hex values for triangle, sawtooth, and square waves, and I didn't feel like doing more than 16 bytes each.   :smiley-roll:

Plans I have for it:
Hardware -- make a new better audio board
Software -- a lot planned.  customizable software midi routing, envelopes on each voice, a built in sequencer, to name a few things.

joemarshall

256 byte wavetable is worth doing for speed - if you force the waves to be aligned to a 256 byte boundary, then taking an index into the wavetable can be done by just copying a byte into the low byte of the wavetable pointer, which saved me 3 instructions per sample per oscillator (which was quite a lot given each oscillator takes about 15 instructions total. 256 bytes also saves needing to do any maths on the wavetable lookup variable, you can just use the high byte as the lookup directly. It's all small improvements, but compared to the original wavetable code I played with off the internet, it is something like five times as efficient with all the optimisation.

The avr assembler is dead easy, especially if you use inline assembler in c code, I learnt a lot of it from reading the code of meeblip, which is a whole synth written in avr assembler, the rest I got from the atmel instruction set reference. It's well worth doing - my c code could only just scrape 8 voices with no filter, whereas in assembler the 8 voices take something like 10-20% of processor (not sure how much time the filter takes, but I still seem to have a fair bit of time for other stuff).

amacmullen14

Thanks for pointing out the meeblip site!  I looked a bit at the avrsynth code it's based on, and did some research on assembly.  I'll definitely work on rewriting my ISR code, now that I have a bit of an idea how to do it.

Go Up