27
6
Write a program to play the popular English nursery rhyme.
(This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. Attribution: Helix84 at the English language Wikipedia; Blahedo at the English language Wikipedia.)
Some Wikipedia articles that may be useful:
- Twinkle Twinkle Little Star (has an audio clip of what your program's output should sound like)
- Modern musical symbols (to learn about the music notation used above)
- Note#Note frequency (hertz) (the formula for calculating the frequency of each note)
Some guidelines for your submission:
Your program must use the computer's sound card. If your programming language doesn't have convenient access to audio hardware, your program must create an output file in some standard format such as WAV or MIDI.
Your program must actually generate its output. For example, embedding the Ogg Vorbis file from Wikipedia would not be allowed.
The audio quality must be acceptable. At the very least, the song should be easily recognizable. Preferably, it should sound good as well.
The focus should be on code size, sound quality, or both (explain which one you decided on). Elegant solutions would also be great. Have fun!
This is a code-golf, so shortest code wins
1Why is this closed? – programmer5000 – 2017-05-16T18:12:29.163
@programmer5000 I'd say the close reason describes it extremely well... – totallyhuman – 2017-09-28T10:58:34.920
2Even after making it code golf, I'd say this is still off topic. The audio quality must be acceptable. is not an objective validity criterion. – Dennis – 2017-09-28T15:46:55.700
3@Dennis I'd say that's more like "unclear" rather than "off-topic". – Erik the Outgolfer – 2017-09-28T17:45:05.060
can I approximate note frequencies? – Ming-Tang – 2011-05-20T04:06:50.490