31
5
Today, November 11, 2015, is Veterans Day in the United States. "Taps" is the bugle call played at U.S. military funerals:
("Taps" on SoundCloud from vtmiller)
It is a simple melody, only twenty-four notes long and using only four different notes. Here is the sheet music:
(source)
Challenge
Write a program or function that plays "Taps" or outputs an audio file of "Taps" in any common audio file format (e.g. MP3, WAV, MIDI). It may be played in any key, using any type of instrument or beep noise available to your language. For example, it might sound like a piano instead of a bugle. (Though still only one instrument type should be used.)
All twenty-four notes must be played with accurate pitch, duration, and spacing. Someone who is familiar with "Taps" should be able to run your code and easily recognize the song being played.
The duration of the melody (from the start of the first note to the end of the last note) must be between 30 and 70 seconds. You may optionally have up to 5 seconds of silence padding the start and/or end of your sound file, so an 80 second file is the longest allowed.
You may not, of course, simply download the song online somewhere or extract it from an audio library that happens to have it as as sample. You may, however, use audio libraries that can play/compose individual notes and create audio files.
Scoring
This is code-golf, so the shortest answer in bytes wins. However, for this particular challenge I encourage you to not focus on your byte count, especially at the expense of sound quality. Golf your submissions but allow yourself to be creative with your instrument choice or sound output methodology. This challenge is meant to be about honoring veterans, not about screeching out a barely recognizable version of "Taps".
Note that you can embed SoundCloud audio files directly into posts by just pasting the link on an empty line. If you have a SoundCloud account this would be a great way to share your output.
I'm thinking ChucK. – The_Basset_Hound – 2015-11-11T20:27:50.883
4Calvin, if you don't mind, I'll post a couple of golfy answers in old BASIC's and make a donation to a Veterans charity outside of PPCG. You have inspired me to do that. BTW in the UK we have Remembrance Sunday, the second Sunday in November, which means that this year it was last Sunday. One of my earliest memories is standing by a monument surrounded by poppies where 2 minutes of silence were observed. I was about 3. When I asked my mother why nobody was talking, she told me to be quiet. – Level River St – 2015-11-11T23:45:41.363
Are there any rules for the lengths of the fermatas? – SirPython – 2015-11-12T18:33:13.740
@SirPython I didn't even know what that symbol meant! According to https://en.wikipedia.org/wiki/Fermata "Exactly how much longer it is held is up to the discretion of the performer." Using discretion on the output doesn't really fit with codegolf, so I played it as written. I see where you're going though... Lengthening the dotted second note could compress the dotted eighth note down to a sixteenth note, making things simpler. But I think that's cheating :-)
– Level River St – 2015-11-12T21:36:57.283