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.
| 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 xxBn 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 xxBn 7C xxBn 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) |
| 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 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. |
- Arduino UNO (R3 or compatible)
- VS1053b Module (e.g. Waveshare Music Shield)
| 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) |
- CH340 (Arduino UNO) USB Driver
- Arduino IDE
- OmniSerial (eventually), Hairless MIDI<->Serial Bridge, or KAWAI GMegaRSNT Serial MIDI Driver (Windows 32-bit only)
- MIDI Yoke NG (for Windows users)
- A MIDI application (player, sequencer, utility, or game)
- Download the .ino sketch, saving it into a new folder
- Open the downloaded sketch file in Arduino IDE
- 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.