I have a “Tsunami Wav Trigger” working with a modified example Arduino “MIDI note player” sketch, this has been modified so the MIDI Bank Number is changed by using the MIDI Program Change message.
The “Tsunami User Guide – robertsonics” says that the board responds to Controller messages for real-time control of attack and release times. Using CC#73: Attack Time (0 – 2000ms) and CC#72: Release Time (0 – 2000ms).
I wish to implement attack and release to all the noteOn and noteOff commands so the volume of note will ramp up or down over a specified time.
Can you please help me with my code? I attach a copy below.
#include
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
}
int CurrentMidiBank = 1;
int CurrentMidiChannel= 0;
void loop() {
// Play notes in banks 0, 1, 2 and 3
// (all on channel 0)
//
for( int bank= 0; bank < 4; bank ++ )
{
CurrentMidiBank= bank;
midiBank( CurrentMidiChannel, CurrentMidiBank );
// play notes from G-3 (0x43) to G-4 (0x4F):
// for (int note = 0x1E; note < 0x5A; note ++)
for (int note = 0x43; note < 0x4F; note ++)
{
noteOn( CurrentMidiChannel, note, 0x45);
delay(500);
noteOff( CurrentMidiChannel, note, 0x00);
delay(500);
}
delay( 1500 );
}
}
// plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that
// data values are less than 127:
// plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that
// data values are less than 127:
// Send a MIDI note-off message.
void noteOff(byte channel, byte note, byte volume)
{
midiMsg( (0x80 | channel), note, volume );
}
// Send a general MIDI message
//
void midiMsg(byte cmd, byte data1, byte data2 )
{
Serial.write(cmd);
Serial.write(data1);
Serial.write(data2);
}