AudioStream
✖
AudioStream
Details and Options




- AudioStream is a handle to an Audio object or a device to programmatically control playback or recording of audio signals.
- The source can be either of the following:
-
audio a stream to play back a single audio signal {audio1,audio2,…} a stream to play back a list of audio signals func a stream generated from the function func dev a stream recorded from the audio input device dev - The function func operates on a buffer of time values and for each time it should return a scalar or a vector of numeric values.
- Use AudioPlay to start playing back the stream.
- Use AudioRecord to start recording the stream.
- Use AudioPause or AudioStop to pause or stop the playback or the recording.
- The dev can be any available input audio device from $AudioInputDevices.
- Use Audio[astream] to create an Audio object from a recorded stream.
- The following options can be specified:
-
AudioChannelAssignment Inherited how to assign audio channels to outputs AudioOutputDevice Inherited audio output device to use for playback Looping False whether to loop the playback SampleRate Automatic sampling rate SoundVolume Automatic sound volume - A property of an audio stream astream can be obtained using astream["prop"].
- It is possible to set values of properties with astream["prop"]=val.
- Some properties of the playback stream include:
-
"AudioChannelAssignment" how to assign audio channels to outputs "AudioOutputDevice" audio output device to use for playback "BufferSize" number of samples in each buffer "CurrentAudio" snippet of the current audio "ID" the stream ID "Looping" whether to loop the playback "Position" position of the playback given as a time Quantity "SampleRate" number of samples per second "SoundVolume" sound volume "Status" status of the stream - Possible settings for "Status" include "Playing", "Recording", "Paused" or "Stopped".
- Additional properties for AudioStream[{audio1,audio2,…}]:
-
"CurrentTrack" index of the track being played "Ordering" ordering used to play back tracks "Duration" duration of the current tracks "Durations" durations of all tracks "TrackCount" number of tracks - Additional property for AudioStream[func]:
-
"Function" the generator function - Additional properties for AudioStream[dev]:
-
"AudioInputDevice" audio input device to use for recording "GeneratedAssetLocation" path to the file that will store the recorded audio "RecordedAudio" an Audio object containing the recording - Functions such as Join, Append, AppendTo and Drop can be used to modify an AudioStream object.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Create an AudioStream object from an audio object:

https://wolfram.com/xid/0rs4qh5ye-8sgxqm


https://wolfram.com/xid/0rs4qh5ye-e0cie8

Create an AudioStream object from an input device:

https://wolfram.com/xid/0rs4qh5ye-3urexi


https://wolfram.com/xid/0rs4qh5ye-c9tl4s


https://wolfram.com/xid/0rs4qh5ye-l4sgth
Create an AudioStream object from a function:

https://wolfram.com/xid/0rs4qh5ye-8qtf8a

Play the AudioStream:

https://wolfram.com/xid/0rs4qh5ye-jqnj5e


https://wolfram.com/xid/0rs4qh5ye-xdndw5
Scope (17)Survey of the scope of standard use cases
Basic Uses (5)
Create two separate streams from an audio object:

https://wolfram.com/xid/0rs4qh5ye-yj6vpv


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

https://wolfram.com/xid/0rs4qh5ye-2d9hmz
Check for available stream properties:

https://wolfram.com/xid/0rs4qh5ye-mozlqk

Get the property values of an audio stream:

https://wolfram.com/xid/0rs4qh5ye-k75xq8


https://wolfram.com/xid/0rs4qh5ye-6igjw1


https://wolfram.com/xid/0rs4qh5ye-dvisd7


https://wolfram.com/xid/0rs4qh5ye-xdd85m

Modify properties while playing an audio stream:

https://wolfram.com/xid/0rs4qh5ye-owmsd1


https://wolfram.com/xid/0rs4qh5ye-0v8vd0
The buffer size is inherited from the system option:

https://wolfram.com/xid/0rs4qh5ye-5pr14b

Playback Streams (7)
Inspect the properties of an AudioStream created from an Audio object:

https://wolfram.com/xid/0rs4qh5ye-yfgc0m


https://wolfram.com/xid/0rs4qh5ye-x5l8nz


https://wolfram.com/xid/0rs4qh5ye-zh9lue

Create an AudioStream from a list of Audio objects:

https://wolfram.com/xid/0rs4qh5ye-76ne9r


https://wolfram.com/xid/0rs4qh5ye-3hv4gf

Inspect the properties of an AudioStream created from a list of Audio objects:

https://wolfram.com/xid/0rs4qh5ye-mnvoho

Get the list of available properties:

https://wolfram.com/xid/0rs4qh5ye-c31uuu

Get the values for all available properties:

https://wolfram.com/xid/0rs4qh5ye-4rhzqa

Create an AudioStream from a list of Audio objects and specify an ordering:

https://wolfram.com/xid/0rs4qh5ye-oues1


https://wolfram.com/xid/0rs4qh5ye-p3ji3h

Play the stream with the specified ordering:

https://wolfram.com/xid/0rs4qh5ye-8vy7kr

Create an AudioStream from a list of Audio objects and set some of the properties:

https://wolfram.com/xid/0rs4qh5ye-zu7vt2

Change the "CurrentTrack" property and play the AudioStream:

https://wolfram.com/xid/0rs4qh5ye-r7wrb4


https://wolfram.com/xid/0rs4qh5ye-jux061

Audio streams can be extended using Append. Generate an audio stream of two audio signals:

https://wolfram.com/xid/0rs4qh5ye-nfljxx


https://wolfram.com/xid/0rs4qh5ye-3w8tuu
Append the new audio signal to the stream:

https://wolfram.com/xid/0rs4qh5ye-ewj1n6


https://wolfram.com/xid/0rs4qh5ye-s4cd93

Play back the resulting stream:

https://wolfram.com/xid/0rs4qh5ye-pths14
Audio streams can be combined. Generate two audio streams:

https://wolfram.com/xid/0rs4qh5ye-8mcp41


https://wolfram.com/xid/0rs4qh5ye-pawg3b


https://wolfram.com/xid/0rs4qh5ye-dlohpl


https://wolfram.com/xid/0rs4qh5ye-q8rsfo

Play back the resulting stream:

https://wolfram.com/xid/0rs4qh5ye-neckq1
Generator Streams (4)
Inspect the properties of an AudioStream created from a function:

https://wolfram.com/xid/0rs4qh5ye-f52a46


https://wolfram.com/xid/0rs4qh5ye-bsfjxu


https://wolfram.com/xid/0rs4qh5ye-8q0w9q

Create an AudioStream from a function and record the generated signal:

https://wolfram.com/xid/0rs4qh5ye-1rq1ca


https://wolfram.com/xid/0rs4qh5ye-udd92r

https://wolfram.com/xid/0rs4qh5ye-ibx4f4

With functions that return arrays of depth 2, the first dimension is interpreted as the number of channels:

https://wolfram.com/xid/0rs4qh5ye-rxqgyg


https://wolfram.com/xid/0rs4qh5ye-u4yt6r
Create an AudioStream from a function:

https://wolfram.com/xid/0rs4qh5ye-zrpaax

Change the function during playback:

https://wolfram.com/xid/0rs4qh5ye-yp1vsl


https://wolfram.com/xid/0rs4qh5ye-g625us
Input Streams (1)
Inspect the properties of an AudioStream created from an input device:

https://wolfram.com/xid/0rs4qh5ye-opfye6


https://wolfram.com/xid/0rs4qh5ye-6yjt2u


https://wolfram.com/xid/0rs4qh5ye-ndx64e

Options (6)Common values & functionality for each option
AudioChannelAssignment (1)
By default, the AudioChannelAssignment is inherited from the corresponding Audio object:

https://wolfram.com/xid/0rs4qh5ye-tauc01

https://wolfram.com/xid/0rs4qh5ye-zlb8ul


https://wolfram.com/xid/0rs4qh5ye-gt2m55

It is possible to set the AudioStream to a different channel assignment:

https://wolfram.com/xid/0rs4qh5ye-4aumwk

https://wolfram.com/xid/0rs4qh5ye-t453az

Note that the channel assignment of the original audio object stays the same:

https://wolfram.com/xid/0rs4qh5ye-mo748c

AudioOutputDevice (1)
By default, the AudioOutputDevice is inherited from the corresponding Audio object:

https://wolfram.com/xid/0rs4qh5ye-b6b9sg

https://wolfram.com/xid/0rs4qh5ye-rkxj5v


https://wolfram.com/xid/0rs4qh5ye-grvkpt

It is possible to set the AudioStream to a different device using the AudioOutputDevice option:

https://wolfram.com/xid/0rs4qh5ye-r01pyg

https://wolfram.com/xid/0rs4qh5ye-zpxfv8


https://wolfram.com/xid/0rs4qh5ye-zshk4q

Looping (1)
SampleRate (2)
Use the SampleRate option to control the sample rate of a generator AudioStream:

https://wolfram.com/xid/0rs4qh5ye-kaq7o5


https://wolfram.com/xid/0rs4qh5ye-ukt73l
Use the SampleRate option to control the sample rate of an input AudioStream:

https://wolfram.com/xid/0rs4qh5ye-8b92gs


https://wolfram.com/xid/0rs4qh5ye-vb3x0o

SoundVolume (1)
By default, the SoundVolume is inherited from the corresponding Audio object:

https://wolfram.com/xid/0rs4qh5ye-nn8hfa

https://wolfram.com/xid/0rs4qh5ye-nkvhot


https://wolfram.com/xid/0rs4qh5ye-bone32

It is possible to set the AudioStream to a different volume using the SoundVolume option:

https://wolfram.com/xid/0rs4qh5ye-kp4cec

https://wolfram.com/xid/0rs4qh5ye-qoa6gs


https://wolfram.com/xid/0rs4qh5ye-loy9og

Applications (4)Sample problems that can be solved with this function

https://wolfram.com/xid/0rs4qh5ye-tdsf96

Display a gauge with the RMS amplitude of a signal while it is playing:

https://wolfram.com/xid/0rs4qh5ye-vt6gt
Define a function to plot the loudness as a position on a horizontal gauge:

https://wolfram.com/xid/0rs4qh5ye-g3ffj
Display the gauge dynamically:

https://wolfram.com/xid/0rs4qh5ye-4ik0pb


https://wolfram.com/xid/0rs4qh5ye-5vce5l
Display the power spectrum of a signal while it is playing:

https://wolfram.com/xid/0rs4qh5ye-jjh0lt
Define a function for the display of the power spectrum:

https://wolfram.com/xid/0rs4qh5ye-j9rbhw
Display the power spectrum dynamically:

https://wolfram.com/xid/0rs4qh5ye-yooicl


https://wolfram.com/xid/0rs4qh5ye-9eq6fz
Create an AudioStream from a function that uses only binary operations:

https://wolfram.com/xid/0rs4qh5ye-b46nhv

Control some parameter dynamically using sliders:

https://wolfram.com/xid/0rs4qh5ye-nqc94k


https://wolfram.com/xid/0rs4qh5ye-dkbhc
Properties & Relations (2)Properties of the function, and connections to other functions
Use AudioPlay to create and start playing an audio stream:

https://wolfram.com/xid/0rs4qh5ye-rrqgr

Use AudioRecord to create and start a recording audio stream:

https://wolfram.com/xid/0rs4qh5ye-uj5qgo


https://wolfram.com/xid/0rs4qh5ye-ku4cs4
Possible Issues (2)Common pitfalls and unexpected behavior
If the audio is choppy, try increasing the buffer size:

https://wolfram.com/xid/0rs4qh5ye-jjyg9e

https://wolfram.com/xid/0rs4qh5ye-8fr5up

https://wolfram.com/xid/0rs4qh5ye-19krs7


https://wolfram.com/xid/0rs4qh5ye-w1niu8


https://wolfram.com/xid/0rs4qh5ye-wv4jv8


https://wolfram.com/xid/0rs4qh5ye-66ywu2

It is not possible to set the "Position" property in the case of an input stream:

https://wolfram.com/xid/0rs4qh5ye-o6mbe8

https://wolfram.com/xid/0rs4qh5ye-bvekgc


Wolfram Research (2017), AudioStream, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioStream.html (updated 2021).
Text
Wolfram Research (2017), AudioStream, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioStream.html (updated 2021).
Wolfram Research (2017), AudioStream, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioStream.html (updated 2021).
CMS
Wolfram Language. 2017. "AudioStream." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/AudioStream.html.
Wolfram Language. 2017. "AudioStream." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/AudioStream.html.
APA
Wolfram Language. (2017). AudioStream. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioStream.html
Wolfram Language. (2017). AudioStream. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioStream.html
BibTeX
@misc{reference.wolfram_2025_audiostream, author="Wolfram Research", title="{AudioStream}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/AudioStream.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_audiostream, organization={Wolfram Research}, title={AudioStream}, year={2021}, url={https://reference.wolfram.com/language/ref/AudioStream.html}, note=[Accessed: 29-March-2025
]}