I'm working on a little project, basically a synth made of motors.
My entry is a MIDI keyboard connected to my cyclone IV and the output is 8 pwm channel connected to the motors in order to create a sound.
With the help of this forum I have been able to deal with the receiption of the MIDI signal, basically an UART.
Now I'm trying to figure out the best choice concerning the architecture of my MIDI manager, I came up with two solutions and I need some help to decide what is best.
The MIDI signals used are made of 3 bytes :
- 1st is NOTE ON (0x90) or OFF (0x80) + channel ( fixed to 0 in my case ), <=> key pressed or released
- 2nd is the NOTE NUMBER <=> wich key
- 3nd is the velocity <=> how hard you push the key (not used in my project)
1st solution :
Create 8 oscilators connected to my outputs. Each oscillator frequency could be set.
Then, when NOTE ON is received I have to check if there is an free oscillator and transmit the right frequency command accordingly to the NOTE NUMBER .
When NOTE OFF is received I have to check if there any of the oscillators activated for this frequency and disable it if found.
2nd solution :
Create an oscillator per frequency, about 48 in my case. Each oscillator could be activated or not.
NOTE ON received activate the corresponding oscillator, NOTE OFF received disable the corresponding oscillator.
In that case oscillators aren't connected directly to the outputs and there must be a system to link the activated oscillator(s) the output(s).
Any advice would be helpful !