Introduction: Coffin Dance Music Using Arduino
In this tutorial I am how you can use an Arduino to make music using just with a speaker (no MP3 module required). First watch this video tutorial
Step 1: Watch This Video Tutorial
Step 2: Hardware Needed
2.A speaker or a buzzer
Step 3: Circuit Diagram
Just connect one wire of the speaker to D8 of the arduino and other end to grond of arduino
Step 4: How Does It Work?
The Arduino in this circuit creates tones of different frequencies and plays it through the speaker connected to it. The variation of the frequency of the tone(pitch) with correct timings(rhythm) creates music. The Arduino generates a signal and outputs it through the Digital pin 8. This drives the speaker connected to the pin to create sound.In this tutorial, I have programmed the Arduino to play a song ‘Astronomia coffin dance’.
Step 5: How I Made Melody[ ] and NoteDurations[ ] of This Song:
If you take a look at the program, you can find two int arrays: melody[ ] and noteDurations[ ]. The first array contains the notes and the second array contains its corresponding durations. I wrote down the musical notes of this song first and then wrote the melody[ ] array with that.
Then I wrote noteDurations[ ] according to the length of each music note. Here 8 = quarter note, 4 = 8th note, etc. A higher value gives longer duration notes. The note and its corresponding duration is what is there in melody[ ] and noteDurations[ ] respectively. You can modify those and create any song according to your ideas
Step 6: Code and Library
Participated in the
Audio Challenge 2020