Expressive Arduino Midi Sequencer

Posted on Feb 6, 2014

This section of code outlines the main sequence of operation for the sequencer. First, a for loop is utilized to govern which step the sequencer is operating in. Within this loop, first an address is made using the assignByteToPins() function, this sends a 4 bit binary address to ensure that the input of each analog multiplexer corresponds to the

Expressive Arduino Midi Sequencer
Click here to download the full size of the above Circuit.

value of k (the indexing variable of the for loop). Next, an array called "note[]` is assigned a value at position k based on the analog voltage present on pin A0, this is done in a similar fashion for the velocity[] array. Once a value is stored in each array, it is then sent to the computer through USB using the usbMIDI class and the sendNoteOn(note, velocity, channel) function. Note length and tempo are then determined using either the delay() function or the lengthWait() function to stall the operation of the program for a period of milliseconds. During operation of the sequencer, it is imperative that the desired note is played at any given time. This is accomplished by making certain that each potentiometer (the input device used to vary a note) is read at the precise time that particular note is to be played. A device known as a multiplexer is used to do this (more information on the multiplexers can be seen in the hardware section). The inputs are synced to the flow of the program by sending a 4 bit binary address to the multiplexers using the assignByteToPins function. This function takes an integer and based on its value (as long as it is between 0 and 15) will assign the corresponding binary value to the state of digital I/O pins 4 through 7. This is done by a simple if, if else ladder. While this can be accomplished more elegantly through the use of a for loop and some modulus division, it was found that writing...

Leave Comment

characters left:

Related Circuits

  • New Circuits



    Popular Circuits

    Metal detector circuit with TDA2822
    Drive A Relay Using A 1-Wire Addressable Switch
    simple circuit mini bicycle bel
    Splicing a Minolta/Sony flash cable
    Programmable signal converter provides sensor interface
    Step-Down Converter Controller
    robot circuits
    USB Bootloader
    Cat toys electronic circuit