Summary

Play a short sound clip, stored directly in memory. Data files are created with the wav2sketch program, and copied to the sketch folder to become part of your sketch.

Audio Connections

PortPurpose
Out 0Sound Output

Functions

play(data);

Begin playing a sound clip. If already playing, the currently playing clip is stopped and this new data begins 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 > SamplePlayer

Notes

TODO: supported sample rates: 11.025, 22.05, 44.1

TODO: ulaw vs uncompressed encoding

Polyphonic playback can be built by creating multiple objects, with their output combined by mixers.