Skip to content

Turn your Arduino UNO with Music Shield into a fully working standalone USB/Serial General MIDI synth!

Notifications You must be signed in to change notification settings

DevanWolf/VS1053b-MIDI-Synth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

VS1053b Standalone Real-Time General MIDI Synth for Arduino

This minimal sketch for Arduino UNO (and some other supported boards) turns just your Arduino with Music Shield into a fully working standalone USB/Serial General MIDI synth without the need of additional libraries or parts.

USB/Serial/UART MIDI data are filtered and adapted to SDI for speed and reliability.

MIDI commands natively supported by VS1053b (XDCS)

Command Name Parameters|n = Channel #
8n kk xx Note Off kk = Note #
xx = Don't care
9n kk vv Note On kk = Note #
vv = Velocity (0 = note off)
Bn 00 vv Channel Mode (Bank Select) 0 = Default, 121 = Melodic, 120/127 = Drum
Bn 06 vv RPN Data Entry vv = Value
Bn 07 vv Channel Volume vv = Value (100 = Default)
Bn 0A vv Channel Panpot vv = Value (64 = Default)
Bn 0B vv Expression vv = Value
Bx 0C vv Global Reverb Decay x = Don't care
vv = Value
Bn 40 vx Sustain v<4 = Off, v>=4 = On
x = Don't care
Bn 42 vx Sostenuto v<4 = Off, v>=4 = On
x = Don't care
Bn 5B vv Channel Reverb Level vv = value (40 = Default)
Bn 62 xx
Bn 63 xx
Deselect RPN xx = Don't care
Bn 63 vv RPN LSB 0 = Pitch Bend Range, 2 = Transpose/Coarse Tune, 1/3-127 = None
Bn 64 vv RPN MSB 0 = On, 1-127 = Off
Bn 78 xx All Sound Off xx = Don't care
Bn 79 xx Reset All Controllers xx = Don't care
Bn 7B xx
Bn 7C xx
Bn 7D xx
All Notes Off xx = Don't care
Cn vv Program Change vv = General MIDI Instrument # for melodic, else don't care for drum
En ll mm Pitch Bend ll = Value LSB
mm = Value MSB (8192 = center)

Additional MIDI commands and SysEx implemented and wrapped (to XCS)

Command/SysEx Name Parameter(s)
FF System Reset
F0 7E 7F 09 01 F7 GM Reset
F0 7F 7F 04 01 xx vv F7 Master Volume vv = Value
xx = Don't care
F0 7F 7F 04 02 +x vv F7 Master Panning vv = Value
+>=4 = +1 to Value
x = Don't care
F0 00 01 11 01 0v F7 EarSpeaker Setting 0 = Off, 1 = Low, 2 = Mid, 3 = High
F0 00 01 11 02 bl th F7 Bass & Treble Setting b = Bass Enhancement in 1 dB steps
l = Bass lower limit frequency in 1000Hz steps
t = Treble Control in 1.5 dB steps
h = Treble lower limit frequency in 10Hz steps
F0 00 01 11 03 0v F7 Reverb Setting 0 = Default, 1 = Off, 2-15 = Overridden Decay Level

Button Panel Controls for Waveshare Music Shield

Button Name Symbol Arduino & Shield Pin Description|Activity LED Pin: 8
Reverb ⏯️ 5 Press to toggle. Dim and bright LED blinks for off and on respectively. On by default.
Reset ⏮️ 6 Press once to reset the synth to it's initial GM parameters. Faster than Arduino's built-in Reset button.
Volume+ 🔊 3 Hold to increase. The brighter the LED, the higher the volume.
Volume- 🔉 7 Hold to decrease. The dimmer the LED, the lower the volume.

Hardware Requirements

  • Arduino UNO (R3 or compatible)
  • VS1053b Module (e.g. Waveshare Music Shield)

Typical Wiring (Arduino UNO)

VS1053b/Shield Pin Arduino Pin Description
MISO 12 SPI Master In, Slave Out
MOSI 11 SPI Master Out, Slave In
SCK 13 SPI Serial Clock
XRST A0 Reset (active low)
XCS A3 Command Chip Select (active low)
XDCS A2 Data Chip Select (active low)

Software Requirements

How to flash (install) the program onto your Arduino

  1. Download the .ino sketch, saving it into a new folder
  2. Open the downloaded sketch file in Arduino IDE
  3. Make sure your Arduino board is connected to your computer, select the correct board type (UNO in that case), and Upload!

NOTE: Make sure your Serial MIDI driver or bridge is not active, otherwise the program will fail to upload due to serial confliction. Then you can turn on your Serial MIDI driver/bridge afterwards.
In case you have a different Music Shield that doesn't have control buttons nor an LED, you can remove one or all of the 5 #define lines for the button definitions and LED to tell the compiler not to use those features.
Baud rates 31250, 38400, 9600, and 57600 can be used instead of the default 115200 for use with the standard MIDI protocol or different serial MIDI software/drivers.

Links

About

Turn your Arduino UNO with Music Shield into a fully working standalone USB/Serial General MIDI synth!

Topics

Resources

Stars

Watchers

Forks