loading

How to easily play music with buzzer on arduino (The imperial March - STAR WARS)

Picture of How to easily play music with buzzer on arduino  (The imperial March - STAR WARS)
Hi,I recently designed a sort of "library" in order to make easier to play exact notes on arduino with the buzzer.
I included the frequencies of the notes (pleasant to be heard) with #defines .
I then defined the value of the BPM ( you can modify it obviously) and according to that I defined the note values
( the most commonly used ones).
With this defines you can easyly play a note with the command "tone" like this:
tone(pin, note, duration)
eg:
tone(8,LA3,Q);
delay(1+Q);

the delay is important because thanks to that the note doesn't overlap possibly with the successive ones.
(the "1+" is one extra millisecond that i usually put to separate notes but you can avoid it if you prefer the notes to be continuous.

Here is the code:
ARDU NOTES
(http://tny.cz/d1a629c1)

Step 1: Example: The imperial march

Picture of Example: The imperial march
With a lot of effort I did it!
I wrote the code for the first part of the imperial march... so cool !

HERE IS THE CODE:
The Imperial March

and a video that I made:
 
AWESOME
NurullahM2 days ago

i made this. thanks

ahui68 days ago

U R A FREAKING GENUUUUUUUUUUISSSSSSSS

Dklawz18 days ago

Thanks a million. Now I can incorporate this tune with the paper craft Darth Vader bust which I will be assembling.

MakerManiac made it!1 month ago

I made it! It was a very fun and entertaining project. Thanks for sharing it!

ImperialMarch.PNG
Murcielago383 months ago

This was a very entertaining compilation and I can only imagine how long it took to figure out all of the frequencies. Stay Imperial! ;)

ohoilett made it!7 months ago

This was really helpful for what I need to do. I actually put together a MusicPlayer library based on this. Here is the link

https://drive.google.com/open?id=0BxuS3a9LkLcBRjJJ...

It's pretty simple. If you have any feedback that would be great.

MusicPlayer.JPG
chadS1 ohoilett5 months ago

My daughter got a kick out of this. Thank you so much for putting it together.

ohoilett chadS15 months ago

Yeah for sure. Glad it worked out for you.

rimolive made it!8 months ago

I have plans to come to the dark side after running the sketch. Good job, and may the force be with you.

IMG_20141129_231129201.jpg

Great job. Simple and nice. I just tryied it and it worked easy and at the first attempt ;-)

CPUCHE1 year ago

Hi!!!

I want to do something like that. I don't know if you can help me.

I have the melody and the sheet music, but I need to know the notes for arduino... just like you did.

this are the links:

https://www.youtube.com/watch?v=vJMvCEaOpyw Until sec 28.

http://ebookbrowsee.net/gdoc.php?id=399890027&url=... Only the first page. This is the link in Youtube: https://www.youtube.com/watch?v=vq7HOgjPZXU Until sec 16.

Thanks for your help. I'll be waiting for your reply :)

I think this is what you need http://arduino.cc/en/Reference/Tone,yuomay want to check http://arduino.cc/en/Reference/HomePage

alopes81 year ago
AMAZING DUDE!
alopes81 year ago
AMAZING DUDE!
alopes81 year ago
AMAZING DUDE!
Hey that video is set to private, mind making it public?
eserra (author)  audreyobscura1 year ago
done ;) thanks