Navigation

Operators and Keywords

Function List:

C++ API

: 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);

Demonstration 1

The following code

 fs = 44100;
 audio = 0.25 * randn (2, 2*fs);
 player = audioplayer (audio, fs);
 play (player);
 pause (1);
 pause (player);
 pause (1);
 resume (player);
 pause (1);
 stop (player);

gives an example of how '@audioplayer/audioplayer' is used.

Package: octave