AudioStream

AudioStream[audio]

creates a new AudioStream object from audio.

AudioStream[inputdev]

creates a new AudioStream from an input audio device inputdev.

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.
  • AudioStream[audio] returns an AudioStream object, without starting the playback. Use AudioPlay to start the playback.
  • AudioStream[inputdev] returns an AudioStream object, without starting to record. Use AudioRecord to start the recording.
  • The inputdev can be any available input audio device from $AudioInputDevices.
  • The following options can be specified:
  • AudioChannelAssignmentInheritedhow to assign audio channels to outputs
    AudioLoopingFalsewhether to loop the playback
    AudioOutputDeviceInheritedaudio output device to use for playback
    MethodAutomaticmethod settings to use
    SoundVolumeInheritedsound volume
  • A list of available properties can be obtained using astream["Properties"].
  • Some properties of the playback stream include:
  • "AudioChannelAssignment"how to assign audio channels to outputs
    "AudioLooping"whether to loop the playback
    "AudioOutputDevice"audio output device to use for playback
    "BufferSize"number of samples in each buffer
    "ID"the stream ID
    "Position"position of the playback given as a time Quantity
    "SoundVolume"sound volume
    "Status"status of the stream
  • Possible settings for "Status" include "Playing", "Recording", "Paused" or "Stopped".
  • Additional properties are available for streams that are connected to an input device.
  • "AudioInputDevice"audio input device to use for recording
    "RecordedAudio"an Audio object containing the recording
    "StorageLocation"path to the file that will store the recorded audio
  • It is possible to set values of properties with astream["prop"]=val.

Examples

open allclose all

Basic Examples  (2)

Create an AudioStream without starting the playback:

In[1]:=
Click for copyable input
Out[2]=

Play the AudioStream:

In[4]:=
Click for copyable input
Out[4]=

Create an input AudioStream:

In[1]:=
Click for copyable input
Out[1]=

Record the AudioStream:

In[2]:=
Click for copyable input
Out[2]=

Stop the recording:

In[3]:=
Click for copyable input

Scope  (6)

Options  (4)

Applications  (1)

Properties & Relations  (2)

Possible Issues  (2)

See Also

Audio  AudioPlay  AudioRecord  AudioStop  AudioPause  AudioStreams

Introduced in 2017
(11.2)
| Updated in 2018
(11.3)