Sound
Details and Options
- Lists containing the following primitives can be used:
-
SampledSoundFunction[f,n,r] amplitude levels generated by a function SampledSoundList[{a1,a2,…},r] amplitude levels given in a list SoundNote[spec,…] a music-like note MusicNote[…] a symbolic music note MusicChord[…] a symbolic music chord MusicScore[…] a symbolic music score Sound[prims,t] a sound scaled to have duration t Sound[prims,{tmin,tmax}] a sound played over the time interval tmin to tmax - Primitives with duration specifications are played consecutively in sequence, independent of primitives with explicit time specifications.
- When primitives prims appear in Sound[prims,tspec], the sequence of durations and time specifications in prims are rescaled and shifted to fit into the time interval defined by tspec.
- For the outermost Sound object, times are by default taken to be given in absolute seconds.
- For inner Sound objects, times can be given as Scaled[r].
- Sound[prims,Scaled[r]] will slow down prims by a factor r.
- Mixed into lists of sound primitives can be the following SoundNote directives:
-
"style" use the specified style opt->value use the specified option setting - The possible styles and options are those for SoundNote.
- Nested lists of sound primitives and directives can be given. Directive specifications normally remain in effect only until the end of the list which contains them.
- A list containing only sound directives is treated as if its elements were directly inserted into an enclosing list.
- Style[obj,opts] can be used to apply the options or directives opts to obj.
- Sound can be played using EmitSound.
- Sound[…] is displayed in StandardForm as a button containing a graphic representing the sound. Clicking the button plays the sound, preempting any other sounds that are already playing.
- In InputForm, Sound[…] is displayed as an explicit list of primitives.
- The option SoundVolume->v specifies a relative sound volume v for a note.
- The following options can be given:
-
SoundVolume 1 relative sound volume
Examples
open all close allBasic Examples (2)
Scope (7)
Time Sequences (5)
Represent a sequence of notes, with each note taking 1 second:
Sound[Table[SoundNote[i], {i, 0, 12}]]Represent a sequence of notes, with the whole sequence lasting 1.5 seconds:
Sound[Table[SoundNote[i], {i, 0, 12}], 1.5]Represent a sequence of notes to be played between
and
:
s1 = Sound[Table[SoundNote[i], {i, 0, 12}], {0, 1.5}]Represent a sequence of notes to be played between
and
:
s2 = Sound[Table[SoundNote[12 - i], {i, 0, 12}], {0.5, 2}]Combine the two sound sequences:
Sound[{s1, s2}]Superimpose three time-warped versions of a sound:
s = Sound[Table[SoundNote[i], {i, 0, 12}], 1]Sound[{Sound[s, {0, 2}], Sound[s, {.5, 1.5}], Sound[s, {.7, .9}]}]Use a list of MusicNote objects:
Sound[Table[MusicNote[i], {i, 65, 70}]]Style Directives (2)
Represent a sequence of notes to be rendered in accordion style:
Sound[{"Accordion", Table[SoundNote[i], {i, 5}]}]Combine two note sequences with different instrument styles:
s = Sound[Table[SoundNote[i], {i, 0, 12}], 1]Sound[{"Flute", Sound[s, {0, 1}], "Trumpet", Sound[s, {.2, 1.3}]}]Applications (3)
Create an algorithmic composition from a cellular automaton pattern:
Sound[SoundNote[DeleteCases[3 Range[21]Reverse[#], 0] - 24, .1]& /@ Transpose[CellularAutomaton[90, {{1}, 0}, 20]]]Generate a simple WolframTones-like composition:
Sound[SoundNote[#, 1 / 6, "Warm"]& /@ (Pick[{0, 5, 9, 12, 16, 21}, #, 1]& /@ CellularAutomaton[30, {{1, 0, 0, 0, 0, 0}, 0}, 13, {13, 5}])]data = SystemDialogInput["RecordSound"]Squash the sound to play over 0.8 seconds:
Sound[data, .8]Possible Issues (1)
Passing music primitives directly to sound will convert them to SoundNote objects:
Sound[MusicNote["D"]]//InputFormSound[MusicScore[{"C", "D", "G", "F"}]]//InputFormWrapping music objects in lists will preserve them:
Sound[{MusicNote["D"]}]//InputFormSound[{MusicScore[{"C", "D", "G", "F"}]}]//InputFormNeat Examples (1)
Play a random sequence of notes from different instruments:
Sound[SoundNote[#, 1, RandomChoice[{"Piano", "Cello", "Tuba"}]]& /@ RandomInteger[12, 30], 4]Make each note have a random duration:
Sound[SoundNote[#, RandomReal[2], RandomChoice[{"Piano", "Cello", "Tuba"}]]& /@ RandomInteger[12, 30], 4]See Also
SoundNote SampledSoundList SampledSoundFunction EmitSound ListPlay Play MusicScore MusicNote MusicChord Import Export Graphics Speak Audio
Function Repository: MusicalScaleSample
Tech Notes
Related Guides
Related Workflows
- Record a Sound
Related Links
History
Introduced in 1991 (2.0) | Updated in 2026 (15.0)
Text
Wolfram Research (1991), Sound, Wolfram Language function, https://reference.wolfram.com/language/ref/Sound.html (updated 2026).
CMS
Wolfram Language. 1991. "Sound." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. https://reference.wolfram.com/language/ref/Sound.html.
APA
Wolfram Language. (1991). Sound. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sound.html
BibTeX
@misc{reference.wolfram_2026_sound, author="Wolfram Research", title="{Sound}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/Sound.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sound, organization={Wolfram Research}, title={Sound}, year={2026}, url={https://reference.wolfram.com/language/ref/Sound.html}, note=[Accessed: 13-June-2026]}