33.3 Audio Player

The following methods are used to create and use audioplayer objects. These objects can be used to play back audio data stored in Octave matrices and arrays. The audioplayer object supports playback from various devices available to the system, blocking and non-blocking playback, convenient pausing and resuming and much more.

: player = audioplayer (y, fs)
: player = audioplayer (y, fs, nbits)
: player = audioplayer (y, fs, nbits, id)
: player = audioplayer (recorder)
: player = audioplayer (recorder, id)

Create an audioplayer object that will play back data y at sample rate fs.

The optional arguments nbits, and id specify the bit depth and player device id, respectively. Device IDs may be found using the audiodevinfo function. Given an audioplayer object, use the data from the object to initialize the player.

The signal y can be a vector or a two-dimensional array.

The following example will create an audioplayer object that will play back one second of white noise at 44100 sample rate using 8 bits per sample.

y = 0.25 * randn (2, 44100);
player = audioplayer (y, 44100, 8);
play (player);

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Audio-Player.html