The carols
And here are some carols that I've just encoded.
(German: Stille Nacht, French: Douce Nuit, Italian: Astro del ciel)
Popular Christmas carol, composed in 1818 by Franz Xaver Gruber to lyrics by Joseph Mohr. It was declared an intangible cultural heritage by UNESCO in March 2011.
This is one of the most known Christmas carols. It was written by James Lord Pierpont (1822–1893) and published under the title "One Horse Open Sleigh" in the autumn of 1857.
Download this tone music for Arduino here.
Another very popular carol first appeared in 1739 in the collection "Hymns and Sacred Poems" by Charles Wesley. Successively, it has been adapted by many musicians among which we also find Felix Mendelssohn and William H. Cummings.
Download this tone music for Arduino here.
The sketch
In order to run the sketch for playing tone music with your Arduino, you need to download the following header files: pitches.h, durations.h
/* * Adapted by Enrico Formenti * from an original sketch by Tom Igoe * * BSD license, check license.txt for more information * All text above must be included in any redistribution. * * See macduino.blogspot.com for more details. */ #include "pitches.h" #include "durations.h" #include "SilentNight.h" #define TONEPIN 8 void setup() { for (int curNote = 0; curNote < melody_len; curNote++) { if(melody[curNote]) tone(TONEPIN, melody[curNote],noteDurations[curNote]); else { noTone(TONEPIN); delay(noteDurations[curNote]); } // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: delay(noteDurations[curNote] * 1.3); // stop the tone playing: noTone(TONEPIN); } } void loop() { // no need to repeat the melody. }
The circuit
It is a real Arduino's classic. You need:
- 1KΩ resistor 1/4W
- 8Ω 1/4W loudspeaker
- your Arduino and 3 cables
What's next
Indeed, I'm translating lots of tone music of various genres. So expect a post with lots of new music tones! In the meanwhile, you can send me your own, I will publish and credit all of them!
See also
Tone music: advanced playing software
Tone music: how to encode melodies
Tone music: changing the Tempo of your melodies
Credits
The image opening this post comes from Amagico.com website and according to them it is believed to be in the public domain. The icons illustrating the three tone musics come from Wikipedia.com
No comments :
Post a Comment