I'm successfully using my VS1053 in real-time midi mode, however I'm finding the Bank changing to be confusing.
These are the defined banks:
Code: Select all
#define VS1053_BANK_DEFAULT 0x00
#define VS1053_BANK_DRUMS1 0x78
#define VS1053_BANK_DRUMS2 0x7F
#define VS1053_BANK_MELODY 0x79
The other more important question is how to swap to the Drum bank. Can I use a per-channel Drum kit, or can I only have one mapped to a single channel...or something else?
At the moment I've been sending bank ctrl messages like this.
However I'm getting weird behaviour, sometimes it works and sometimes it doesn't. Is the Drum Bank a global setting?
Code: Select all
midi->setChannelBank(0, VS1053_BANK_DRUMS1);
midi->setInstrument(0, 30);
midi->noteOn(0, 73, 120);
midi->setChannelBank(1,VS1053_BANK_DRUMS1);
midi->setInstrument(1, 31);
midi->noteOn(1, 74, 120);
Code: Select all
void Midi::setChannelBank(uint8_t chan, uint8_t bank)
{
VS1053_MIDI.write(0xB0 | 1);
VS1053_MIDI.write(0x00);
VS1053_MIDI.write(bank);
}
void Midi::setInstrument(uint8_t chan, uint8_t inst)
{
VS1053_MIDI.write(0xC0 | chan);
VS1053_MIDI.write(inst);
}
void Midi::noteOn(uint8_t chan, uint8_t n, uint8_t vel)
{
VS1053_MIDI.write(0x90 | chan);
VS1053_MIDI.write(n);
VS1053_MIDI.write(vel);
}