Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 1.41 KB

README.md

File metadata and controls

57 lines (35 loc) · 1.41 KB

Read First!

You should probably checkout this library as it's way more fleshed out and I'll be moving my own projects to it.

ESP8266 WavPlay is a little lighter if your running tight on code space, but it could use some attention in the implementation department (ie. moving it out of the global namespace).

ESP8266 WavPlay

This is the core non blocking wav playing component of bbx10's SFX I2S Web Trigger repackaged as a re-usable library. Plays wav files stored on the SPIFFS file system.

Should work on any ESP8266 based Arduino + I2S DAC, I've however only tested on a Wemos D1 Mini paired up with a Adafruit MAX98357 I2S Class-D mono amp

Basic Example

#include "wavplay.h"

void setup() {
  wavSetup();
}

void loop() {
  if (! wavPlaying()) {
    wavStartPlaying("/file.wav");
  }
  wavLoop();
}

Methods

  • wavSetup()

    Sets up the SPIFFS filesystem + initialises i2s

  • wavStartPlaying("/filename.wav")

    Plays the filename from SPIFFs

  • wavPlaying()

    Returns true when a file is playing.

  • wavStopPlaying()

    Stops playing the current file.

  • wavLoop()

    Must be called during loop to make sure the play buffer is kept full.

  • showDir()

    Show details about the files stored on SPIFFS