Sunday, May 4, 2008

MIDI Lab - Extra Credit




Having already tinkered on my own with MIDI in the past - and utilized it in my final project's first iteration - I understood the logic behind the schematics and the code in this lab far quicker than in my previous labs. Above all, I can immediately jump to conclude several applications for this circuit. For my 4 Channel DJ + Sax rig, for example, I can send notein messages into MAX to toggle on/off states for the muting of each channel, in lieu of the laptop key commands I had used prior.

Most everything worked as indicated, save a couple hiccups on the way. One was making sure my correct Arduino serial port and board were selected (they'd been changed in the application from when I borrowed someone's Diecimila). Another was that I connected my MIDI-to-USB cable to the MIDI port of the Arduino with its MIDI In plug rather than Out. I lapsed thinking "going IN to the computer", but with MIDI you have to align like directions, so it's OUT going to OUT, then the USB side goes IN to the computer.


I knew ahead of time to configure a new setup in my Audio/MIDI Setup control panel so it would listen for my new device, and I also knew that I needed a MIDI-triggerable sound source, so I opened Garage Band - which automatically opens to a MIDI piano track. The first program played an ascending chromatic scale at 2/10 of a second per note (1/10 for note on, 1/10 for note off) across 2 octaves, then repeated the sequence indefinitely. I recorded the results in Garage Band with a notation view and also filmed this result:



When I moved to the second program, I first tried to use an FSR, but I only very faintly heard a sound upon pressuring the sensor and then toggle switching on, and it was a pretty low one. Perhaps if I scaled the lowest analog state to a higher pitch value I might have corrected this, but I knew the given code would work with a potentiometer since it had a direct scaling function of the pot's natural 0 to 1023 range, so I switched to that and the results were instantly clean. Most notes were within reach of a treble clef staff.


For a real music application, I imagine the separate variable resitor-pitch vs. toggle switch-note on/off scenario would get quite cumbersome. To make a more keyboard-like setup, I assume one would use pushbutton type switches, each "tuned" in the code to a different pitch in a 12 half-step octave range or something like that. To send variable velocity messages with one keystroke, the pushbutton switches would have to somehow mechanically apply pressure to some FSRs located beneath them, then those values could be scaled to an appropriate MIDI velocity range. But I'm not one to advocate reinventing the wheel, I think it's better to send messages that trigger something not so 1-to-1 as far as pitch goes, like my channel muting idea where each channel reads from a playback audio buffer. I may try 4 switches to this end.




No comments: