Music Maker Library

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
aatstireman
 
Posts: 1
Joined: Thu Oct 19, 2017 6:33 am

Music Maker Library

Post by aatstireman »

Using Adafruit Music Maker with 3 Watts amps V1.0
Arduino Uno microcontroller, SanDisk Ultra 32GB Micro SD card

Library class Adafruit_VS1053 downloaded from Adafruit
"library.properties" shows it to be version 1.0.4.
Using the "player_interrupts" program, unmodified except for changing the filename to play.

The problem is in both .playFullFile or .startPlayingFile (interrupt mode), when playing a short file, there is a click at the very beginning of the played file, but only after the first time the file is played.
Second Uno - same symptom
Second SD card - same symptom
Powered from USB or 10A 12VDC supply - same symptom
Either .mp3 or a .ogg files - same symptom

Shortest file is a 600 Hz tone, 120 milliseconds long, created under the Audacity program. Other files of 360 ms and 500 ms show the same problem.

If the "player_interrupts" program is all that is loaded into the Uno, and is modified so that the only commands left in void loop() are:
musicPlayer.startPlayingFile("filename8.3");
delay(1000); // the click remains regardless of how long the delay is
The very first time the file is played the audio is perfectly clear. Each additional play has the initial click at the beginning of the audio.

Looking into the library file Adafruit VS1053 Code Breakout.cpp, I found the following code snippet. It is interesting that the comments do closely describe the issue I am seeing.

Underneath this command -
boolean Adafruit_VS1053_FilePlayer::startPlayingFile(const char *trackname) {
// reset playback
is this routine (only partial shown) -
void Adafruit_VS1053_FilePlayer::feedBuffer(void) {
noInterrupts();
// dont run twice in case interrupts collided
// This isn't a perfect lock as it may lose one feedBuffer request if
// an interrupt occurs before feedBufferLock is reset to false. This
// may cause a glitch in the audio but at least it will not corrupt
// state.

This Music Maker is to be used as part of an interactive Morse Code display at a war museum. I have used your Music Maker boards in other displays, but all of the audio files begin with a brief silence, so this click problem does not show itself. However, each of the Morse Code files is a tone that begins at the first millisecond of the file. The shortest tone must be 120ms long, so no beginning silence can be added to the file. The tone must be pure without the beginning click. Because of other demands on the Arduino, my program must run in interrupt mode.

Do you have any suggestions for how to fix this problem?

User avatar
jim_lee
 
Posts: 709
Joined: Thu May 24, 2012 8:24 pm

Re: Music Maker Library

Post by jim_lee »

Possibly a band-ade fix would be to shut off the volume, call startPlaying() then bring the volume back up?

When using that board, I ended up using the start & stop calls but taking care of feeding the buffer in my loop() function myself. Worked very well after a bit of learning curve.

http://www.leftcoast.biz/iWeb/Left_Coas ... ell_1.html
At the end of that linked build log, there's links to the code I used. Maybe it'll help? Maybe it'll just screw you all up?

-jim lee

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

Return to “Other Arduino products from Adafruit”