5
$\begingroup$

How do I play the sound of $\pi$?

There is code for the sound of random integers in $(-1,1)$.

Sound[SoundNote[#, 0.12] & /@ Accumulate[RandomInteger[{-1, 1}, 100]]]

enter image description here

I tried:

Sound[SoundNote[#, 0.12] & /@ Accumulate[RealDigits[N[Pi, 100], 2]]]

enter image description here

but it doesn't work.

$\endgroup$
3
  • 1
    $\begingroup$ To mimic the random integer, you could try ternary digits minus 1: Accumulate[First@RealDigits[Pi, 3, 100] - 1]] $\endgroup$
    – wxffles
    Commented Mar 30, 2016 at 21:36
  • 1
    $\begingroup$ Sound[SoundNote[#, 0.12] & /@ Accumulate@First@RealDigits[N[Pi, 10], 2]] $\endgroup$ Commented Mar 30, 2016 at 21:37
  • $\begingroup$ Sound[SoundNote[#, 0.12] & /@ First@RealDigits[N[Pi, 100]]] directly turns the digits into MIDI note numbers. $\endgroup$
    – bill s
    Commented Mar 30, 2016 at 23:47

2 Answers 2

12
$\begingroup$

Here's how to "dial" the digits of $\pi$ on a touch tone phone (code adapted and modernized from an old Mathematica demo, but see this as well):

touchToneList = Tuples[{{697, 770, 852, 941}, {1209, 1336, 1477}}];
playTouchTone[phonenumber : {__Integer}] := Play[Evaluate[Piecewise[
    MapIndexed[{Total[Sin[2 π touchToneList[[#1]] t]],
                First[#2]/5 - 0.2 < t < First[#2]/5 - 0.1} &, 
               Mod[phonenumber, 11, 1]]]], {t, 0, Length[phonenumber]/5}]

playTouchTone[First[RealDigits[π, 10, 12]]]

dialing pi

$\endgroup$
1
$\begingroup$

Closer to the given example is the following:

Sound[SoundNote[#, 0.12] & /@ RealDigits[\[Pi], 10, 10][[1]]]

enter image description here

Note that using Accumulate in this context would lead to a constantly rising "tune", which is probably not what you want.

If you really want to make the serialists proud, use base-12 instead of base-10. (Note: relies on unproven assertions about whether π is a normal number in base-12.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.