I build these music sequencers.
Only it's not exactly a sequencer, it's a physical interface for a sequencer. The sequencer is an application that runs on a laptop that the sequencer connects to, this thing lets the user make drum loops on the fly. It's pretty fun, but it requires a laptop because the sequencer isn't 'on-board'.
What I would love is to do the sequencing on-board my device.
Now let's assume I know how to solve for class compliance for USB MIDI connectivity, and let's also assume I can figure out how to wire up an arduino to send MIDI notes from a 5 pin DIN port. What I'm most concerned about is tempo drift over time due to inconsistent timing in minute amounts over every run of the event loop.
Some things I know:
You should not rely on
delay()to control the tempo loop. Delay stops all operation of the firmware, and that can't work because i need to poll the physical user interface for changes while the sequence is running.
Calculations based on
millis()are better because the firmware can continue to operate and act when a certain count has elapsed.
Even though none of my physical controls are triggering interrupt routines, some operations can delay the main
loop()from running. If I design a function that waits for user input, that can obviously cause a problem of missing a "deadline" to act if the
millis()count is way over. I know this problem is of my own design...
A. Is the AVR-based arduino an appropriate microcontroller to poll a user interface and run a mission critical timing loop? I know there's an ARM based Arduino now that's a lot faster. Would a Teensy 3.0 be a better alternative? Both of these are 3.3V boards, so that's another set of issues to work with... but I'll ignore that for now.
B. Should I split the task into two microprocessors? One to handle polling and updating the user interface and one for mission critical timing loop.
c. Something else?
My main goal is to not have to use a computer at all. I also want to calculate for swing, but in this case, swing don't mean a thing if I ain't got a locked and timing accurate tempo. Thanks for your advice!