Play recorded sound on PC-based audio output device
wavplay(y,Fs) plays the
audio signal stored in the vector
y on a PC-based
audio output device.
Fs is the integer sample rate
in Hz (samples per second). The default value for
wavplay supports only 1- or 2-channel
(mono or stereo) audio signals. To play in stereo,
be a two-column matrix.
wavplay interacts with the command line. The
mode is one of the following:
'sync' (default): You do not have
access to the command line until the sound has finished playing (a
blocking device call).
'async': You have immediate access
to the command line as soon as the sound begins to play on the audio
output device (a nonblocking device call). If you call
async mode while the audio is playing,
access to the command line until the original playback completes.
The audio signal
y can be one of four data
types. The number of bits used to quantize and play back each sample
depends on the data type.
Data Types for wavplay
Double-precision (default value)
16-bit signed integer
8-bit unsigned integer
contain an audio signal
y and a sampling frequency
Load and play the gong and the chirp audio signals. Change the names
of these signals in between
and play them sequentially using the
load chirp; y1 = y; Fs1 = Fs; load gong; wavplay(y1,Fs1,'sync') % The chirp signal finishes before the wavplay(y,Fs) % gong signal begins playing.