Play melodies based on the digits of π.
Run the code to create a musical note. Click Play to hear the sound it makes. Try other note numbers:
SoundNote denotes a musical note. Pitch 0 is middle C:
SoundNote by itself doesn’t make a sound. Put it inside Sound to make a playable note (click the Play button to play the note):
Play the note immediately with EmitSound:
Play a melody. Try other sequences of notes:
Play a sequence of notes by putting them in a list (indicated by the curly braces):
If you don’t specify otherwise, each note is played for 1 second. To make the melody play faster, specify the duration of the entire sequence in seconds:
A more compact way of writing a sequence of notes uses /@ (Map):
Play a sequence of notes using Map:
This is how the note numbers correspond to piano keys:
Get the first 12 digits of π. Try longer or shorter sequences:
This gives a list of the first 12 digits of π (in base 10), plus the number of digits to the left of the decimal point:
Use First to get just the digits:
Play the first 12 digits of π. Try longer or shorter sequences:
This plays a sequence of 3 notes:
Replace the note sequence with the digits of Pi to play them as notes:
Play the digits of π on a marimba. Try other instruments, such as "Clarinet", "Trumpet" or "ElectricPiano":
Use Style to specify what instrument to play the notes on:
Here’s a list of the available instruments: