| Contents | Index |
player = audioplayer(Y,Fs)
player = audioplayer(Y,Fs,nBits)
player = audioplayer(Y,Fs,nBits,ID)
player = audioplayer(recorder)
player = audioplayer(recorder,ID)
player = audioplayer(Y,Fs) creates an audioplayer object for signal Y, using sample rate Fs. The function returns a handle to the audioplayer object, player.
player = audioplayer(Y,Fs,nBits) uses nBits bits per sample for signal Y.
player = audioplayer(Y,Fs,nBits,ID) uses the audio device identified by ID for output.
player = audioplayer(recorder) creates an audioplayer object using audio recorder object recorder.
player = audioplayer(recorder,ID) creates an object from recorder that uses the audio device identified byID for output.
Y |
Audio signal represented by a vector or two-dimensional array containing single, double, int8, uint8, or int16 values. The value range of the input sample depends on the data type. The following table lists these ranges.
| ||||||||||||
Fs | Sampling rate in Hz. Valid values depend on the specific audio hardware installed. Typical values supported by most sound cards are 8000, 11025, 22050, 44100, 48000, and 96000 Hz. | ||||||||||||
nBits |
Bits per sample. Specify only when signal Y is represented by floating-point values. Valid values depend on the audio hardware installed: 8, 16, or 24. Default: 16 | ||||||||||||
ID |
Device identifier. To obtain the ID of a device, use the audiodevinfo function. Default: -1 (default device) | ||||||||||||
recorder |
Audio recorder object created by audiorecorder. |
Note When calling any method, include the audioplayer object name using function syntax, such as stop(player). |
Query properties of audioplayer object. | |
Query whether playback is in progress: returns true or false. | |
Pause playback. | |
Play audio from beginning to end. | |
Play, and do not return control until playback completes. | |
Restart playback from paused position. | |
Set properties of audioplayer object. | |
Stop playback. |
See the reference pages for get, play, playblocking, and set for additional syntax options.
The following four properties apply to callback functions. The first two inputs to your callback function must be the audioplayer object and an event structure.
Load and play a sample audio file of Handel's "Hallelujah Chorus:"
load handel; player = audioplayer(y, Fs); play(player);
audiodevinfo | audiorecorder | sound

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |