| MATLAB Function Reference | ![]() |
Syntax
Description
y = audioplayer(x,Fs)
returns a handle to an audio player object y using input audio signal x. The audio player object supports methods and properties that you can use to play audio data.
The input signal x can be a vector or two-dimensional array containing single, double, int8, uint8, or int16 MATLAB data types. The input sample value range depends on the MATLAB data type.
| Data Type |
Input Sample Value Range |
int8 |
-128 to 127 |
uint8 |
0 to 255 |
int16 |
-32768 to 32767 |
single |
-1 to 1 |
double |
-1 to 1 |
Fs is the sampling rate in Hz to use for playback. Valid values for Fs depend on the specific audio hardware installed. Typical values supported by most sound cards are 8000, 11025, 22050, and 44100 Hz.
y = audioplayer(x,Fs,nbits)
returns a handle to an audio player object where nbits is the bit quantization to use for single or double data types. This is an optional parameter with a default value of 16. Valid values for nbits are 8 and 16 (and 24, if a 24-bit device is installed). You do not need to specify nbits for int8, uint8, or int16 data because the quantization is set automatically to 8 or 16, respectively.
y = audioplayer(r)
returns a handle to an audio player object from an audiorecorder object r.
y = audioplayer(r,id)
returns a handle to an audio player object from an audiorecorder object r, using the audio device specified by id for output. This option is only available on systems running Windows
Example
Load a sample audio file, create an audio player object, and play the audio at a higher sampling rate. x contains the audio samples and Fs is the sampling rate. You can use any of the audioplayer functions listed above on the player.
To stop the playback, use this command:
Methods
After you create an audio player object, you can use the methods listed below on that object. y represents the name of the returned audio player.
Properties
Audio player objects have the properties listed below. To set a user-settable property, use this syntax:
get(y,'property') % Displays 'property' setting.
See Also
audiorecorder, sound, wavplay, wavwrite, wavread, get, set, methods
| atanh | audiorecorder | ![]() |
© 1994-2005 The MathWorks, Inc.