Yup, you read the title right. play the sound of pi.
More specifically, for every digit of pi in the first 1000, map it to a musical note and output the resulting melody to a file.
Basically, each digit turns to a note on the C Major scale (basically the normal scale). so 1 turns to Middle C, 2 turns to D4, 3 turns to E4, 9 turns to D5 and so on.
Rules
- Each note should be exactly 0.5 seconds long.
- The melody should contain the first 1000 digits of pi, including the starting 3.
- 1 to 7 represent Middle C to B4, 8 is C5, 9 is D5 and 0 is E5
- All well supported file formats are allowed, as long as they were created before this challenge.
- There may be no pauses anywhere in the file, including the start and end.
- The instrument played does not matter. It could be a piano, sine wave, anything really, as long as the correct sound is easily hearable.
- It must take no input and produce no output except for the file. Reading from other files is disallowed.
- Standard loopholes are forbidden.
Example mathematica code:
(*please forgive me for this horrible, horrible mess of code*)
digits = RealDigits[Pi, 10, 1000][[1]] /. {0 -> 10};
weights = {0, 2, 4, 5, 7, 9, 11, 12, 14, 16};
melody = {};
For[i = 1, i < 1001, i++, melody = {melody , Sound[SoundNote[weights[[digits[[i]]]], 0.5]]}]
final = Sound[Flatten[melody]];
Export["C:\\Mathematica Shenanigans\\pi.wav", final];
Example melody showing first 100 digits: http://vocaroo.com/i/s0cfEILwYb8M
For your sanity, A table of pitches for each note and what note does each digit represent:
Digit 1: C: 261.63 Hz
Digit 2: D: 293.66 Hz
Digit 3: E: 329.63 Hz
Digit 4: F: 349.23 Hz
Digit 5: G: 392.00 Hz
Digit 6: A: 440.00 Hz
Digit 7: B: 493.88 Hz
Digit 8: C5: 523.25 Hz
Digit 9: D5: 587.33 Hz
Digit 0: E5: 659.25 Hz
4
-th octave. Also, in your table does digit0
come last (E5
)? \$\endgroup\$