Arduino Audio Player: Best tutorial for playing audio files!

From our STAR Maker : Sarvagnya Purohit

Arduino Audio

This Arduino project is one of the most simple and fun projects you can build with Arduino in 10-15 minutes. The result of this make will be an Arduino Audio Player which will play “.wav” files. It consist of a speaker, a simple transistor acting as an amplifier and a micro-SD card adapter with a micro-SD in it through which the .wav files are loaded and played.

What are the stuff required to make this?


  1. Arduino Uno (Any other Arduino except Duo will work)
  2. Micro-SD card adapter
  3. 8-ohms speaker
  4. Micro-SD Card
  5. Mini Breadboard
  6. BC 546b NPN transistor
  7. 7k Resistor
  8. Male-to-male jumpers


How does it work?

The Arduino in the below circuit loads the .wav files from the micro-SD card. It then generates a signal and outputs it through the speaker connected to digital pin 9. This makes the speaker create sounds and play music. It can play many different songs saved on the micro-SD card. In this tutorial, I have programmed the Arduino Audio Player to play the famous song ‘Rain Over Me”, by Pitbull and Marc Anthony.

The .wav files used in this circuit have a slight limitation in playing audio. As a transistor is used as an amplifier, it cannot read much complex .wav files. Therefore, the .wav files should be converted to:

-Samples Per second (Hz): 16000
-Channel : Mono
-Bits Per Sample: 8

Step 1: Converting files to much detailed .wav file format for your Arduino Audio Player

You don’t need any software to install in order to convert the songs to .wav files. There is an online music converter to do the work. The link is :

Follow the steps given below to make songs compatible with your Arduino audio player:

  1. Upload a music file or enter a link for the song or music file to be converted. You can even choose files from Dropbox or Google Drive.
  2. In optional settings, change bit resolution to 8 bit.
  3. Change sampling rate to 16000 Hz.
  4. Change audio channels to Mono.
  5. Click on Show advanced options.
  6. Select PCM format as PCM unsigned 8-bit.
  7. Click on Convert and the files are converted!

Arduino Audio

Step 2: Formatting a micro-SD card

  1. Download the SD Formatter tool from
  2. Run the tool as administrator.
  3. Select the proper drive to format. Give the card your favourite name by writing it on Volume label and click on the “Format” button. It will prompt you a couple of dialogues. Click on them and your card will be formatted perfectly.
  4. Add the previously converted .wav files to the card and save them with simple names such as ’81.wav’.

Arduino Audio

Step 3: Preparing the circuit

Arduino Audio

MOSI – pin 11 on Arduino Uno/Duemilanove/Diecimila
MISO – pin 12 on Arduino Uno/Duemilanove/Diecimila
CLK – pin 13 on Arduino Uno/Duemilanove/Diecimila
CS – depends on your SD card shield or module.
Pin 4 is used here for consistency with this Arduino code

Step 4: Connect the Arduino and upload the code

Arduino Audio

The code is as follows:

#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

void setup(){
tmrpcm.speakerPin = 9;
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");


void loop(){  }

Plug in the power and you have your Arduino Audio Player successfully playing Rain Over Me. Feel the happiness with the energetic starting lines, “Girl my party don’t lie”!!!!! :)

You can check the working demo below :

Thank You.

Sarvagnya Purohit-min

Sarvagnya Purohit – STAR Maker at DIY Hacking

About the maker :

Sarvagnya Purohit is a 13 year old passionate maker from Thane, Mumbai with much experience in Arduino and Raspberry Pi. He is a tech enthusiast and has interests in robotics, IOT, 3d printing, coding and Rubik’s cube solving.

Recommended Posts
Showing 9 comments
  • Tejasurya Mouli

    I’m getting static buzzing sound when i connect the speaker, what can be the problem here? pls help

  • Derek States

    I’m new to Arduino, but you say that the circuit will output audio through a speaker connected to digital pin 9, but, in the diagram, you don’t have anything connected to digital pin 9. Is there another step that I am unaware of?

  • Kyle

    I’m still a bit new to Arduino. Would an Arduino Nano be able to do this as well? And do you know of any way to play multiple audio files? Like, have a short audio file that plays at the press of one button and a different file that plays when you press another.

  • saad

    hi .. can u please upload a clear crcuit diagram as i am new to arduino and cannnot understand the wiring . thank you

  • Chris

    BC 546b NPN transistor? What is that? I cannot find it on Is there some other name for this part? Thanks.

    • Sarvagnya Purohit

      Sorry btw for the late reply as I was busy in my 9th standard exams. You can buy these specific value transistors in a local electronic, electrical, hardware, hobby, etc. shop but not on Amazon. You can find them on internet or Sparkfun as Amplifier Transistors. You can buy it at Mouser on the following link :
      Thank you for watching.

  • srp

    Is there any way to play mp4 format in audrino

    • Sarvagnya Purohit

      You mean “mp4”? Means even videos? You can rather do that by using a TVOUT library of Arduino through which you can get the video output and the above tutorial is enough for the audio part! Sorry btw for the late reply as I was busy in my 9th standard exams.

  • Ken L

Leave a Comment

44 − = 43

Start typing and press Enter to search