WTV020M01 : MP3 to compatible WAV
The WTV020M01 module can play audio files and be controlled by an Arduino. Sadly, it's quite difficult to convert the audio files in a compatible format.
I tried to use the WTV020M01 and an ESP8266 to create a connected speaker.
Unfortunately, the WTV020M01 module seems to only accept AD4 audio files, and some WAV files with limitations.
I discovered another module to play sounds, the DFPlayer Mini.
In the meantime, I still want to use my WTV020.
As the AD4 format is proprietary and not used anymore, I had to learn how to convert a MP3 file into a WAV file with compatible characteristics.
The module supports WAV file formats with sampling rates from 6Khz to 16Khz. It's less than the AD4 format, but with a little speaker I don't think it will matter.
Before editing the MP3 files, it's mandatory to properly format your SD card.
Format SD Card
Important remark: As the module is cheap and old, only non-HC SD micro-cards can be used. Basically, any card below 2GB should be OK.
And even with that, some folks had to add a power supply wire directly on the SD card.
The SD-card has to be formatted with the software from the SD Association:
https://www.sdcard.org/downloads/formatter_4/
Convert audio files
Softwares
For this process, I use Audacity (Open Source)
Process
- Open Audacity
- Open your audio file
- Select "Tracks" -> "Stereo Track to mono"
- Click on the name of your track, and select "Set sample format" -> "16-bit PCM"
- On the bottom of the screen, "Project Rate (Hz)" -> 16000
- Menu "Effect" -> "Amplify", choose a value to have a sound below the 0.5 graduation
- Menu "File" -> "Export audio...", and select "Type": "WAV (Microsoft) signed 16 bit PCM"
Now I just have to copy the files at the root of the SD card, with filenames as 0000.wav, 0001.wav, 0002.wav, ..., 0009.wav, 0010.wav...
Sum-up
- Format the SD card with the official tool
- Rework your audio files to get "wav" (PCM 16bits) mono / 16kHz file;
- Copy the audio files on the micro SD card as 0000.wav, 0001.wav, 0002.wav...
And play some music :)