C-Array Generation from Audio File

Product: [SparkFun I2S Audio Breakout - MAX98357A (DEV-14809)

MCU: ESP32-WROOM-32 (DEVKIT1)

IDE: Arduino IDE 1.8.9

Libraries :

  • - ESP8266 Audio Arduino Library
  • - ESP8266_Spiram Arduino Library

  • Code: ESP8266 Audio Arduino Library Examples → PlayWAVFromPROGMEM

    Attachments: Sample_SFX.zip/System_General_Error.wav (28 kb, 1 file)

    Problem:

    I have successfully assembled and [run the example sketches, but ares struggling to play custom sounds. I believe that the problem can be resolved simply by identifying a method for exporting .wavs. Attached is a sample .wav I would like to be able to play from memory.

    Troubleshooting:

  • - Opened .wav file in Audacity 2.3.0 and exported as .wav (Microsoft header/encoded signed 16-bit PCM)
  • - Opened .wav file in HxD 2.3.0.0 and exported the contents of the file with the "Copy As > C" function under "Edit"
  • - Replaced the contents of the example char array (PlayWAVFromPROGMEM.ino, viola.h) with the generated char array contents, name of array unchanged.
  • - Compile and Upload is successful
  • Behavior:

  • - Serial Output consistently indicates that the file is retrieved from memory.
  • - No Audio from the speaker or loud bursts of static depending on array export settings.
  • - Error during silence:
    AudioGeneratorWAV::ReadWAVInfo: cannot read WAV, invalid RIFF header, got: D5D5D5D5 
    AudioGeneratorWAV::begin: failed during ReadWAVInfo
    
  • ](https://learn.sparkfun.com/tutorials/i2s-audio-breakout-hookup-guide)](https://www.sparkfun.com/products/14809)

    Sample_SFX.zip (28.1 KB)