Music Maker delay

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dhemberg
 
Posts: 26
Joined: Sat Apr 23, 2016 4:34 pm

Music Maker delay

Post by dhemberg »

Hi;

When using the Music Maker shield (https://www.adafruit.com/products/1788), I notice that there's a significant (~5 seconds or so) delay between the time I issue a command to play music (either playFullFile() or startPlayingFile()) and when I actually hear audio. This is using the playerSimple example code you provide, and an Arduino Uno.

Is this expected behavior? Is there a way to begin hearing audio immediately?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Music Maker delay

Post by adafruit_support_mike »

That usually means you're using files with a high bit rate or large sample resolution. The VS1053 needs to buffer the input before it starts playing, and large files require more transfer time.

The major limit on playback is the speed of the SPI bus. The microcontroller has to read every byte from the SD card, then pass every byte to the VS1053. Unexpected delays or slow playback usually mean that the microcontroller can't get data through fast enough.

User avatar
dhemberg
 
Posts: 26
Joined: Sat Apr 23, 2016 4:34 pm

Re: Music Maker delay

Post by dhemberg »

Hey there;

Thanks for the reply; before getting this, I spent the day experimenting with different speeds of SD cards (no discernible difference in performance) and different file formats (WAV versions of my files were almost unplayable and ground the entire program on the Arduino to a halt, very-highly-compressed MP3s played almost immediately).

It sounds like you're saying the entire audio file needs to be read before playing, which makes it seem like my concern should be absolute file size rather than too-high a bit rate or resolution, correct? E.g. a shorter file at higher bit rate vs. a longer file at lower bit rate might yield the same file size, which would in turn yield the same time-to-play, correct?

If that's true, do you have any collected data on file size vs. time to play for this shield?

Thanks!
--a

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Music Maker delay

Post by adafruit_support_mike »

The VS1053 doesn't need to read the entire file, but it does have a RAM buffer which needs to be filled. In most cases, it wants a couple seconds of audio before it starts decoding. The data size of "a couple seconds of audio" depends on the encoding, bitrate, resolution, etc.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”