MIDI to LED
Fenta7
Posts: 8
Can someone·help me with a midi project I am working on? I would like to take the note on and the velocity bytes and send a on time to and output pin. For example if·D# has a velocity of 64 the output of one of the pins on the propeller board will have 250 milliseconds or if it had a velocity of 127 the on time would be 500 millisectonds.
I would like to have at least 16 different velocities·that would have 16 different pulse times per note. I would also like to do this for at least eight notes D# to A#.
Basically each note would send a pulse to an output pin. the length of the pulse is determined by the note's "velocity".
It can be look at like Midi in to an LED and base on the velocity of the MIDI the LED would stay a short time of if the velocity was at 127 it would be on longer.
Thank you very much
Brad
313-663-2321
I would like to have at least 16 different velocities·that would have 16 different pulse times per note. I would also like to do this for at least eight notes D# to A#.
Basically each note would send a pulse to an output pin. the length of the pulse is determined by the note's "velocity".
It can be look at like Midi in to an LED and base on the velocity of the MIDI the LED would stay a short time of if the velocity was at 127 it would be on longer.
Thank you very much
Brad
313-663-2321
Comments
Thank you
There are two MIDI In objects in the OBEX:
·http://obex.parallax.com/objects/229/
·http://obex.parallax.com/objects/323/
Also a Google search : "MIDI In propeller" brings up a lot of potential sites, (and a few in the Parallax forums).
The search in the forum software, (upper right), does bring up a few if you limit it to Propeller for the last year. Some circuit diagrams, also.
Jim
Because we do not know, what you have already and what you know about Spin and the Propeller, I made a little
Example code to show you how I would make it. This code is not tested, but compiles.
The code expects contiguous output pins.
The MIDI input is at Pin31 you may have to change this. Do you have already a MIDI in hardware?
Andy
Post Edited (Ariba) : 7/19/2010 1:15:43 AM GMT
I will work with this. This is great. I really appreciate it.
Where do I set the on time for the velocities?
For example 1-8 would be 10ms, 9-16 woudl be 20ms, 17-24 would be 30ms 25-32would be 40ms, 33-40would be 50ms,
41-48 would be 60ms, 49-64 woudl be 70ms, 65-72 would be 80ms, 73-80 would be 90ms, 81-88would be 100ms,
89-94 would be 110ms, 95-102 woudl be 120ms, 103-110 would be 130ms, 111-118 would be 140ms,
119-127 mswould be 150ms on one to the propellers output pins to the LED.
Can I make each note have its own llist on velocity output times
For example C would have 1-8 would be 10ms, but C# would havebe have 1-8 would be 15ms.
Thank you
Brad
Does each note have 16 different output times on each pin
Brad
The puls times have 127 different values, one for each possible velocity value.
The time is now: velocity_value * 4ms, but you can change the 4ms in the waitcnt line (last line). Now it is 1s / 250 = 4ms.
If you really need only 16 steps this would be easy, as long at it's linear you don't need a table.
I have edited the code again, the line:
puls[noparse][[/noparse]note] := vel 'write to puls array
was not indented correctly
As for different puls scales for different notes and non linear tables, these is all possible, but I think first must the simple version work.
Andy
Thank you. I will start working on this week.
Brad
This works great. I can't thank you enough.
Brad
Brad
Try to replace the Main methode with this code:
Andy
Thank you very much. I will try it this weekend.
Brad