palying mp3 over uart

Posts about MIDIsense. open source MIDI sensor platform

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
Posts: 5
Joined: Fri Feb 06, 2015 4:21 am

palying mp3 over uart

Post by NicoFruit »

Hi Staff,
I have an MCU exposing a UART . I need to play an mp3 wich is stored on my MCU board by sending the file over serial line (UART) to another audio subsystem.
Do you think your MIDI ... c-tutorial
is suitable for this use?
I can use two pattern:
    Scenario 1: a) send the mp3/wav file to your board; b) save the mp3 into sd of your board ; c) play the file trough your board by triggering a digital pin from my MCU to your board or sending a specific command over uart;
      Scenario 2: play directly the mp3 in a sort of "streaming" by send "X" byte at time (dont think feasible);

      Please support in order to understand if i can buy your board or not.
      Thanks a lot.

      User avatar
      Posts: 67821
      Joined: Thu Feb 11, 2010 2:51 pm

      Re: palying mp3 over uart

      Post by adafruit_support_mike »

      MIDI won't help you at all.. it isn't designed for that kind of transmission, and is too slow for bulk data.

      Your best bet will be to send the data from the MP3 file through a Serial connection at 115200 baud, then decode it immediately before sending the audio data to the speakers. The whole point of MP3 is to minimize the amount of data you have to transmit while sending audio from one place to another.

      The MP3 format also allows for something like streaming. The data is arranged in blocks with a starting value, then a series of changes to whatever is already in the buffer. A new starting value occurs every N bytes in the data stream (adjustable so you can control the amount of data compression), and decoders basically start from scratch every time they see a new starting value.

      That means you can start decoding as soon as you see the first few bytes of incoming data, rather than having to wait for the whole file to transfer before you can start working with it.

      Please be positive and constructive with your questions and comments.

      Return to “MIDIsense”