Closed kd8bxp closed 2 years ago
Same here!
Found this post from another project: https://github.com/baldram/ESP_VS1053_Library/issues/18 But it gave the information needed.
xxd -i yoursoundfile.wav yoursoundfile.c which worked for me, with the following conditions:
I used Audacity to convert a mp3 to a wav, and change the bit rate, in the example it's 44100, which creates a rather large array. And from what I can tell the array needs to be pretty small to fit in memory. in AtomSPK.h there are two lines rated to bit rates (both are in the class ATOMSPK), that need to be changed, and it seems to work well with a lower rate.
The only other thing that I did was at the bottom of the "c" file that xxd creates is the size of the array, and I copied that number and used it when the array gets defined.
As pointed out from the other project xxd is part of VIM, and here is a post that talks about installing VIM for Windows https://superuser.com/questions/497953/convert-hex-dump-of-file-to-binary-program-file-on-windows#638850
I'm a linux mint 20.2 user and xxd appears to have already been installed, I can only guess other Ubuntu based distros would be the same.
I've googled and can't find how to convert a mp3/wav to a C array - so an example or tutorial of what is needed to convert an mp3 for use with the rawPCM example for the Atom SPK would be very nice to have.
Thanks