AudioStream
AudioStream[source]
creates a new AudioStream object from source.
AudioStream[id]
is an object that represents a unique audio stream.
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)
Create an AudioStream object from an audio object:
Create an AudioStream object from an input device:
Create an AudioStream object from a function:
Play the AudioStream:
Scope (17)
Basic Uses (5)
Playback Streams (7)
Inspect the properties of an AudioStream created from an Audio object:
Create an AudioStream from a list of Audio objects:
Inspect the properties of an AudioStream created from a list of Audio objects:
Get the list of available properties:
Get the values for all available properties:
Create an AudioStream from a list of Audio objects and specify an ordering:
Play the stream with the specified ordering:
Create an AudioStream from a list of Audio objects and set some of the properties:
Change the "CurrentTrack" property and play the AudioStream:
Audio streams can be extended using Append. Generate an audio stream of two audio signals:
Append the new audio signal to the stream:
Play back the resulting stream:
Generator Streams (4)
Inspect the properties of an AudioStream created from a function:
Create an AudioStream from a function and record the generated signal:
With functions that return arrays of depth 2, the first dimension is interpreted as the number of channels:
Create an AudioStream from a function:
Input Streams (1)
Inspect the properties of an AudioStream created from an input device:
Options (6)
AudioChannelAssignment (1)
By default, the AudioChannelAssignment is inherited from the corresponding Audio object:
It is possible to set the AudioStream to a different channel assignment:
Note that the channel assignment of the original audio object stays the same:
AudioOutputDevice (1)
By default, the AudioOutputDevice is inherited from the corresponding Audio object:
It is possible to set the AudioStream to a different device using the AudioOutputDevice option:
Looping (1)
SampleRate (2)
Use the SampleRate option to control the sample rate of a generator AudioStream:
Use the SampleRate option to control the sample rate of an input AudioStream:
SoundVolume (1)
By default, the SoundVolume is inherited from the corresponding Audio object:
It is possible to set the AudioStream to a different volume using the SoundVolume option:
Applications (4)
Display a gauge with the RMS amplitude of a signal while it is playing:
Define a function to plot the loudness as a position on a horizontal gauge:
Display the gauge dynamically:
Display the power spectrum of a signal while it is playing:
Define a function for the display of the power spectrum:
Display the power spectrum dynamically:
Create an AudioStream from a function that uses only binary operations:
Properties & Relations (2)
Use AudioPlay to create and start playing an audio stream:
Use AudioRecord to create and start a recording audio stream:
Text
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.
APA
Wolfram Language. (2017). AudioStream. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioStream.html