An Elementary Introduction to the Wolfram Language
12Sound
In[1]:=
Click for copyable input
Out[1]=
You can specify a sequence of notes by giving them in a list.
Play three notes in sequence:
In[2]:=
Click for copyable input
Out[2]=
Specify the notes by numbers:
In[3]:=
Click for copyable input
Out[3]=
Use Table to generate a sequence of 5 notes:
In[4]:=
Click for copyable input
Out[4]=
Play each note for 0.1 seconds:
In[5]:=
Click for copyable input
Out[5]=
In addition to piano, SoundNote can handle a long list of possible instruments. The name of each instrument is a string.
In[6]:=
Click for copyable input
Out[6]=
Play a sequence of 20 notes with random pitches:
In[7]:=
Click for copyable input
Out[7]=
12.1Generate the sequence of notes with pitches 0, 4 and 7. »
Expected output:
Out[]=
12.2Generate 2 seconds of playing middle A on a cello. »
Expected output:
Out[]=
12.3Generate a riff of notes from pitch 0 to pitch 48 in steps of 1, with each note lasting 0.05 seconds. »
Expected output:
Out[]=
12.4Generate a sequence of notes going from pitch 12 down to 0 in steps of 1. »
Expected output:
Out[]=
12.5Generate a sequence of 5 notes starting with middle C, then successively going up by an octave at a time. »
Expected output:
Out[]=
12.6Generate a sequence of 10 notes on a trumpet with random pitches from 0 to 12 and duration 0.2 seconds. »
Sample expected output:
Out[]=
12.7Generate a sequence of 10 notes with random pitches up to 12 and random durations up to 10 tenths of a second. »
Sample expected output:
Out[]=
12.8Generate 0.1-second notes with pitches given by the digits of 2^31. »
Expected output:
Out[]=
12.9Create a sound from the letters in CABBAGE, each playing for 0.3 seconds sounding like a guitar. »
Expected output:
Out[]=
12.10Generate 0.1-second notes with pitches given by the letter numbers of the characters in wolfram»
Expected output:
Out[]=
+12.1Generate a sequence of three notes of 1 second of playing middle D on the cello, piano and guitar.  »
Expected output:
Out[]=
+12.2Generate a sequence of notes from pitch 0 to pitch 12, going up in steps of 3.  »
Expected output:
Out[]=
+12.3Generate a sequence of 5 notes starting with middle C, then successively going up by a perfect fifth (7 semitones) at a time.  »
Expected output:
Out[]=
+12.4Generate 0.02-second notes with pitches given by the lengths of the names of integers from 1 to 200. »
Expected output:
Out[]=
How do I know which instruments are available?
Look at the list under Details and Options in the SoundNote reference page, or just start typing and see the completions youre offered. You can also use instrument numbers, from 1 to 128. All the standard MIDI instruments are there, including percussion.
How do I play notes below middle C?
Just use negative numbers, like SoundNote[-10].
What are sharp and flat notes called?
E# (E sharp), Ab (A flat), etc. They also have numbers (e.g. E# is 5). The # and b can be typed as ordinary keyboard characters (though special and characters are available too).
Why do I need quotes in the name of a note like C?
Because the name is a Wolfram Language string. If you typed just C, it would be interpreted as a function named C, which isnt what you want.
 
Download Notebook Version