audioDeviceWriter
Play to sound card
Description
The audioDeviceWriter
System object™ writes audio samples to an audio output device. Properties of the audio device
writer specify the driver, the device, and device attributes such as sample rate, bit depth,
and buffer size.
See Audio I/O: Buffering, Latency, and Throughput for a detailed explanation of the audio device writer data flow.
To stream data to an audio device:
Create the
audioDeviceWriter
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Syntax
Description
returns a
System object, deviceWriter
= audioDeviceWriterdeviceWriter
, that writes audio samples to an audio
output device in real time.
sets the SampleRate property to
deviceWriter
= audioDeviceWriter(sampleRateValue
)sampleRateValue
.
sets each property deviceWriter
= audioDeviceWriter(___,Name,Value
)Name
to the specified Value
.
Unspecified properties have default values.
Example: deviceWriter = audioDeviceWriter(48000,'BitDepth','8-bit
integer')
creates a System object, deviceWriter
, that operates at a 48 kHz sample rate and
an 8-bit integer bit depth.
Properties
Usage
Description
writes one frame of audio samples, numUnderrun
= deviceWriter(audioToDevice
)audioToDevice
, to the selected
audio device and returns the number of audio samples underrun since the last call to
deviceWriter
.
Note: When you call the audioDeviceWriter
System object, the audio device specified by the Device
property is
locked. An audio device can be locked by only one audioDeviceWriter
at a
time. To release the audio device, call release
on your
audioDeviceWriter
System object.
Input Arguments
Output Arguments
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)