FreeMat: WAVPLAY

FreeMat

- Main Page
- Related Pages

WAVPLAY

Section: Input/Ouput Functions

# Usage

Plays a linear PCM set of samples through the audio system. This function is only available if the `portaudio` library was available when FreeMat was built. The syntax for the command is one of:

       wavplay(y)
       wavplay(y,sampling_rate)
       wavplay(...,mode)

where `y` is a matrix of audio samples. If `y` has two columns, then the audio playback is in stereo. The `y` input can be of types `float, double, int32, int16, int8, uint8`. For `float` and `double` types, the sample values in `y` must be between `-1` and `1`. The `sampling_rate` specifies the rate at which the data is recorded. If not specified, the `sampling_rate` defaults to `11025Hz`. Finally, you can specify a playback mode of `'sync'` which is synchronous playback or a playback mode of `'async'` which is asynchronous playback. For `'sync'` playback, the wavplay function returns when the playback is complete. For `'async'` playback, the function returns immediately (unless a former playback is still issuing).