-5
Your challenge is to play these notes (speakers or to a sound file) in this order:
C
A
F
G
Specifically, you must play these frequencies one after the other:
261.63 Hz
220.00 Hz
174.61 Hz
196.00 Hz
with an allowed error of +/- 5 Hz.
If you output to a file, please use a .ogg
or .mp3
, or raw bytes that can be fed to aplay. The notes must last at least 100ms, and less than 5s. They must be played for the same duration.
No, this is not a converter from notes to a sound file! You just need to play some frequencies!
8
Please consider using the Sandbox in the future to get feedback on your challenges before posting them to the main site.
– Mego – 2017-05-16T15:57:18.5532Part of the problem is probably that I had to look up chord, but even now that I did, I'm not sure how to translate chords into something a computer can understand, how C,Am,F,G is a transposition of F,Dm,A#,C, what exactly you mean by in any format, and which methods of "playing" are acceptable. – Dennis – 2017-05-16T15:58:25.770
2>
Also, define chord? Are you saying a standard 3 note chord? Can it be a separated chord? – Rɪᴋᴇʀ – 2017-05-16T16:04:35.757
@programmer5000 no, that's not what I mean by separated chord. For example, can we play
C7 Am F7 G
? What specific notes do the chords need to contain? Or can they be anything, as long as it's that base chord? – Rɪᴋᴇʀ – 2017-05-16T16:10:39.8233
This seems like a simpler version of https://codegolf.stackexchange.com/q/11463/194 or https://codegolf.stackexchange.com/q/272/194 and I'm not sure what it adds to the site.
– Peter Taylor – 2017-05-16T16:15:54.5704Play how? One after the other or all at once? For how long? Once or in a loop? Are these the only allowed frequencies? If not, which ones are allowed? Which formats for "sound files" are acceptable? – Dennis – 2017-05-16T17:55:52.647
2The challenge should contain all of the necessary information needed to craft a solution. Linking to another website that explains basic music theory is not acceptable, because of link rot. Challenges need to be self-contained, and explaining basic music theory (notes, frequencies, and chords) is really not difficult. – Mego – 2017-05-16T17:57:08.413
Also, what sound quality? Would a square wave do? – John Dvorak – 2017-05-16T17:57:16.647
@JanDvorak a square wave is fine. – programmer5000 – 2017-05-16T17:57:57.010
@Dennis is that better? – programmer5000 – 2017-05-16T17:58:30.740
You specified the spacing between notes, but not how long each of them should be. – John Dvorak – 2017-05-16T17:59:11.050
@JanDvorak It is ±10 Hz. – programmer5000 – 2017-05-16T18:06:37.023
1@programmer5000 put that in the question... – John Dvorak – 2017-05-16T18:07:10.367
@JanDvorak done. – programmer5000 – 2017-05-16T18:07:22.727
10 Hz seems like a very large variance to allow. That's nearly a half step either direction for each note. – Mego – 2017-05-16T18:08:59.970
@Mego now it's 5Hz. – programmer5000 – 2017-05-16T18:09:52.497
You might do better following this format https://codegolf.meta.stackexchange.com/a/1512/68029
– Notts90 supports Monica – 2017-05-16T18:35:35.347@Notts90 that's not going to help. His problem is underspecification, not bad formatting. – Rɪᴋᴇʀ – 2017-05-16T18:53:46.347
@Riker What is underspecifyed? – programmer5000 – 2017-05-16T18:54:51.527
2This turned out to be a dupe. ("Output a sound of a certain frequency") – Rɪᴋᴇʀ – 2017-05-16T18:58:06.233
@Riker I found the template and other FAQ bits helpful in making my question complete. Of course sandbox too. – Notts90 supports Monica – 2017-05-16T19:04:16.793
3Having read the history, I think it's sad what happened. You wanted chords, but nonmusicians didn't get it. Then you said it was OK to do either chords or just root notes (but chords need more code so why do them?) and nonmusicians were confused by transposition. Finally you restricted to one key, but tried to be flexible on octaves (but didn't explain that meant frequencies could be multiplied by powers of 2) so you were forced to restrict to a single octave. It's a good question but if it had been sandboxed it might've been received better in a form closer to your original intention. – Level River St – 2017-05-16T22:07:32.383
Back in the early days of the site, when popularity contests were allowed I wrote this https://codegolf.stackexchange.com/a/21690/15599 . It has a C G A F progression with broken fifth chords: (CG)8 (GD)8 (AE)8 (FC)8. There's no need to play the middle note of the chord: your brain interprets them as major or minor due to context.
– Level River St – 2017-05-16T22:23:31.520