-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to convert MP3 file to C Header file #18
Comments
Hi @williamesp2015 . If about the audio file conversion. It produced something like this: https://github.com/baldram/ESP_VS1053_Library/blob/46cbc6435b1bcf19ee52b0f61a8a9d0cb925f3d2/examples/SimpleMp3Player/helloMp3.h Recently I found something what produces nicer output.
and from mp3:
using this software: Good luck! |
Thanks @baldram, Very nice but practically it is difficult to convert and I am thinking to play MP3 file on SD memory card. I couldn't find compatible example with your code using SD card. |
Hi, I provided you various possibilities for doing the same. But all you need to do is just to call from command line:
Can't be easier I think. The xxd util is a part of Vim editor. So it's not only for Linux users. If you install Vim, you can even call this command under Windows. Please find related thread here.
SD card is another peace of hardware. Of course VS1053 driver can be combined with that or anything else. So you can go this direction of course. Unfortunately I don't have any tested (myself) example to provide you. I see that one of forks of my library has an example for SD. I don't know whether it works fine or not, but I think it's at least some start point or a piece of code that you will be able to take inspiration from. Are you happy with this answer? PS: Please do not forget to click the "star" for my project if you like it. |
I appreciate @baldram. Unfortunately the sound I converted is like a noise and prolonger than the original WAV file. |
@williamesp2015 Later evening I'll check your xxd.exe with my mp3 file. I will also attach you the mp3 file I used for test on your side. Maybe in the meantime you can also try with mp3 instead of wave. |
@williamesp2015 I tried to use the file you provided me.
So I'm not sure how did you manage to compile that. But nevermind, let's go to the solution. But it's still easy to use the sound as C header file. I downloaded some random file from here: http://soundbible.com/2101-12-Ga-Winchester-Shotgun.html . Then I decided to trim the file (ctrl+T) and remove silence (or almost silence) from the beginning and end. I manage to do it easily using free audio editor from https://www.ocenaudio.com/. I also converted it to mono (Edit > Convert Sample Type). As I observed one more potential issue 48kHz (instead of 44kHz which is equal to CD quality), I decided to reduce it (also via Convert Sample Type menu). But on the other hand from spec I see VS1053 supports up to 48kHz, so it should not be an issue. So maybe I didn't have to decrease this value. Ok, further step. I exported the modified audio as mp3 with quality 112kbps. So... finally executed What about the result? It works! :-) PS: Please check if you can convert attached mp3 file using your xxd. I was not able to test it under Windows because I don't have one around at the moment. |
@williamesp2015 I tested the The only thing is what I mentioned earlier, that it's better to use mp3 instead of wave, as the file should be small enough since microcontrollers have limited resources. I will add a hint about the |
An information how to convert the mp3 file into C header
No answer. I consider the subject to be explained. Documentation has been extended. |
i am not able convert .mp3 to .wav in c program can one help me . |
if there is any program is available please share me |
You might use one mentioned in this thread. Works very well. You're welcome. |
Very nice project. I could play sound on a Arduino MP3 shield board with TF_card. I need a converter to use in my program.
Thank you
The text was updated successfully, but these errors were encountered: