Music Maker Shield (VS1053) 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
syndic
 
Posts: 16
Joined: Tue Jul 22, 2014 4:34 am

Music Maker Shield (VS1053) delay?

Post by syndic »

Hey guys. I have 2 questions about the VS1053 library code:

QUESTION 1:

When running the player_interrupts example, I am not seeing the SD card contents listed. I'm also not seeing anywhere in the code that /would/ output the SD card contents. (The bottom of this page tells me I should see that listing.)

I thought I might have an old version of the library, so I compared my code to the newest version from the github repo. I appear to have the latest version.

When I looked in the github repo, I found an interesting commit that claims to add SD file listing but, as I said before, I can't see anything in the code that would actually print out a listing like that. Is it possible that Ladyada didn't commit the latest version of the software to the repo?

QUESTION 2:

When I play MP3 files from the shield, there's a rather noticible delay between triggering the music to start, and it actually starting. Is this something that could be reduced by switching file formats? Bitrates?

I'm trying to make something that drives LEDs in synch with audio. I can preprogram the LED sequence, but I need to know when the music would actually start playing to synch them together.

User avatar
syndic
 
Posts: 16
Joined: Tue Jul 22, 2014 4:34 am

Re: Music Maker Shield (VS1053) delay?

Post by syndic »

Hey guys. Is there any more information that would help?

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Music Maker Shield (VS1053) delay?

Post by adafruit2 »

Hi - check the latest version, I just committed some SD file listing code
As for the delay, there's not much you can do to remove it because it has to fill/read the buffer.
However, you could try calling musicPlayer.startPlayingFile("track001.mp3")
and it should begin playing audio very soon after that returns?

User avatar
syndic
 
Posts: 16
Joined: Tue Jul 22, 2014 4:34 am

Re: Music Maker Shield (VS1053) delay?

Post by syndic »

Thanks for the SD listing code! I'm at work, so I've not been able to test it yet, but it looks like exactly what I was hoping for.

As for the delay, it seems to be independent of whether I'm using interrupts or a blocking call. I'm pretty sure it's due to having to decode the mp3 before anything can be played. I found this forum thread which seems to suggest that WAV audio might be able to be played without the delay I'm seeing here.

User avatar
kerryveenstra
 
Posts: 16
Joined: Mon Jun 09, 2014 9:20 am

Re: Music Maker Shield (VS1053) delay?

Post by kerryveenstra »

Hi folks. I have discovered another cause for the "delay-before-playing" problem. It's simply that I left the call to printDirectory() in the sketch, and after a while it was taking a long time to send 484 directory entries out the serial port. It's not that I had 484 songs on the SD card, it's that I had 64 songs that had been written using a Mac, which meant that there also were curious _A~1.M4A-like file names as well as a TRASHE~1 subdirectory and a SPOTLI~1 directory, each of which had lots of files whose names were being written to the serial port during the initial directory listing.

All of this was on the SD card, even though it started completely empty. The problem is that I had loaded a collection of 64 songs onto the card a couple of times, and I had switched to .mp3 files from .m4a files.

So for me, the actual solution was to convert the 256-mbps AAC files into 80-mbps MP3 files and also to remove the unused call to printDirectory(). The delay before playing is down to an acceptable 1 to 2 seconds.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Music Maker Shield (VS1053) delay?

Post by adafruit2 »

lol :) yep thats for debugging only!

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

Return to “Arduino Shields from Adafruit”