Tuesday, 9 August 2011

Generating Midi Signals

Using the Arduino to send various midi signals to the SV10XX board.

Chanel Setup:
Before sending the channel must be configured. I hage not tried without this code to see if there is a default.

Set Volume:
talkMIDI(0xB0, 0x07, 120);     //0xB0 is channel message, set channel volume to near max (127)

Set Midi Bank:
talkMIDI(0xB0, 0, 0x00);    //Default bank GM1

Set Instrument:
talkMIDI(0xC0, instrument, 0);     //Set instrument number. 0xC0 is a 1 data byte command

It seems that in each of the commands changing the integer after the Upper care letter selects different channels, up to a max a 16.

NoteOn()/NoteOff()
Once this is done the noteOn() or noteOff() methods can be used with the parameters:

 //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
 noteOn(0, note, 60);

It is worthwhile nothing that some instruments dont require a note off. Drums for instance only last a set duration however wind instruments or synth will play until the noteOff is sent. Multiple noteOn message can be sent at once.

It is possible to change the instrument by sending multiple "Set Instrument" instructions however trying to working out which not to turn off can be difficult. The instrument doesn't not need to be set for the note off, the note value must match up though.

For multiple instruments creating different channels and setting an instrument to each channel seemed to be a better solution.

Using the percussion instruments requires accessing a different midi bank

  talkMIDI(0xB0, 0, 0x78); //Bank select: drums
   talkMIDI(0xC0, 5, 0); //Set instrument number
   noteOn(0, 36, 60); //Play note on channel 1 (0x90), some note value (note), middle velocity (60):

1 comment:

  1. This is old and has been updated by SoftSerial Midi

    ReplyDelete