EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: Kasper on January 27, 2019, 06:37:13 pm
-
Hello,
I am looking for an MP3 decoder for an MP3 player I hope to put on Kickstarter or similar.
Last year I had a working prototype using VS1053B. But then I got busy with other projects and got married so it got shelved with all my other proofs of concepts. I am hoping to get back into it soon.
I chose VS1053B because it was used by Sparkfun and Adafruit and sounded like it had pretty good quality output. Now that I have VS1053B working, I think I should move forward with that.
I want it to be solid, simple and affordable with good quality sound not over engineered, over spec'd, and over priced.
Does anyone recommend any other MP3 decoders I should consider?
-
Those are way overpriced, costing even more than a general-purpose MCU you can run an MP3 decoder on (and now that the patents have expired, you don't even have to worry about that --- if you were going to.) Look at what's in the various Chinese MP3 players...
-
The only other dedicated MP3 codec chip I know of is the ST STA013 but it isn't cheap either. Do what amyk said with a microcontroller.
-
Thank you for the replies. I guess I'm shopping for MCUs and DACs when I get home from my hike :)
What are the min requirements of an MCU to read MP3 off microSD card, decode then send to DAC?
I'm guessing I'll want a separate DAC but I'll have a look for MCUs with DACs >= 16 bit first.
-
Looks like MCUs with DAC >= 16 bit aren't too common. And audio DACs are spread into multiple categories on DK.
DK categories with audio DACs:
Data Acquisition - ADCs/DACs - Special Purpose
Data Acquisition - Digital to Analog Converters (DAC)
Interface - CODECs
Linear - Amplifiers - Audio
The TI series TLV320DAC is my favorite so far but if I have to get a separate DAC, I mind as well stick with VS1053B for my DAC and decoder.
Price for VS1053B-L is high at low quantities but it drops quickly ($10usd at qty 100). Still a little pricey but it seems much cheaper than R&D for a new MCU and DAC.
On a side note, some places call it VS1053B and others call it VS1053B-L. Seems to be the same part and some people just drop the "L".
-
You should look into supporting Opus as well, since it has much better quality than mp3 and even AAC... should also support FLAC as well.
PIC32 has enough power to decode them, and there's libraries available: https://www.microchip.com/design-centers/audio-and-speech/technology/pic32-digital-audio/pic32-audio-decoders (https://www.microchip.com/design-centers/audio-and-speech/technology/pic32-digital-audio/pic32-audio-decoders)
And not only pic32, maybe the microchip ATSAM family or some other ARM Cortex micro would work for you, with a separate audio codec (you can use spi or i2s or something) ... for example see this (probably overkill but has usb, memory card support, 120 mhz) : https://www.digikey.com/product-detail/en/microchip-technology/ATSAM4S16CA-AN/1611-ATSAM4S16CA-AN-ND/6829666 (https://www.digikey.com/product-detail/en/microchip-technology/ATSAM4S16CA-AN/1611-ATSAM4S16CA-AN-ND/6829666)
-
Thanks for the links.
VS1053B supports
Ogg Vorbis/MP3/AAC/WMA/MIDI
I think you are right about ATSAM. Adafruit has a library they say can decode MP3 and output through DAC on ATSAMD51J19. Its a little big though, small size is one of my requirements.
Microchip wants $200usd for MP3 library.
-
There are smaller versions, like a 64-QFN one : https://www.digikey.com/product-detail/en/microchip-technology/ATSAM4S8BA-MU/ATSAM4S8BA-MU-ND/3593646 (https://www.digikey.com/product-detail/en/microchip-technology/ATSAM4S8BA-MU/ATSAM4S8BA-MU-ND/3593646)
See whatever has better price if you buy 10 or more, and see if you can manage with just 64 KB of ram... I think most audio formats won't need more than around 10-16 KB of memory to decode so you may be able to work with just 64k of ram.
You probably saw this already : https://learn.adafruit.com/native-mp3-decoding-on-arduino/overview (https://learn.adafruit.com/native-mp3-decoding-on-arduino/overview)
and maybe check this out as well : https://github.com/otsaregorodtsev/walkgeek (https://github.com/otsaregorodtsev/walkgeek)
-
Microchip wants $200usd for MP3 library.
Github wants $0 :)
https://github.com/lieff/minimp3
-
[...]
See whatever has better price if you buy 10 or more, and see if you can manage with just 64 KB of ram... I think most audio formats won't need more than around 10-16 KB of memory to decode so you may be able to work with just 64k of ram.
[...]
Thanks again for the links.
I started with atmega328P and ran out of memory. Now I am kicking myself for trying to save a few dollars on an MCU.
I appreciate the suggestions and have noted them for version 2.
For version 1, I am not looking for absolute best BOM regardless of R&D time. At my volumes, R&D time is a significant cost.
-
Microchip wants $200usd for MP3 library.
Github wants $0 :)
https://github.com/lieff/minimp3
Yes and my PC that has working code wants $0 :)
-
STM32F107RCT6.
64KB ram, 256KB flash, and integrated 12-bit DAC.
$1.5 at small quantities.
-
Thanks but I don't think 12 bit will cut it. I've read 16 bit is plenty for everyone except the most expert audiophiles. So I am aiming for atleast 16.
-
Looks like MCUs with DAC >= 16 bit aren't too common. And audio DACs are spread into multiple categories on DK.
That's true. But you could consider another option. Is it going to be a portable MP3 player, mainly used with headphones? If so, you'll need an headphones amp anyway, so an additional IC.
There are actually audio DACs that include an headphones amp, so you will only need an MCU capable of decoding MP3 and having an I2S output, and such a DAC. Problem solved.
For instance the TLV320DAC3100 from TI is about $2.5 per 1, about $1.8 per 100 (Digikey). http://www.ti.com/product/TLV320DAC3100 (http://www.ti.com/product/TLV320DAC3100)
With a VS1053B, you'll need an MCU anyway to feed it? But it does include an headphones driver. So does the above DAC. And the overall sound quality will probably be much higher. So you'll essentially go from a $10 IC per 100 to a $1.8 IC per 100, plus the MCU, for a better sounding solution.
The advantage is that it'll be also more flexible. You could for instance add FLAC decoding or anything else the MCU can decode.
-
If money's no issue, how about something like Cirrus Logic WM8731 : https://www.digikey.com/product-detail/en/cirrus-logic-inc/WM8731SEDS-RV/WM8731SEDS-RVTR-ND/5036734 (https://www.digikey.com/product-detail/en/cirrus-logic-inc/WM8731SEDS-RV/WM8731SEDS-RVTR-ND/5036734)
It's around 2$ in quantity (1000+)
The WM8731 or WM8731L (WM8731/L) are low power stereo CODECs with an integrated headphone driver. The WM8731/L is designed specifically for portable MP3 audio and speech players and recorders. The WM8731 is also ideal for MD, CD-RW machines and DAT recorders. Stereo line and mono microphone level audio inputs are provided, along with a mute function, programmable line level volume control and a bias voltage output suitable for an electret type microphone.
Stereo 24-bit multi-bit sigma delta ADCs and DACs are used with oversampling digital interpolation and decimation filters. Digital audio input word lengths from 16-32 bits and sampling rates from 8kHz to 96kHz are supported.
Stereo audio outputs are buffered for driving headphones from a programmable volume control, line level outputs are also provided along with anti-thump mute and power up/down circuitry.
The device is controlled via a 2 or 3 wire serial interface. The interface provides access to all features including volume controls, mutes, de-emphasis and extensive power management facilities.
If you want something cheaper, may want to check out AK4951 that costs around 1.3$/100 or 1$ /500 : https://www.digikey.com/product-detail/en/akm-semiconductor-inc/AK4951EN/974-1064-1-ND/5180415 (https://www.digikey.com/product-detail/en/akm-semiconductor-inc/AK4951EN/974-1064-1-ND/5180415)
AK4951 is a low power 24-bit stereo CODEC with a microphone, headphone and speaker amplifiers. The AK4951 supports sampling frequency from 8kHz to 48kHz. It is suitable for a wide range of application from speech signal processing for narrowband, wideband and super wideband to sound signal processing for audio band.The input circuits include a microphone amplifier, an automatic wind noise reduction filter of the proprietary algorithms and a high performance digital ALC (automatic level control) circuit, therefore the AK4951 can record with high-quality sound regardless of whether indoors or outdoors. In addition, the output circuits include a cap-less headphone amplifier with a negative voltage generated by charge pump circuit and a speaker amplifier with 1W output power. It is suitable for various products as well as portable applications with recording/playback function.
(but keep in mind it's listed as "not for new designs" - check out other parts from them which are "active", before committing to this part)
-
It's 12 bit but running at 1MSPS. With just a little bit of delta sigma modulation you can get >16 effective bits.
If you just need to play mp3 files from an SD card maybe look into the dfplayer module, which is about $1.5.
I would say using a "proper" audio DAC here is overkill and the total cost of the solution shouldn't exceed $2.
-
I think you do not want cheap Chinese solutions but
at least as a note i wanted to write about it:
There is YX5200 and variations of it like
built in small memory and or amplifier etc.
It goes under these names at aliexpress
Gpd2846 - U Disk Mini Player - DfPlayer - arduino mp3 module.
-
STM32F401RCT6 + CS4344 total cost under 2$
-
STM32F401RCT6 + CS4344 total cost under 2$
I agree
This provide good sound quality and flexible fast CPU can decode any format (wonder if this can have enough power to decode even small video) for good price
-
Thanks everyone for the replies. I appreciate all the different options you are sharing.
I started out with the dfplayer. Great option for something simple but I want better quality.
If use 12 bits and some fancy firmware and say it has 16 effective bits, will I get called out by audiophiles for over-selling a 12 bit DAC or will most people understand what you are saying about 1 MSPS?
This will be one of my first products done on my own, I don't expect high or even moderate volume sales, though I would like to be prepared for that. My main goal is to build a good reputation with solid products delivered on time. And to not spend years worth of weekends developing products that never get released.
-
Thanks but I don't think 12 bit will cut it. I've read 16 bit is plenty for everyone except the most expert audiophiles. So I am aiming for atleast 16.
Opinion: 16bits is useful for editing (it gives you a little headroom), but for final renders and playback it's not super necessary. You're already talking about MP3 after all :D
To counter your "from what I've read" with my own "from what I've read": many audio DAC chipsets that claim 16 bits don't otherwise have a low enough noise floor in most circuit implementations for this to be useful anyway. The "resulting" number of bits out is lower.
-
If use 12 bits and some fancy firmware and say it has 16 effective bits, will I get called out by audiophiles for over-selling a 12 bit DAC or will most people understand what you are saying about 1 MSPS?
This will be one of my first products done on my own, I don't expect high or even moderate volume sales, though I would like to be prepared for that. My main goal is to build a good reputation with solid products delivered on time. And to not spend years worth of weekends developing products that never get released.
Audiophools will have far more problems with the use of MP3 compression :-DD
Seriously though, ~every audio DAC on the market nowadays use delta-sigma modulation with a 1- or 2-bit DAC internally. Implementing a delta sigma modulator in software is trivial. Start with outputting the 16 bit sample rounded down to 12 bits, and accumulate the error value into a variable. Once the accumulator reaches a set threshold you switch to rounding up (if the accumulator is negative) or rounding down (if it was positive).
I think even without the delta-sigma tricks you probably won't tell the difference between 12-bit and 16-bit audio.
-
STM32F401RCT6 + CS4344 total cost under 2$
I agree
This provide good sound quality and flexible fast CPU can decode any format (wonder if this can have enough power to decode even small video) for good price
That's more than enough to decode small video, these (https://en.wikipedia.org/wiki/S1_MP3_player) used to be popular many years ago and could play 160x128 MJPEG at 15FPS --- using a 24MHz Z80.
-
My title is a little misleading. To be clear, I plan to offer more than just MP3.
VS1053B supports Ogg Vorbis/MP3/AAC/WMA/MIDI. It sounds like some of those are valuable options and might make use of higher resolution.
I'm not sure if I could tell the difference between 12 bits and 16 bits. I don't want to be all about the marketing but I have noticed audio products proported as high end on ks seem to do much better than moderate to low cost products. I want to make sure I have good specs to appease that larger customer base even if it is better than needed.