I'm totally new to DSPs in general and VSDSP in particular, and am hoping to determine the feasibility of a design for a VS1103 application involving real-time MIDI synchronized with the playback of small wave clips streamed from an attached external memory.
My goal is that software running on the system's main microcontroller can first upload small PCM/ADPCM clips into an SPI RAM that is also connected to the VS1103 chip during startup, and then afterwards would ideally use the RT-MIDI interface (over UART) both to play normal MIDI notes using the built-in functionality and interleave commands to trigger synchronized playback of the PCM/ADPCM audio clips from the RAM to produce music with effects that cannot be generated using MIDI alone.
From studying the VS1103 datasheet, the VS-DSP4 user's manual, and some discussions elsewhere in this forum I have learned the following which suggest to me that what I'm looking to do is plausible:
- The VS1103 natively supports playback of both MIDI and PCM/ADPCM data at the same time, although typically as two separate input channels controlled separately by the host controller, rather than using MIDI messages to trigger Wave playback.
- The VS1103 module illustrates connecting an SPI Flash to the four GPIO pins and, with the spimodule firmware, playing back wave content streamed from that SPI Flash. I'm assuming that I could connect an SPI SRAM instead and achieve a similar result with some custom firmware.
- In some commentary about the supported MIDI commands I see a passing mention of the MIDI decoder reacting to most MIDI meta messages by calling something called "MidiMeta()". I see this both in the VS1053 datasheet and in a forum post with similar content, though I've not found details on exactly what "MidiMeta" refers to here.
I'm primarily curious to hear about whether this application seems plausible to implement with a VS1103 at all. I understand that VS1103 has a relatively small instruction RAM but am hoping to have relatively little system-control-oriented code in the instruction RAM and use built-in features in the instruction ROM for the "real work". I'd be willing to consider a more general/complex VSDSP chip like VS1053 too, but I've focused on VS1103 so far because I have no need for MP3/Vorbis decoding.
If this does seem like a realistic goal, I'd also love to learn more about this "MidiMeta()" call. I've not found any further mention of it in any other documentation, so I feel unsure as to what kind of thing "MidiMeta" is: since specific function names would be erased during compilation I assume this is referring to something more significant than a firmware function. In the datasheets I do see the ideas of "system vector functions" which are for user application code to call, and "system vector tags" which are for user application code to react to various events. Is "MidiMeta" a "system vector tag" that just isn't included in the documentation, or something else? Is there some further documentation about it somewhere that I've not found yet?
Some "nice to have" (but not required) features would be:
- The meta message can optionally specify a pitch shift to apply during wave playback, so that these clips can potentially be used as custom instruments to augment those provided in the MIDI synth. My main need is percussion-like sound effects and vocal recordings rather than tuned instruments, but being able to use clips also as basic "tuned" instruments would allow for some nice additional flexibility for composers (in similar vein to a "soundtracker" module, albeit with only one wave channel). Is this something achievable as a DSP filter placed after the PCM/ADPCM in the audio datapath?
- I have no hard requirement for the application code running in the main MCU to be able to modify the content SRAM while playback is ongoing, so am intending to just connect the SPI SRAM to both the VS1103 GPIO pins and a main MCU SPI peripheral at the same time and, in the worst case, keep the VS1103 held in reset until the main MCU has finished writing to the SRAM. However, if possible I would like the main MCU code to be able to request to be given back control of the SRAM to write new audio content, which I imagine as being another MIDI meta message to immediately halt PCM/ADPCM playback and switch the VS1103 GPIOs all into digital input mode (HiZ) so that the main MCU can temporarily use the SRAM without totally resetting the VS1103, and then later command the custom VS1103 plugin to retake control of that bus and enable wave playback again.