Summary

Play a RAW data file, stored on a SD card. RAW format is simpler than WAV and begins playing immediately, without parsing WAV file header info.

Audio Connections

PortPurpose
Out 0Sound Output

Functions

play(filename);

Begin playing a RAW data file. If a file is already playing, it is stopped and this file starts playing from the beginning.

stop();

Stop playing. If not playing, this function has no effect.

isPlaying();

Return true (non-zero) if playing, or false (zero) when not playing.

positionMillis();

While playing, return the current time offset, in milliseconds. When not playing, the return from this function is undefined.

lengthMillis();

Return the total length of the current sound clip, in milliseconds. When not playing, the return from this function is undefined.

Examples

File > Examples > Audio > Recorder

Notes

The data file must be RAW 16 bit signed integers in LSB-first format.

While playing, the audio library accesses the SD card automatically. If card access is required, you must AudioNoInterrupts() to prevent the library from accessing the SD card while you use it. Disabling the audio library interrupt for too long may cause audible dropouts or glitches.