audiostreamer
Description
The audiostreamer
object provides a flexible I/O Interface for
playing and recording audio in MATLAB®.
Work with streaming audio by specifying signals to be played in real time and processing audio as it is being recorded. You can specify callback functions to control the playing and processing of streaming audio.
Use
audiostreamer
to implement blocking workflows, where MATLAB does not process commands until playing and recording is finishing, or non-blocking workflows, where you can perform other processing while playing and recording audio.Simultaneously play and record audio using full-duplex devices.
Use
audiostreamer
with multiple-channel signals and specify custom channel mappings.
Creation
Syntax
Description
creates a default
streamer
= audiostreameraudiostreamer
object.
returns an streamer
= audiostreamer(mode
)audiostreamer
object with the specified mode.
creates an streamer
= audiostreamer(mode
,fs
)audiostreamer
object with the SampleRate
property set to fs
.
specifies options using one or more name-value arguments.streamer
= audiostreamer(___,Name=Value
)
Properties
Object Functions
play | Play audio on device |
record | Record from audio device |
read | Get recorded audio data |
playrec | Play and record simultaneously |
waitfor | Wait for playback and/or recording to end |
pause | Pause playing and/or recording |
resume | Resume paused playing and/or recording |
stop | Stop playing and/or recording |
setup | Configure audio device for operation |
release | Release audio device |
measureLoopbackLatency | Measure device loopback latency |
getStreamTime | Get stream time in seconds |
getUnderrunCount | Get number of underrun samples |
isPlaying | Indicate if audio device is currently playing |
isRecording | Indicate if audio device is currently recording |
isPlayerPaused | Indicates if playback is currently paused |
isRecorderPaused | Indicates if recording is currently paused |
getAudioDevices | Available audio devices |
getPlayerNames | Player device names |
getRecorderNames | Recorder device names |
getDrivers | Available drivers on current OS |
Examples
Version History
Introduced in R2025a