VS1053b / VS1103b MIDI Controls

Designing hardware that uses VLSI Solution's devices as slave codecs such as an external MP3 decoder chip for a host microcontroller.
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

VS1053b / VS1103b MIDI Controls

Post by pasi »

I have collected the implemented midi messages here. Some like tempo are used in file mode only.
  • meta: 0x51 : set tempo
  • other meta: MidiMeta() called (user code can send out lyrics and other meta information)
  • SysEx device control: 0x01 : master volume (only in file mode!)
  • channel message: 0x80 note off, 0x90 note on, 0xc0 program, 0xe0 pitch wheel
  • channel message 0xb0: parameter
    • 0x00: bank select (0 is default, 0x78 and 0x7f is drums, 0x79 melodic)
    • 0x06: RPN MSB: 0 = bend range, 2 = coarse tune
    • 0x07: channel volume
    • 0x0a: pan control
    • 0x0b: expression (changes volume)
    • 0x0c: effect control 1 (sets global reverb decay)
    • 0x26: RPN LSB: 0 = bend range
    • 0x40: hold1
    • 0x42: sustenuto
    • 0x5b effects level (channel reverb send level, channel-specific, default is 12)
    • 0x62,0x63,0x64,0x65: NRPN and RPN selects
    • 0x78: all sound off - immediately fade all notes on this channel
    • 0x79: reset all controllers on this channel
    • 0x7b, 0x7c, 0x7d: all notes off - put all notes to release (except ones with hold or sustenuto)
The channel-specific level and overall 'duration' of reverb can be adjusted, "expression" adjusts the volume of audible notes on that channel, and pitch-wheel adjusts the note frequencies.

All 16 channels and multiple notes per channel are available. The total simultaneous audible notes depends on the clock frequency and what instruments are used (different instruments take varying amounts of processing power).

Reverb
vs1053b: There are 15 different default Reverb settings in the low 4 bits of the parametric_x.config1 register (X:0x1e03). Values 2 to 15 select a default room size (internal 350 to 4900). 0 will enable the reverb depending on the value of CLOCKF (3.0x or higher clock enables reverb). 1 means reverb is disabled.
vs1103b: There are 15 different default Reverb settings in the low 4 bits of the parametric_x.midiConfig register (X:0x1a03). Values 2 to 15 select a default room size (internal 350 to 4900). 0 will enable the reverb depending on the value of CLOCKF (3.0x or higher clock enables reverb). 1 means reverb is disabled.

When you control Reverb through MIDI controls (Parameter / effect control 1), all control values from 0 to 127 are valid (internal 0..4064).

In vs1103b Reverb is mutually exclusive with EarSpeaker.

Real-Time MIDI
The UART buffer is a bit too short and it is possible to overflow it with constant UART transmit if too many notes are active at the same time. A fix is available in the RTMIDI Application: http://www.vlsi.fi/en/support/software/ ... tions.html .

Addendum
It seems the size of the UART FIFO is only an issue when sending the midi data through SDI. If my math below checks out, there should not be issue when you use the 31250bps RT-MIDI UART speed. Issues with the original 16-byte UART FIFO might arise due to MIDI messages that are longer than 15 bytes, specifically sysex and meta messages. These should be removed and not sent.

1. RT-MIDI can send 16 bytes in 16/3125=5.12ms
2. The MIDI decoder produces 64-sample blocks, so for full polyphony the sustained maximum time is 64/44100=1.45ms for 16 bytes of MIDI data. This time can be temporarily exceeded if a lot of notes come on at the same time and other notes need to be decayed/faded out. Even if it takes double time, there would still be plenty of time to get back to decoding MIDI messages. The higher the clock and the lower the polyphony, the shorter time is spent generating the instruments.

Instrument List for reference
Note that the instruments are enumerated from 1, while in the MIDI messages the instruments start from 0, so remember to do the conversion.
  1. Acoustic Grand Piano
  2. Bright Acoustic Piano
  3. Electric Grand Piano
  4. Honky-tonk Piano
  5. Electric Piano 1
  6. Electric Piano 2
  7. Harpsichord
  8. Clavi
  9. Celesta
  10. Glockenspiel
  11. Music Box
  12. Vibraphone
  13. Marimba
  14. Xylophone
  15. Tubular Bells
  16. Dulcimer
  17. Drawbar Organ
  18. Percussive Organ
  19. Rock Organ
  20. Church Organ
  21. Reed Organ
  22. Accordion
  23. Harmonica
  24. Tango Accordion
  25. Acoustic Guitar(nylon)
  26. Acoustic Guitar(steel)
  27. Electric Guitar(jazz)
  28. Electric Guitar(clean)
  29. Electric Guitar(muted)
  30. Overdriven Guitar
  31. Distortion Guitar
  32. Guitar Harmonics
  33. Acoustic Bass
  34. Electric Bass(finger)
  35. Electric Bass (pick)
  36. Fretless Bass
  37. Slap Bass 1
  38. Slap Bass 2
  39. Synth Bass 1
  40. Synth Bass 2
  41. Violin
  42. Viola
  43. Cello
  44. Contrabass
  45. Tremolo Strings
  46. Pizzicato Strings
  47. Orchestral Harp
  48. Timpani
  49. String Ensembles 1
  50. String Ensembles 2
  51. Synth Strings 1
  52. Synth Strings 2
  53. Choir Aahs
  54. Voice Oohs
  55. Synth Voice
  56. Orchestra Hit
  57. Trumpet
  58. Trombone
  59. Tuba
  60. Muted Trumpet
  61. French Horn
  62. Brass Section
  63. Synth Brass 1
  64. Synth Brass 2
  65. Soprano Sax
  66. Alto Sax
  67. Tenor Sax
  68. Baritone Sax
  69. Oboe
  70. English Horn
  71. Bassoon
  72. Clarinet
  73. Piccolo
  74. Flute
  75. Recorder
  76. Pan Flute
  77. Blown Bottle
  78. Shakuhachi
  79. Whistle
  80. Ocarina
  81. Square Lead (Lead 1)
  82. Saw Lead (Lead)
  83. Calliope Lead(Lead 3)
  84. Chiff Lead (Lead 4)
  85. Charang Lead (Lead 5)
  86. Voice Lead (Lead 6)
  87. Fifths Lead (Lead 7)
  88. Bass + Lead (Lead 8)
  89. New Age (Pad 1)
  90. Warm Pad (Pad 2)
  91. Polysynth (Pad 3)
  92. Choir (Pad 4)
  93. Bowed (Pad 5)
  94. Metallic (Pad 6)
  95. Halo (Pad 7)
  96. Sweep (Pad 8)
  97. Rain (FX 1)
  98. Sound Track (FX 2)
  99. Crystal (FX 3)
  100. Atmosphere (FX 4)
  101. Brightness (FX 5)
  102. Goblins (FX 6)
  103. Echoes (FX 7)
  104. Sci-fi (FX 8)
  105. Sitar
  106. Banjo
  107. Shamisen
  108. Koto
  109. Kalimba
  110. Bag Pipe
  111. Fiddle
  112. Shanai
  113. Tinkle Bell
  114. Agogo
  115. Steel Drum
  116. Woodblock
  117. Taiko Drum
  118. Melodic Tom
  119. Synth Drum
  120. Reverse Cymbal
  121. Guitar Fret Noise
  122. Breath Noise
  123. Seashore
  124. Bird Tweet
  125. Telephone Ring
  126. Helicopter
  127. Applause
  128. Gunshot
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
microtherion
User
Posts: 1
Joined: Thu 2012-01-26 5:09

Re: VS1053b / VS1103b MIDI Controls

Post by microtherion »

What's the difference in sound between bank 0 and bank 0x79? I went through all the instruments, playing a minor chord, and at best, the two banks sounded identical. For some instruments, bank 0x79 played only one of the three notes in the chord.

Are there parameter settings in which bank 0x79 sounds better than bank 0?
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: VS1053b / VS1103b MIDI Controls

Post by pasi »

microtherion wrote:For some instruments, bank 0x79 played only one of the three notes in the chord.
All melodic banks should behave the same. The chord problem may be something related to note dropping (when notes are quiet enough or there are too many, the quietest ones are removed) or some bug in the real-time code.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
gmccomb
User
Posts: 10
Joined: Wed 2012-04-04 2:16

Re: VS1053b / VS1103b MIDI Controls

Post by gmccomb »

For master volume I take it this is a SysEx command, and follows normal byte sequence for these. All of the other MIDI control statements appear to be working except this one. Do you have an example SysEx byte sequence for this?

In case it matters, I'm using a VS1053 and RT MIDI via UART. For testing I'm using only one channel with just one or two notes, turning them on and off after one second delays.
fundorin
User
Posts: 1
Joined: Wed 2012-05-02 16:10

Re: VS1053b / VS1103b MIDI Controls

Post by fundorin »

Am I right that there's no datasheet or list of possible midi commands for VS1103и except this forum message?
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: VS1053b / VS1103b MIDI Controls

Post by pasi »

gmccomb wrote:For master volume I take it this is a SysEx command, and follows normal byte sequence for these. All of the other MIDI control statements appear to be working except this one
I'm guessing that the following sequence would work in file-mode. However, the real-time parser is much simpler and it seems it ignores all sysex messages (skips everything until the 0xf7 marker).

0xf0 //sysex
0x06 //<varinum> bytes to read
0x00 //realtime/non-real-time
0x00 //device ID (ignored)
0x04 //ID1 4: device control
0x01 //ID2 1: master volume
0x00 //volume LSB ignored
vol //volume MSB used
0xF7 //sysex end mark

Do you have SCI connected? I could provide a workaround to directly write the master volume variable.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
gmccomb
User
Posts: 10
Joined: Wed 2012-04-04 2:16

Re: VS1053b / VS1103b MIDI Controls

Post by gmccomb »

SCI isn't connected and can't be. For this particular project (it's for an article in a popular magazine here in the US) we're using the SparkFun MIDI Instrument Shield, which only supports UART RT-MIDI.
kellli01
User
Posts: 1
Joined: Wed 2019-01-30 3:11

Re: VS1053b / VS1103b MIDI Controls

Post by kellli01 »

Hello:

I have a prototype running the VS1103B and I can get some MIDI files to play and not others.

What are the things to look for in a MIDI file that would prevent it from playing? Do you know of any prohibited events or commands?

I am careful to use format 0 General Midi files. I also run in file mode, not real time MIDI using the SCI bus. I run ADPCM on the SDI bus and it mixes successfully when the MIDI file works. I suspect this chip does not fully support the MIDI command set.

Here are some other findings:

1. If I take working MIDI file, load it into Anvil and just save it with no modifications, the file will cease to work. It looks like Anvil adds some metadata at the beginning so the hex file is a little different, but it should be legal. Such metadata is in other files that work.

2. I always do a search for multiple instances of the text "Trk". There can be only one if it is to have a chance of working. However, having just one instance does not guarantee a working file.

3. Most files don't work. However, I did get a really complicated file to work. At first, I thought maybe you could only have one instrument play or something like that.
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: VS1053b / VS1103b MIDI Controls

Post by pasi »

Hi,
Can you include a file that does not play, so we can check what the potential issue is?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
rom3
User
Posts: 3
Joined: Sun 2019-08-25 21:56

Re: VS1053b / VS1103b MIDI Controls

Post by rom3 »

Hi,
I'm programming a sequencer program and use a VS1053 in real time midi mode. All worked fine but I have a problem with the midi control. Panning and volume worked fine, but i can't control the reverb. Source can found here https://create.arduino.cc/projecthub/ro ... -ii-b5d169. Have any a idea what I'm making wrong. For any help, I'm thankful.
Post Reply