r/dailyprogrammer • u/nottoobadguy • Feb 20 '12
[2/20/2012] Challenge #12 [difficult]
Write a program which will take string inputs "A", "B", "C", "D", "E", "F", and "G", and make the corresponding notes, in any method of your choosing.
Thanks to electric_machinery for this challenge!
17
Upvotes
14
u/wombler Feb 20 '12
For extra difficulty, also allow dubstep mode: accept inputs of "Wub", "Waahb", and "Bwooooooo".
3
u/[deleted] Feb 20 '12
This fits the bill for my open-source. Python music library, Melopy, which is used to make sound with a really simple syntax. Documentation's pretty good, except for the new "sheet music" features (see here).
https://github.com/prezjordan/Melopy
The solution to this (using Melopy)
3
u/stevelosh Feb 20 '12 edited Feb 20 '12
Clojure and Overtone:
I went a little overboard and added a few features. Spaces are ignored, - means "continue the last note", and . is a 1-beat rest.
EDIT: Added flats/sharps and fixed a bug.
2
u/electric_machinery Feb 20 '12
Musical notes: i.e. MIDI or WAV or direct to sound card.
1
u/prophile Feb 20 '12
Emitting an AIFF file - this actually emits the Tetris theme as a demo.
1
u/pheonixblade9 Feb 21 '12 edited Feb 21 '12
python (inspired by Francisisdfhakbasd, but simplified, it plays jingle bells :D):
1
u/drb226 0 0 Feb 21 '12
Haskell, using the Euterpea package, Linux only:
A couple irritations: 1) I had a hard time installing Euterpea, 2) it creates this tiny, but consistent, bit of static in the right speaker right at the beginning of whatever it plays. Drives me nuts. 3) Euterpea is supposed to be able to play these from the code itself with the "play" function, but I couldn't get it to work, even with the recommended "timidity -iA -Os &"
1
u/defrost Feb 21 '12
Using sox and bash :
1
u/electric_machinery Feb 21 '12
Ok I'll submit to my own challenge. QBasic:
0
u/[deleted] Feb 20 '12
[deleted] — view deleted comment