Play[f,{t,tmin,tmax}]
creates an object that plays as a sound whose amplitude is given by f as a function of time t in seconds between tmin and tmax.
Play
Play[f,{t,tmin,tmax}]
creates an object that plays as a sound whose amplitude is given by f as a function of time t in seconds between tmin and tmax.
Details and Options
- Play returns a Sound object, which displays in StandardForm as a button that can be clicked to play the sound.
- Play treats the variable t as local, effectively using Block.
- Play has attribute HoldAll, and evaluates f only after assigning specific numerical values to t.
- In some cases it may be more efficient to use Evaluate to evaluate f symbolically before specific numerical values are assigned to t.
- The following options can be given:
-
DisplayFunction Automatic function for generating output to display PlayRange All the range of amplitude levels to include SampleDepth 8 how many bits to use to represent each amplitude level SampleRate 8000 how many times per second amplitude samples should be generated - Play[{f1,f2},{t,tmin,tmax}] produces stereo sound. The left‐hand channel is given first.
- Play[{f1,f2,…},…] generates sound output on any number of channels.
Examples
open all close allBasic Examples (1)
Scope (5)
Sound[{Play[Sin[1000t], {t, 0, 1}], Play[Sin[2000t], {t, 0, 1}]}]Play[Sin[2000(1 + Round[2 t, 0.1])t], {t, 0, 1}]Play[Sin[300t Sin[20t]], {t, 0, 1}]Play[FractionalPart[500t], {t, 0, 1}]Play[Sign[Sin[1000t]], {t, 0, 1}]Generalizations & Extensions (2)
Options (2)
PlayRange (1)
Applications (6)
Play[Sin[1000t] + Sin[1020t], {t, 0, 2}]Play the Riemann zeta function:
Play[RiemannSiegelZ[1000t], {t, 0, 1}]Play a sum of non-commensurate sine waves:
Play[Sum[Sin[1000 Sqrt[n] t], {n, 5}], {t, 0, 1}]A simple function that gives a "sound effect":
Play[Sum[Sin[1000 Sqrt[n] t(1 + Cos[n t])], {n, 10}], {t, 0, 1}]Sum of pure tones with changing frequencies:
Play[Sum[Sin[2000 2 ^ t n t], {n, 5}], {t, 0, 4}]Play[(2 + Cos[40t])Sin[2000t], {t, 0, 1}]Properties & Relations (2)
Play a waveform and a note-based sound in sequence:
Sound[{Play[Cos[50t]Sin[3000t], {t, 0, 1}], SoundNote[]}]Play the waveform and note at the same approximate time:
Sound[{Sound[Play[Cos[50t]Sin[4000t], {t, 0, 1}], {0, 1}], Sound[SoundNote[], {0, 1}]}]Tech Notes
Related Guides
Related Links
History
Introduced in 1991 (2.0) | Updated in 1996 (3.0) ▪ 2007 (6.0)
Text
Wolfram Research (1991), Play, Wolfram Language function, https://reference.wolfram.com/language/ref/Play.html (updated 2007).
CMS
Wolfram Language. 1991. "Play." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Play.html.
APA
Wolfram Language. (1991). Play. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Play.html
BibTeX
@misc{reference.wolfram_2026_play, author="Wolfram Research", title="{Play}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Play.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_play, organization={Wolfram Research}, title={Play}, year={2007}, url={https://reference.wolfram.com/language/ref/Play.html}, note=[Accessed: 12-June-2026]}