Go Down

Topic: Mp3 encoder (Read 933 times) previous topic - next topic

UptownKitten

Jul 29, 2019, 08:30 pm Last Edit: Jul 29, 2019, 08:33 pm by UptownKitten
Greetings, is there any software that can encode a MP3 file to the Arduino? I tried electronic GURU's encoder, but it didn't work. Here's the hardware:

DVDdoug

Quote
Greetings, is there any software that can encode a MP3 file to the Arduino
Probably not in real-time...   Encode from what?

Quote
I tried electronic GURU's encoder
I have no clue what that is.  Do you have a link?

Quote
Here's the hardware:
What's a speaker got to do with encoding?   Are you talking about decoding (and playing)?

slipstick

The SD card "mumbo-jumbo" is because most people want to play longer than a couple of seconds of low quality MP3 speech/music.

But if that's all you want then post the exact code you are using which includes YOUR MP3 data. Where did you get the MP3 file from and did you follow all the Audacity/PCM Encoder steps from the video?

What Arduino are you using?

Steve

Grumpy_Mike

is any software out there to convert an MP3 file to the arduino
Yes there is Audacity, no need to save it as an MP3. Save it as a wav file.

I actually think he might be fooling himself that he is saving the file as an MP3 in the first place. My version of Audacity won't do that, but then I have an old one.

PieterP

I actually think he might be fooling himself that he is saving the file as an MP3 in the first place. My version of Audacity won't do that, but then I have an old one.
Strange, I've been using Audacity to export MP3 files for years.

On Linux, it just works, on Windows, you had to install ffmpeg/lame encoders (but I haven't used Windows in years, so it might've changed).

It should be noted that there are Arduino-compatible boards that support MP3 decoding, like the ESP32 using the ESP-ADF framework. There's also external chips that can play MP3 files (DFPlayer, for example).

The 8-bit AVR Arduino's are not suited for audio, not even if you use WAV files.
Some more powerful boards like the Teensy 3.x boards have the necessary hardware to do serious audio (I²S interface with FIFOs and DMA, plenty of RAM and processing power). Boards like the Due also have some hardware for audio, but the Teensy software support is far superior.
There seems to be a third-party library that plays MP3 on Teensy, but no official support.
ESP32 can also do audio, as mentioned earlier, but I don't think the Arduino support is there (yet?). For now, I'd recommend to use the ESP-ADF directly.

Pieter

Grumpy_Mike

#5
Jul 30, 2019, 05:46 pm Last Edit: Jul 30, 2019, 05:50 pm by Grumpy_Mike
Quote
I followed all the steps to the video, I have a Arduino Mega 2560.
But he says, time and time again that this will not work with a Mega.

Did you not read this in the comments?

Quote
So, I was wondering if anybody knew if there was a software solution to converting an MP3 file to the Arduino, not having that SD card stuff and extra hardware that I would have to buy.
Yes in reply #5
I said:-
Quote
Yes there is Audacity, no need to save it as an MP3. Save it as a wav file.
It seems you make a habit of not reading things.

Quote
I have TIP120s with a 5V speaker from a old trimline phone.
The transistor needs a 220R resistor between the Arduino's output pin and the transistor's base connection.

DVDdoug

#6
Jul 30, 2019, 06:49 pm Last Edit: Jul 30, 2019, 06:52 pm by DVDdoug
I don't know how this is supposed to work and I'm not going to dig-into it.


UptownKitten,
What are YOU trying to do?   Is this a learning-project?   Do you need to play a few seconds of (low quality) audio cheaply?
   

If you just need to play audio without any software-features, there are audio boards/shields that work without a microcontroller.  The cost will be about the same as an Arduino but you'll get better quality, more memory storage (with an SD card) and it will be WAY easier.   

Or, maybe the Raspberry Pi (which has audio built-in) may be a better option.

If this is a learning project I suggest you study TMRpcm.   It normally uses an SD card but if you can understand how the code works it shouldn't be too hard to hard-code a few seconds of audio instead of reading from an SD card.  But, that's NOT a good learning project for a beginner!

Quote
So, I was wondering if anybody knew if there was a software solution to converting an MP3 file to the Arduino
He's got a file called PCM.ZIP and that includes a file called EncodeAudio.exe.

He says:
Quote
but the Arduino can only play 16 bit PCM 8kHZ audio mp3 & that mp3 should be coded using a encoder software
That's confusing....  But, it does NOT play MP3...  It plays MP3s that are decompressed (decoded) and then "encoded" to PCM.  The PCM version is (somehow) loaded into the Arduino.   

It's silly to start with MP3 and then decompress it to PCM but if you want to copy him you may have to do the same thing.

Quote
But he says, time and time again that this will not work with a Mega.
I didn't watch the video but he writes:
Quote
the only down side is the low memory of Arduino uno allows us to play a audio of approx 4-5 sec but you can use ARDUINO MEGA to solve this
Implying that you can get a few more seconds with a MEGA.

And he says:
Quote
well practically this concept is not of much use but its kind a educational & fun too

Grumpy_Mike

Quote
Implying that you can get a few more seconds with a MEGA.
Yes you could, but read the comments and replies on the video when he says it over and over.

It is quite clear why it will not work with a Mega even though he does not know. The internal timers are not the same on the Maga as they are in the Uno.

Sorry, I did, I wasn't too sure.
So instead of asking about what you were not sure about you decided to simply ignore me. How would you feel if you were ignored.

Quote
That's confusing....  But, it does NOT play MP3...  It plays MP3s that are decompressed (decoded) and then "encoded" to PCM.  The PCM version is (somehow) loaded into the Arduino.   
Yes that is the conclusion I came to as well.

Grumpy_Mike

Strange, I've been using Audacity to export MP3 files for years.

On Linux, it just works, on Windows, you had to install ffmpeg/lame encoders (but I haven't used Windows in years, so it might've changed).
But I am on a Mac. It asks where the lame encoder is, but it is not on my machine and I don't know where to get it.

 
very sorry. :(
OK thanks for that.

He's got a file called PCM.ZIP and that includes a file called EncodeAudio.exe.
Which means it can not possibly run on a Mac. Not sure if this guy is deluding himself, or having a laugh. The Arduino is not decoding MP3. He can't actually be that clever because he didn't put a resistor on the base of the transistor.

PieterP

But I am on a Mac. It asks where the lame encoder is, but it is not on my machine and I don't know where to get it.
It is included with the latest version(s):
https://manual.audacityteam.org/man/faq_installation_and_plug_ins.html#lame

Grumpy_Mike

Well that is what it says:-
Quote
Mac: LAME is now built-in with Audacity for Mac.
But quite simply it is not. I updated to the latest version only two weeks ago.

PieterP

That's strange.
Well, I can't test it myself, because I don't have a Mac  :)

viknews

I think it's impossible

MarkT

If you want to run an .EXE on a Mac install Wine.  That doesn't work for everything, but its always worth trying.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up