Home Forums Sparkfun MP3 Shield Library Support Forum Introduce sounds or alter the sounds of bank GM1,GM2 in vs1053 MP3 Player Shield

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #2661





    /* Style Definitions */
    {mso-style-name:”Tabla normal”;
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;

    Hello Arduino and SparkFun developers, I’m working in a project and please need some help (vs1053 connected to Arduino shield).
    I right now reproduce MIDI files  in real time mode, but what I really want to do is alter the sounds bank GM1 or GM2 of SparkFun Shield, to put my own sounds, for example when I call the sound 33 Acustic Bass instead of reproduce the predefined sound, reproduce my Acustic Bass version , It’s possible? Or maybe I don’t need to modify the sounds bank GM1 and there is other memory space in the shield destined to put the user’s files? I’ve been working with Arduino Shield and allows me to play any sound I want, but only allows me to play a sound at a time, is not polyphonic, on the other hand the SparkFun Shield is polyphonic, but I haven’t my own sounds. Thanks in advance,


    The Vdsp can take either Real Time MIDI or MID file. The SFEMP3Shield driver does not support RealTime. There is another library that I have used that will do RealTime. I forget its name and have not integrated into this. Where I have played MID files. I recall that the Vdsp can only take one of the flavors of MID files. I needed to convert it. I forget that to, it was 18 months ago.

    I am not a music person, so I have no MIDI experience, to know what needs to be done.

    What is the Arduino Shield that you state is not polyphonic?

    I would review VLSI’s forum to find out what you want to do. It may take some digging, but I suspect it has been asked and answered there. And if not they typically reply with helpful response after a few days. Just need to go back and occasionally check. Once you determine what is needed, then we can possibly help add that to this library.


    Hello Michael, thanks for the quick answer, I really appreciate it.  I’ve wrote to the  VLSI’s forum  just like you recommend, I did about 3 weeks ago, but I still have no answer.
    Sorry if I not explain myself, when I mentioned that Arduino Shield is not polyphonic, I was really refering to WaveHC library, you can not reproduce 2 files at same time, can I do that with the SFEMP3Shield library???
    By the way, What do you mean with VDSP ???


    I refer to the Vdsp as the VLSI processor inside the VS1053. There are actually many different flavors of chips with the same DSP core. Which all use the same code base but just different pins and resources.

    Yes, the ADA fruit Wave card is not polyphonic as it does not have the DSP power to mix different streams together, it is just the simple ATmega of the Arduino. Where the VS1053 is a coprocessor, with its own DSP just for audio processing, giving it much more abilities. I read in the VS1053’s data sheet section 8.2.9 that

    The maximum polyphony is 64, the maximum sustained polyphony is 40.
    Actual polyphony depends on the internal clock rate

    That said polyphony is about the simultaneous playing of different notes. Where the VS1053 interfaces to the Vdsp is the single SPI interface. This limits it ability to single stream of data. Which this stream typically comes from, but not limited to, the SdCard. Or in other words it can only support one stream at a time.


    But the VS1053 also has a Command path to the VDSP outside of the Data Stream path. There are two chip selects. XCS (command) and XDCS (data) for the single SPI. As a result there is a way to play PCM (and only PCM) encoded data through the command channel while playing another format through the data channel. Whereas this is not playing two simultaneous MIDI files at the same time. Rather it is possible to play a MID(or MP3, etc…) and PCM at the same time, where the Vdsp will mix these together before the analog output.

    And we have not supported this feature in this library. That would require a significant redesign.

    Since the VS1053 does not support two simultaneous streams of MIDI encoded files, but the Vdsp will support up to 64 simultaneous notes, it should be possible to read both MID files and send their notes mixed into the single RealTime Midi commands, at their appropriate times. This would require the Arduino to understand the MID file and send the corresponding MIDI command at the corresponding time as noted in the file and move on to the next MIDI command in both files. A lot of work. But I suspect possible.


    That all said looking at the WaveHC, I see that it only supports WAV and not MIDI…


    Reading this post answered my big question, much to my dismay. I am creating a touch based beatbox type device. I am aware that I can’t play multiple mp3’s simultaneously, but there is the pcm plugin which allows playback while other audio is happening. I was hoping to have one of my touch inputs initiate a “beat track” and then be able to play other sounds on top of it. Each one interrupting the previous sound but not the beat track.

    I have nowhere near the programming knowledge to redesign your library so I guess that is a feature that won’t make it into the final design of my project. Thank you though for your great work an active support.


    Yes, there is such a plug in. And this library will allow it to be uploaded to the Vdsp. However, the library does not support sending the PCM data on the command channel. That will take quite a bit of work, and as yet has not been implemented.

    A quick work a round that I am using, is to have a MIDI file of some beeps. And when a key pad button is pressed, I pause the current file, send the MIDI file and then return to playing the current file. Noting that MIDI files of a single note are short enough to fit in a CONST ARRAY in code. Making it it simple not to have to open a 2nd file and deal with its memory requirements and pointers.


    Michael, I would love to see how you executed your quick work around you describe above.

    I currently do not have MIDI implemented in my MP3PlayerShield project. I am playing mp3’s from the SD Card and wish to interrupt the file with some quick beeps without loosing current file position for music playback, exactly as you describe above. Could you describe a quick walk through of how to implement it? Do you have a sample of it on GitHub?


    After you pause the current file (an .mp3 in my case), are you sending the MIDI file over SPI? How can this be done without needing to power cycle the board to start up in MIDI mode? Or are you sending the “note” data over the XCS (command) channel somehow? I’m not sure what a MIDI note looks like in const array form.


    I have unfortunately the past few months been swamped with my day job. I never quite finished the above. Curiously I am not a musician and don’t know much about Midi and such. I got stopped on getting the MIDI file. Note that the VS1053 will read in the stream and auto decode it. So while decoding a MP3 or wav stream from file, One can simply stop the current file position and then optionally flush the current VS1053 buffer as to stop immediately. And then send it any other stream. My idea is that MIDI files of a single note for the bell instrument will be short. and go into the VS1053 buffer. It a single not would be short enough that it can be stored as an array in flash with only few dozen bytes. This relieves the need of opening another SdFile or changing the file pointer, etc….

    So just need a MIDI type 0(zero) file of a single key board beep or alike. Use the Pause command with the flush Pre or Post (which ever is quicker) send the MIDI array and then resume the file. The VS1053 buffer will simply queue up the stream and play what it decodes.


    just to let you know I have updated my github fork with the above mentioned code “SendSingleMIDInote()”. The examples now have a ‘b’ command that will send the beep and if a stream is playing it will pause that beep and inject the beep and then resume the stream.

    P.S. I beta release versions on my personal fork of https://github.com/mpflaga/Sparkfun-MP3-Player-Shield-Arduino-Library and after a period of due diligence I push to Bill’s original repo.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.