Create object for playing audio
player = audioplayer(Y,Fs)
player = audioplayer(Y,Fs,nBits)
player = audioplayer(Y,Fs,nBits,ID)
player = audioplayer(recorder)
player = audioplayer(recorder,ID)
player = audioplayer(
audioplayer object using audio recorder object
Audio signal represented by a vector or two-dimensional array
The value range of the input sample depends on the data type. The following table lists these ranges.
Sampling rate in Hz. Valid values depend on both the sample rates permitted by MATLAB® and the specific audio hardware on your system. MATLAB has a hard restriction of 1000 Hz <= Fs <= 384000 Hz, although further hardware-dependent restrictions apply. Typical values supported by most sound cards are 8000, 11025, 22050, 44100, 48000, and 96000 Hz.
Bits per sample. Specify only when signal
Device identifier. To obtain the ID of a device, use the
Audio recorder object created by
When calling any method, include the
Query properties of
Query whether playback is in progress: returns
Play audio from beginning to end.
Play, and do not return control until playback completes.
Restart playback from paused position.
Set properties of
Number of bits per sample. (Read-only)
Current sample that the audio output device is playing.
If the device is not playing,
Identifier for audio device. (Read-only)
Number of audio channels. (Read-only)
Status of the audio player:
Sampling frequency in Hz.
Total length of the audio data in samples. (Read-only)
Label of the object.
Name of the class:
Any type of additional data to store with the object.
The following four properties apply to callback functions.
The first two inputs to your callback function must be the
Function to execute one time when playback starts.
Function to execute one time when playback stops.
Function to execute repeatedly during playback. To specify
time intervals for the repetitions, use the
Time in seconds between
Load and play a sample audio file of Handel's "Hallelujah Chorus:"
load handel; player = audioplayer(y, Fs); play(player);