Changing Banks on VS1053

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
Posts: 2
Joined: Fri 2019-04-12 9:05

Changing Banks on VS1053

Post by drmoth »

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
AFAIK there's only really two banks, the melodic one and the drums. Is that correct? Why have 4 #defines in that case?

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->setInstrument(1, 31);
            midi->noteOn(1, 74, 120);
where those functions are defined:

Code: Select all

void Midi::setChannelBank(uint8_t chan, uint8_t bank)
  VS1053_MIDI.write(0xB0 | 1);

void Midi::setInstrument(uint8_t chan, uint8_t inst)
  VS1053_MIDI.write(0xC0 | chan);

void Midi::noteOn(uint8_t chan, uint8_t n, uint8_t vel)
  VS1053_MIDI.write(0x90 | chan);
User avatar
VLSI Staff
Posts: 1800
Joined: Thu 2010-07-15 16:04

Re: Changing Banks on VS1053

Post by pasi »

You only need banks 0x78 and 0x79.

The standard banks are 0x79 and 0x78, but some MIDI songs seem to use bank number 0x7f for drums. The default bank depends on the channel number. Channel 10 defaults to percussion/drum bank, the other channels default to melodic.

So, if you send Bank Select (HI) with:
- 0 gives you the default bank depending on the channel. (0x78 for Channel 10, 0x79 for other channels.)
- 0x7f is mapped to 0x78.
- 0x78 and 0x79 give drum or melodic, respectively.
- other values are ignored.

Any channel can be melodic or drum bank. A lot of MIDI songs use two drum channels.

Changing the bank of a channel does not affect notes that are already playing on the channel, so if you switch between melodic and drum bank, a single channel can have both playing at the same time.
Visit VLSI Solution on Facebook
Post Reply