wavplayer library  v0.91
Plays 16-bit, 32 ksps, mono wav files
Functions
wavplayer.h File Reference

Plays 16-bit, 32ksps, mono .wav files in the root directory of a microSD card. More...

Go to the source code of this file.

Functions

void wav_play (const char *wavFilename)
 Play a .wav file. More...
 
int wav_playing ()
 Check if wav file is currently playing. More...
 
void wav_volume (int vol)
 Set wav play volume 0 to 10. 0 is lowest, 10 is highest. More...
 
void wav_stop (void)
 Stop wav file reading but leave audio output open so that you can play another track without a click at the start. Recommended over wav_close unless your application needs to recover both the wav reading and audio output cogs for other uses.
 
void wav_close (void)
 Stop wav file reading and close audio output. Only recommended if your application needs to recover two cogs for other purposes.
Otherwise, use wave_stop. It will stop the cog that reads the wav file, but leave the audio output cog open, which will prevent a click at the start of the next track your application plays.
 
void wav_set_pins (int left_pin, int right_pin)
 Change the default pins used by the wav player library. Only call before calling wav_play for the first time or after calling wav_close. More...
 

Detailed Description

Plays 16-bit, 32ksps, mono .wav files in the root directory of a microSD card.

Author
Andy Lindsay
Core Usage
sd_mount - 1, wav_play - 2.
The wav_play function only uses 2 cores while a file is playing, and stops them again when the file ends, playback stops, or to start playing a different file.
Memory Models
Use with CMM or LMM.
Version
v0.91
  • Added function to change the default pins for wav sound output
  • Clicks between tracks removed
  • Bug that prevented later tracks in a sequence from being played is fixed
Help Improve this Library
Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.

Function Documentation

◆ wav_play()

void wav_play ( const char *  wavFilename)

Play a .wav file.

Parameters
wavFilenamePointer to character array with filename.

◆ wav_playing()

int wav_playing ( )

Check if wav file is currently playing.

Returns
1 if playing, 0 if not.

◆ wav_set_pins()

void wav_set_pins ( int  left_pin,
int  right_pin 
)

Change the default pins used by the wav player library. Only call before calling wav_play for the first time or after calling wav_close.

Parameters
left_pinpin to output left channel audio on (default is 27).
Set to -1 to disable this output.
right_pinpin to output right channel audio on (default is 26). Set to -1 to disable this output.

◆ wav_volume()

void wav_volume ( int  vol)

Set wav play volume 0 to 10. 0 is lowest, 10 is highest.

Parameters
volwav playback volume.