earlephilhower / ESP8266Audio

Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
GNU General Public License v3.0
2.03k stars 434 forks source link

PlayWAVFromPROGMEM example viola.h WAV conversion to header #545

Closed lwbantoto closed 2 years ago

lwbantoto commented 2 years ago

Hello, how do you convert a wav file to a header file like viola.h?

https://github.com/earlephilhower/ESP8266Audio/tree/master/examples/PlayWAVFromPROGMEM

Thank you, Lance

earlephilhower commented 2 years ago

On Linux where I work, I use: xxd -i file.wav > file.h. Then I edit the file to make the variable PROGMEM and you're all set.

Windows should have similar tools.

f3rn4ndes commented 2 years ago

Good question. I´ve tried to use wav to code applications, https://colinjs.com/software.htm#t_WAVToCode, but it removes the header of wav file. I have an additional question: regarding the read and play 16 bits wav file (converted to c)

lwbantoto commented 2 years ago

Hi @earlephilhower. Thank you. I was able to use xxd on Mac. Which file do you edit PROGMEM to? I can't find it.

earlephilhower commented 2 years ago

Edit the generated .h file and make the variable PROGMEM (see the example for where it would go).

f3rn4ndes commented 2 years ago

xxd for windows https://sourceforge.net/projects/xxd-for-windows/ I will try to use it.