ARDUINO MUSIC PLAYER

239

5

2

Posted

Introduction: ARDUINO MUSIC PLAYER

Plays 8-bit PCM uncompressed files

just a few resistors, a capacitor and an SD card shield

audio output to any amplified speaker

Convert mp3 audio to raw 8bit PCM with audacity, the free audio editor

The program opens and reads a file named “AUDIO”. The audio file must be raw uncompressed data in 8-bit unsigned format at 44100 Hz. However, the audio produced by the analog port of the arduino is only 6-bit.

The program uses the ‘SdFat’ library but you can use the standard ‘SD’ that comes with the arduino IDE. Timer1 is set to cause an event every 22us. Don’t forget to change the divide by 4 line in the ISR function if you choose to use PORTD for 8-bit output. In that case you need a standalone controller on a breadboard so that the serial port connections to the USB-to-TTL controller do not interfere with the DAC out.

FILE CONVERSION PROCEDURE

1. open/import your audio mp3 file to audacity

2. Select from the menu ‘Tracks/Mix/Mix Stereo Down to Mono’

3. Select from the menu ‘Tracks/Resample’ and choose the 44100 entry

4. Optionally select from the menu ‘Effects/Amplify’ and arrange for the waveform peak amplitude to reach the upper and lower limits without clipping for best acoustic effect.

5. Select from the menu ‘Files/Export/Export Audio’ and choose type “other uncompressed files”, header “RAW header-less” and encoding “unsigned 8-bit PCM”. Finally, make sure the filename is “AUDIO” with no extension.

Step 1: SCHEMATIC AND CODE

Visit my site for updates and also other projects

https://www.sites.google.com/site/demeterart/

PDF

ARCHIVE with code and pdf

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Space Challenge

      Space Challenge
    • Science of Cooking

      Science of Cooking
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    If you are aiming to take on a project, and specifically use arduino, I'm sure this works fine.

    However if you are just looking to make a cost effective, functional mp3 stereo I'd suggest using this board

    https://www.amazon.co.uk/Bluetooth-decoder-lossles...

    or something similar and (if you arent already connecting to an amped speaker as per this project) an amp board like this

    https://www.amazon.co.uk/Amplifiers-Board-PAM8403-...

    or similar. I've recently made a project based in these boards and a pair of salvaged speakers and I know it reads any mp3 files you throw at it (with no need to reformat to mono) through either the usb or sd card ports, and also bluetooth to a good range.

    Just another option, depending on what you want to get out of the project.