Arduino MIDI Player

Ever wanted to make your Arduino play music? This project will show you how to do just that. Let’s get right to it…

What do you need?

  • Windows Computer
  • Arduino Integrated Development Environment
  • Arduino UNO Microcontroller
  • Speaker
  • THESE project files

 

Import Playtune Arudino Library

We’ll need to import an Arduino library that can interpret our MIDI file.

  1. Extract the project files

projectfiles

 

2. Open the Arduino IDE

arduino-ide-launch

 

3. Click Sketch > Include Library > Add .ZIP Library

Untitled drawing

4. Select the playtune.zip file from the selection dialog

 

Convert the MIDI file

  1. Move your MIDI file to the project folder or use the one provided.

2. Open a Windows Command Prompt and navigate to the project directory.

3. Execute the following command (be sure to omit the extension .mid from the input fileanme)

miditones -t3 <MIDI Filename without extension HERE>

 

Back to the IDE

  1. Open a new sketch in the Arduino IDE

arduino-ide-launch

 

2. Paste the code from song.c file into the new sketch and save it.

3. Replace the C source comment:

// Paste code _HERE_ from converted MIDI file

with the code from the converted midi file

4. Connect your Arduino, upload the sketch, and disconnect it from your computer.

 

Connect the connections

arduino-setup-midi

Connect pins 10, 11, and 12 into the positive wire of the speaker, and ground into the negative wire of the speaker. Once connected properly, connect power to your Arduino and you should hear music.

Advertisements

Comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s