MP3-Player Lib, with example

Hi there,
It looks like a great library! however, I cannot compile it out of the box.
Did I mis something to make a change in the arduino IDE?
oh and used hardware/software "Teensy 3.1" Arduino 1.0.6.

Code:
Arduino-Teensy-MP3-lib\Helix.cpp.o: In function `HelixMp3::play(char const*, AudioPlayQueue*, AudioPlayQueue*)':
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:208: undefined reference to `MP3InitDecoder'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:239: undefined reference to `MP3FindSyncWord'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:251: undefined reference to `MP3Decode'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:279: undefined reference to `MP3GetLastFrameInfo'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:310: undefined reference to `MP3FreeDecoder'
Arduino-Teensy-MP3-lib\Helix.cpp.o: In function `HelixAac::play(char const*, AudioPlayQueue*, AudioPlayQueue*)':
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:423: undefined reference to `AACInitDecoder'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:450: undefined reference to `AACSetRawBlockParams'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:470: undefined reference to `AACFindSyncWord'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:485: undefined reference to `AACDecode'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:494: undefined reference to `AACGetLastFrameInfo'
C:\Program Files (x86)\Arduino\libraries\Arduino-Teensy-MP3-lib/Helix.cpp:528: undefined reference to `AACFreeDecoder'
collect2.exe: error: ld returned 1 exit status
 
Last edited:
Hi there,
It looks like a great library! however, I cannot compile it out of the box.
Did I mis something to make a change in the arduino IDE?
oh and used hardware/software "Teensy 3.1" Arduino 1.0.6.

Have you copied the subdirectories as on Github ?? You need all.
 
Yes, i've downloaded them all. (atleast > download as zip etc.) (few minuts ago)
Ah, that explains, ill try again.
Thanks!
 
Hehe, noproblem!
I gues so, I just finished a simple wav player, reading all wav files from a SD card, but them in a String etc, and a FFT with a LCD. then I went looking for more projects. until I found this thread on the PJRC roadmap.
However, a few weeks ago, I though mp3 or aac needed a FPU, so I actually stopped looking. (Also looking forward for FLAC!)
But I gues I try out this library in my small project, so it can play wav aac mp3, like an ordinairy player, but just faster and open source + visualizing:).

I'm still learning about alot of coding, how stuff works, Im glad there are opensource projects to look through :)

Also thanks for the very fast reply! I never had that on alot of forums, just they were 2 ~ 4 years old.
 
It is at a very early stage, there is only one function : "play()" . There is more to come...
But it would be great if could do some tests with different files ?!?!

No, the lib is all fixed-point, no FPU is needed. It is optimized to ARM/Teensy and very very fast.

I'm still learning too.. :) Arduino is a new world for me.
 
working version of audio-lib-mp3-object

I have a working version the audio-lib-mp3-object now (not on github yet).

I think, that i have to add the used cpucycles somehow to the ones of the stream, because it's running in an own interrupt (software-triggered by "update()").
What I need to do to achieve this?
Or do you have another suggestion ?

Frank.
 
Last edited:
I tried to implant stop(); myself, looking at the wav stop(); although a hard sd.close() didnt really like it. but I see in your new lib that stop is there, doing a bit other stuff then only sd.close. You have done a great job right now :).
As for the current possition, I tried a simple way of using millis. as example~
in Play, I added a line:

if (!file) curtime = millis();

before opening the file.
so it will store the current millis in the int32 curtime, and will stop after the file is opened.

in position I added:

uint32_t AudioPlaySdMp3::positionMillis(void){ //dat smiley <
int32_t curpos = millis() - curtime;
return curpos; //TODO
}

this will just count up until stop or if closing of the SD card.
after that I went looking at the reading bytes, maybe to use that as a simple position thing. I didnt look up the wav library yet though, how it was done there, but I think theres another way to get the current position. I didnt look up yet about the lenght op the song.

Also, doing Play and Stop() things, Pause() and maybe setPos() could be usefull aswell. As it said, pause will pause the track, and maybe setPos(time_in_millis) could be usefull to skip from 0:00 to 1:23:22 as for example~

Great job!
 
Hi Dnstje,

good idea :)

There'a a big update comming the next days, an audiolib-integrated object for aac/mp4/m4a (for mp3, it already there and @github) and some restructuring.
It will calc the positionMillis with a sample-counter. I've implemented a little function like processorUsageMax() too.
There are some other improvements too.

The new objects are using an interrupt which is called by ( exact: chained to) the update()-function, but has a lower priority than the update() interrupt. This way, it is easyly possible to
spend more time than 2.9ms with calculations. Maybe, that's a good idea for other audioobjects which need more time, too ??
This works without any problem, perfectly so far :)

Regards,
Frank.
 
setPos is not easy... i remember the first mp3-players which were not able to do this.
now, i know why. you have to read the whole file and count the frames. :-(
i don't know a better solution.
 
hmm thats why A-B function is slow on those simple mp3 players. I know a few methodes but I think it will require too much RAM. and probably not efficient.
I don't know/tested it yet, or modified/added code yet, but have you tested how fast it can play a mp3 without output? (benchmarking stuff)
 
I will look into that.
there's a function to find frames - MP3FindSyncWord() - maybe this helps.


It seems "AudioAnalyzeFFT1024" wont get along with your library. Changing AudioMemory() does something but no sound. I gues memory issues with the FFT, though "AudioAnalyzeFFT256" works.

trying more :).
 
I will look into that.



It seems "AudioAnalyzeFFT1024" wont get along with your library. Changing AudioMemory() does something but no sound. I gues memory issues with the FFT, though "AudioAnalyzeFFT256" works.

trying more :).

I don't know, never tried fft :) mp3 needs only AudioMemory(2) - but much ram via malloc.
Maybe the others know more about AudioAnalyzeFFT1024 (?!)
It is also possible that it takes too much time, (because it's interrupt-priority is higher than mp3-decoding - fft runs in update()!!)
 
Last edited:
According to Audio system design tool it uses 52% peak CPU. ^^
eebebf7460.png
 
Ok.. aac as audiolib-obj. is now uploaded too.

Paul, please, can you have a look at it ? I'm asking because i need to know if i have to change some things before it can be integrated into the audio library.
Is the structure ok.. the technique with using the additional Interrupt.. other things i might not think of ? Ideas ?

regards,
Frank.

p.s. Dnstje made a video with mp3+fft display
 
This is what I made from with some PCB laying around and a LCD~ resistors audio jack. I dont have a audioboard yet or plans to get one. (maybe i will) To get stereo I'm currently using the onboard DAC and PWM output at pin3 and 4, and I hear difference with timing/phase shiftings, but is fixed with a delay on one channel(for a minut orso).
Here's a preview :).
[video]http://tsukiko.dnstje.nl/vids/index.htm[/video]

(the lcd contrast is bad, slowish response rate due cheap module I gues around 2005 ~ 20 euro's)
 
Last edited:
Hey, it looks great!

How are you reading the SD card?
I am working in a similar project, but as I need to record sound with a mic and then store it on the card I'm using the Adafruit VS1053b breakout.
 
#include "SD.h"
But maybe i don't understand your Question, sorry.

Yes, some years ago i used this VS1053 in a project, too. A nice chip.
But now decoding can be done in software.
 
Back
Top