Decode Mp3 to raw bytes

Discussion in 'Analog & Mixed-Signal Design' started by m zaid, Jun 28, 2016.

  1. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    Hello guys,

    Well, I need some help..
    I want to analyze sound (MP3 file) and do some mathematical operation with it with a microcontroller. For example analyze a 2 minute speech in 4 seconds before playing the file..
    You guys know any chip solutions?
    I know about Microchip's Helix Mp3 Decoder library but may be it's an overkill.

    Thanks,
    Zaid
     
    Last edited: Jul 11, 2016
  2. AlbertHall

    Well-Known Member

    Jun 4, 2014
    1,951
    387
  3. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    AT89C51SND1C looks kinda promising with 'embedded mp3'. Maybe I can analyse the audio at a faster bitrate than it is actually played
    thanks.
     
    Last edited: Jul 11, 2016
  4. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    I have searched the net and the word is the part is obsolete.
     
  5. AlbertHall

    Well-Known Member

    Jun 4, 2014
    1,951
    387
  6. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    thx.Of course. I'm planning for production. Kinda personal dream. It also can be used in a proposal for further study. But regardless, I like it.
    Now am settling on the solution. Decoder IC (if any) or software.
     
    Last edited: Jul 11, 2016
  7. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    How do you get the data back out of a decoder IC?
    They are mostly designed to drive an analog output, the intermediate data is not accessible?
     
  8. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    Take for example one of the most basic VS1011, which output is analog and not serial that require another part and as I could use ADC for the bytes. In page 7/8, it says CLK1 is set by the crystal which in cases can result in small percentage off keys for the 'play sample rate'. Does it mean I can clock the chip faster for a faster 'play' and whats the maximum clock I can use?. But also how do you? I can understand block diagrams and physically connect the legs of an oscillator crystal to the designated XT1/2 pins, but for the variable play speed, how can I use pulses from an MCU for instance with these inputs.
    There are other things though like next is selecting an MCU that can provide the pulses fast enough. or if this way can free up some space in the MCU to not require more expensive external memory or other ICs, or assembly cost:confused:.
     
    Last edited: Jul 12, 2016
  9. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    Those Chips are fiendishly complicated- beware.

    Not recommended unless you are already a monster programmer / EE.
     
  10. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    Thanks for your concern. Sometimes the complexity is exciting when you think you are good enough based on previous jobs done well or it worked. You like the sound of challenge; they all seem possible and just maybe with a little more...

    Anyway, I feel this topic is off section - suitably situated in Embedded Micro.

    But to conclude the case, I learned about the STA013. Here it says it can accepts an external DAC clock. But in the datasheet there weren't specs about maximum speed.

    My solution? I thought about component piece value per cost and am trying out Microchip's Helix Mp3 Decoder..with a PIC32MZ:rolleyes:(I never really experienced a PIC that was running too slow). I'll scale down for a more cost effective implementation later after knowing the actual requirements...and that's it.
     
    Last edited: Jul 22, 2016
  11. JWHassler

    Member

    Sep 25, 2013
    201
    33
    Can you convert it to an uncompreesed format first? .WAV, maybe?
     
  12. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    I'm no expert in this nor even an EE graduate. I'm a manufacturing engineering graduate and for the final project about 5 years ago I proposed to develop a product which involved electronics and USB. We had basic electronics and c++ classes though. Since then during my free time, I continued to develop the product little by little, creating learning opportunities for myself - suitably hobby basis.
    Maybe in the future I'll work well with one or be able to manage a team. I don't know but maybe in the real product development business specialty engineers are mandatory to release designs etc.
    As far as I know WAV files for audio is larger in the magnitude of 10x. It is most practical for recording and editing; and as I have specified the audio was speech. However it could be music too that I want analyze (the specific application is still a secret). Hence Mp3 is desired due to availability, practicality and popularity of usage. Mp3 is also most efficient if streaming through the internet.
     
    Last edited: Jul 22, 2016
  13. benta

    Member

    Dec 7, 2015
    101
    24
    I don't really understand what you want to do.
    MP3 is a well-defined format for audio and you can do what you want with it.
    I have a feeling that you would like to "go back" to the original recording based on an MP3. This is NOT possible.
    MP3 is a "lossy" compression algorithm and will not allow re-creation of the original sound file.

    As a different example: .ZIP is a lossless compression and will allow you to extract/create the original files.
    .JPG is a lossy compression format, and will NOT let you generate/extract the original picture.

    Makes sense?
     
  14. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    I certainly do understand that Mp3 is one sort of an audio data compressed and lossy. But it does play the correct sound to the ears. This is enough for me as I'm not after harmonic noise in any original but the more simple beats or impulses with high energy and which dominates in rather lengthy bandwidth.
    What I hope to achieve with Microchip's Helix Mp3 decoder is to take use the data just before it is fed into the serial buffer for audio DAC. For instance something like 8 seconds before. Or at least this is how i think it will work later.
     
    Last edited: Jul 23, 2016
  15. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    8 seconds of 16 bit data at 44KHz 2 channels would require a 1.4 Mbyte buffer.

    Bob
     
    kubeek likes this.
  16. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    If you want to do some computation on the audio, then you inevitably will have to decode the mp3 into raw wave data, even if just a few milisecond chunks at a time. Just like if you are searching for a word contained inside a zip-compressed file, you need to unpack it. Thus you need an mp3-decoder library that will do that for you, i am afraid that there will be no mp3 decoder chips that will help you in this manner.
    What kind of micro and how much RAM you will have available is up to you, but the faster micro and the larger memory the better, expecially if you need to do very fast this prior to playing said mp3. Maybe even a DSP might be a better choice (but I don´t really know how the decoder works and what kind of operations it uses so not sure about the benefit of a DSP)
     
  17. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    Due to the large amount of memory needed and the speed, I don't think a micro will do this for you. A raspberry Pi or other small single board computer would be more like it.

    Bob
     
  18. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,908
    2,169
    A PIC32 should be able to handle this easily using the Helix MP3 Decoder but the OP doesn't want to use that.
     
  19. m zaid

    Thread Starter Member

    Jan 9, 2016
    46
    5
    I may not represent everyone working with Mp3, but indeed the mp3-decoder library will help tremendously. The other prerequiste is like the PIC32 C compiler, and it is free.
    You queried on how actually is the Mp3 encoding. For starters I'll try to pack one myself. Basically audio are alternating waves, possibly the various peaks are created by circle formulas fed constants like amplitude and radius and the line inbetween is represented by gradient. Don't the lines between high and low peaks of a sine look straight? A number can represent the distance between each peaks given the sample rate. What else is unique in an audio wave? ...and given the specs, any finer audio is normalized for a 44.1kHz sample rate.
    Hey, I'm actually excited and looking very forward to be using the PIC32.
    But besides the one i called obsolete in #3, there's the AT83SND2CMP3 with embedded Mp3. Then I wouldn't worry much it taxing resources for the main program. Additionally of course, if more memory is needed, external SRAMS can be used.
    However for the AT83SND2CMP3, I couldnt find Atmel listing prices.

    Those SBCs are monstrous. They are running windows now? Though I'd bet Mp3 decoding will much be easier given APIs targeted at the OSes they run?
     
    Last edited: Jul 24, 2016
  20. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    Most run Linux, and they are not any larger than a board you could make with PIC32 and external RAM.

    Bolb
     
Loading...