How to get more sounds on to the I2S audio system?

Hi,

I have installed the ESP8266Audio library to create sound on ESP32. I also have the MAX98375A amplifier installed on the board. This sample file relies heavily on this piece of code:

#include <Arduino.h>

#include "AudioFileSourcePROGMEM.h"
#include "AudioGeneratorWAV.h"
#include "AudioOutputI2SNoDAC.h"

// VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html
#include "viola.h"

AudioGeneratorWAV *wav;
AudioFileSourcePROGMEM *file;
AudioOutputI2SNoDAC *out;

void setup()
{
  Serial.begin(115200);
  delay(1000);
  Serial.printf("WAV start\n");

  audioLogger = &Serial;
  file = new AudioFileSourcePROGMEM( viola, sizeof(viola) );
  out = new AudioOutputI2SNoDAC();
  wav = new AudioGeneratorWAV();
  wav->begin(file, out);
}

This bit works perfectly, but were I to create a talking clock, I'd need about 60 sound clips. I have managed to create the WAV files, then convert them to 8 bit hexadecimal files, just like the viola.h in this example.

The problem arises when I would like to have more sounds. Is there a way to change the sound source on the fly?

There is also the talkie.h library, but getting that to speak via I2S seems to be another issue beyond my current capabilities, as talkie seems to output PWM instead of DAC.

Does anyone know of a way of feeding several audio hex files to the sample above? Any leads muchly appreciated.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.