AudioPlay

AudioPlay[audio]

returns a new AudioStream object from audio and starts the playback.

AudioPlay[astream]

starts playing an AudioStream object astream.

Details and Options

  • AudioPlay can be used to perform programmatic audio playback.
  • In AudioPlay[audio], AudioOutputDevice and SoundVolume are inherited from audio.
  • AudioPlay will continually change the "Position" property of astream starting from the current position.
  • If astream is connected to an input device, AudioPlay plays the current signal being captured.
  • AudioPlay by default plays the entire stream until paused, stopped or finished.
  • The following options can be specified:
  • Looping Automaticwhether to loop the playback
    MaxDuration Infinitymaximum playback duration
  • AudioPlay continues to play until either MaxDuration is reached or the maximum number of loops is played.

Examples

open allclose all

Basic Examples  (1)

Create an AudioStream object and start the playback:

Scope  (4)

Play an existing AudioStream object:

Play the stream:

Create two separate streams from an audio object:

The two streams are independent. Play one after 0.5 seconds from the beginning of the other one:

Create a stream from a list of audio objects:

Play the whole stream:

Generate an infinite audio stream from a function:

Generate and play the stream:

Stop the stream:

Options  (2)

Looping  (1)

By default, Looping is 1:

Play the stream twice:

The value of the Looping option does not need to be an integer:

MaxDuration  (1)

By default, MaxDuration is :

Play only the first two seconds:

Applications  (1)

Build a basic GUI:

Wolfram Research (2017), AudioPlay, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioPlay.html (updated 2020).

Text

Wolfram Research (2017), AudioPlay, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioPlay.html (updated 2020).

CMS

Wolfram Language. 2017. "AudioPlay." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/AudioPlay.html.

APA

Wolfram Language. (2017). AudioPlay. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioPlay.html

BibTeX

@misc{reference.wolfram_2024_audioplay, author="Wolfram Research", title="{AudioPlay}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/AudioPlay.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_audioplay, organization={Wolfram Research}, title={AudioPlay}, year={2020}, url={https://reference.wolfram.com/language/ref/AudioPlay.html}, note=[Accessed: 21-November-2024 ]}