Arduino VS1053 General MIDI Synth

A while back I had a bit of a play with some VS1003 and VS1053 modules as MIDI modules, but I never really fully explained how to use them as a General MIDI sound module.  This thought was prompted by Sheila (midi_in_out on Twitter) who posted one of her own compositions for use with her MIDI SID project and provided a MIDI file to try.

This got me wondering what it would sound like on the VS1053 as she had provided the track as a General MIDI compliant MIDI file, so I thought I’d revisit my previous code and detail how to get the VS1053 working as a General MIDI sound module.

  • Part 2 prototypes a “program changer” for the VS1053.
  • Part 3 builds the “program changer” onto a protoshield.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

  • Arduino Uno.
  • VS1053 shield for an Arduino Uno.
  • MIDI shield for an Arduino Uno.
  • Amplification and means to play a MIDI file,

The Circuit

2020-07-28 11.45.36

The VS1053 shield is plugged into the Uno and the MIDI shield is plugged into the VS1053.  This gives a relatively cheap, off-the-shelf general MIDI module based on an Arduino Uno.  No hardware modifications are required, everything else is done in software.

The Code

This uses the code from Arduino MIDI VS1003 or VS1053 Synth so I won’t go into detail about how it works again here.

The key difference here is that we are not pre-configuring any of the MIDI channels with a specific voice but letting the MIDI file player (in this case I’m using MIDIEditor.org) send the appropriate program change messages over MIDI to configure the required voices per MIDI channel.

The key configuration changes in the code are as follows.  Every entry in the “preset_instruments[]” array should be set to zero, meaning “no instrument configured”.

byte preset_instruments[16] = {
/* 01 */ 0,
/* 02 */ 0,
/* 03 */ 0,
/* 04 */ 0,
/* 05 */ 0,
/* 06 */ 0,
/* 07 */ 0,
/* 08 */ 0,
/* 09 */ 0,
/* 10 */ 0, // Channel 10 will be ignored later as that is percussion anyway.
/* 11 */ 0,
/* 12 */ 0,
/* 13 */ 0,
/* 14 */ 0,
/* 15 */ 0,
/* 16 */ 0
};

And the code should be configured to listen on all MIDI channels as follows:

uint16_t MIDI_CHANNEL_FILTER = 0b1111111111111111;

Now the code will be listening on all channels and passing any received MIDI message, including program changes, straight over to the VS1053.

Find the original code on GitHub here.

Closing Thoughts

I was prompted to try this in response to Sheila posting a MIDI file of her composition “The Crow’s Nest” that she was using with her MIDISID project, and I was intrigued to see what it would sound like on the VS1053.  I have to admit I think I prefer the MIDISID version!  If nothing else, the use of an arpegiator rather than chords gives the original a certain chiptune, 80s charm!  Also, the VS1053 really doesn’t seem to be able to replay some of the sound effects that the MIDISID can offer – in this case the wave sounds.  I might look into that a little further one day.

Still, it was an interesting experiment, and it was great to have the prompt to look again at the VS1053.  This prompt has meant that I’ve now played a few other MIDI files through the VS1053 and I think it holds its own pretty well, at least compared to any kind of built-in General MIDI code on a PC.

It doesn’t compare to a soundfont synth, such as we might find on a Zynthian or MT-32 Pi, but for a cheap add-on board to an 8-bit microcontroller, I think the VS1053 is doing pretty well.

Kevin

Leave a comment