Need to add sound to your project? Voice prompts? Sound effects in games? Robots that bleep or boop or scream? Talking alarm systems?
The WT588D, a so-called ‘voice chip’, allows you to add custom sound clips in the form of WAV files to your project, and is available for a few dollars on eBay. Drive a tiny 0.5W, 8-ohm speaker directly, or run the output to an amplifier circuit.
Unfortunately, the documentation is awfully cryptic, and the software and WAV file requirements are quirky.
A few variants: the small-and-cute 16-pin or WT588D-16p version, typically sold with 8 Mbit (1 MB) flash memory for file storage:
is the one I’ll be posting about. It’s the smallest and most portable. That said, it requires a separate programming module that typically runs around $10, also on eBay.
The 28-pin WT588D-28p variety costs only a dollar or so more, and is frequently sold with 32 Mbit (4 MB) memory. Like the WT588-16p, it can only be updated via the programming module. It’s also considerably larger, and can be hard to find, likely because the WT588D-U runs at about the same size and price.
The last version is the WT588D-U, which supports programming and data transfer by its mini-USB connector (no external module required), and again, typically comes with 32 Mbit of on-board flash memory.
Specs: the WT588D boasts a fast DSP audio processor, 12-bit PWM output, and good sound quality – though this is harder to judge with the tiny little speakers it drives, and I haven’t as yet amplified it sufficiently to judge better. Sampling rates range from 6-22 kHz. When no file is playing, sleep mode activates automatically, and draws under 10 μA. Operating voltage is 2.8-5.5 V.
So: the quirks. First, the software …
You can’t just open the software and load WAV files. While there’s nothing difficult here, it may also not seem obvious that you need to click on File to start a New Project:
Name it something. Note that lower-case c, e, s and w don’t work. Upper-case letters do. Your software isn’t corrupt – it’s working properly. Presumably one of the vagaries of adapting the software from Chinese.
On the right, select your chip’s memory size under Flash. Note that regardless of what you specify, the software will let you add sound files that exceed the available space without warning. You’ll need to keep track.
To load sound files, you’ll right click on the main file window and select Load.
Select your sound files. And very likely you’ll get an Inappropriate sampling rate! error. Sigh.
This chip’s finicky. It will accept files sampled at 6,000 to 20,000 Hz, in 2,000 Hz increments – exactly. Nothing else. Unfortunately, there are very few WAVs recorded at these sampling rates. You’ll need to resample.
Resample to the lowest rate that gives you acceptable audio, in order to save on file size. WAV files are uncompressed audio, and a 10-second clip in 44.1 kHz stereo will run about 1,723 kB in size. Remember – the smaller chip holds 8 Mbit, not MB! This little puppy – even with some basic built-in compression – wouldn’t hold more than about 15 secs of high-fidelity audio – if it were capable.
According to play-times cited in the official documentation, you should be able to store about three times the actual WAV file sizes for the amount of available memory. Given a maximum sampling rate of 22,000 kHz, you could store about 40 seconds’ worth of mono, 22,000 kHz audio on an 8 Mbit chip, about half that for stereo. Your mileage may vary.
Simply converting to a different rate can distort the WAV file into garbage. Best way to convert – Audacity.
Load Audacity, and load up your audio files.
Highlight your selection, and click on Tracks, then Stereo Tracks to Mono – since your WT588D output is mono, anyway. File is now half its original size.
Then, at the bottom of the Audacity screen, specify your desired sampling rate. For music, you might accept 16000 or 14000 kHz, or less – and for some sounds, even 6000 kHz may be acceptable.
after which you select File, Export Audio, then WAV.
I tend to resample files to different rates, than pick the smallest that still sounds appropriate for my application.
Back to the WT588D VoiceChip software. Load your files once again. The status bar at the bottom of the program will tell you how much of your flash memory will be used by your files – provided you’ve indicated the correct size of flash memory in the program. This value is not saved and so will have to be re-entered every time you run the program.
Once you’re happy, you need to bind audio files to ‘Equations’, or numeric values used to trigger those files. Select your Equation number, then double-click on the sound file(s) you want in the left panel, in the order in which you want them played when that key is triggered.
Note that any grouped files will play back-to-back, without pause, when triggered. If you want pauses between files, you do so by right-clicking in the right panel and selecting Insert, then either a pre-defined silence duration, or you define your own.
Once you’ve configured your various audio file sequences, it’s time to specify what mode you will use to access your sound files. Click on Mode, and select.
|MP3 mode||pretty limited mode, allows only STOP, ON/OFF, NEXT, PREV, VOL+, and VOL- as control options. Please note: version 1.6 of this software does not actually support MP3 files, just an MP3-player-like mode|
|Key mode (default)||play a specific sound sequence or playlist by pressing a specific key. You bind each Equation to a specific pin; activate by pressing a switch that pulls it low to ground. For a 16-pin module, only pins P00 to P03 are available; version 1.2 of the 28-pin module defines another six pins, or up to four discrete key-mapped sound sequences, or ten, respectively|
|One-line serial||use one serial line to communicate with the chip, or activate sequences using specific pins as in Key mode. Can apparently be hard to get working|
|Three-line serial||uses three pins for CS, DATA, SCK for an SPI-style control interface. Commonly used|
|Parallel||a parallel interface with fewer control options – and for an 16-pin module, only 3 pins are available to specify 23 equation addresses, or a maximum of 8 sound sequences|
|3×8 Matrix||play one of 24 equation lists by a combination of input on pins P00-P07 and P10-P12. No controls available, and requires 11 pins just to trigger sounds – so not even an option on a 16-pin module. Very limited|
As to the various ways sounds can be triggered, repeated, stopped – details are in the WT588D CHIP&MODULE DETAILED INFORMATION pdf file. The translations are clumsy (and in places not accurate) but the diagrams should help you figure these out.
If using specific keys i.e. triggering sounds via specific input pins, you may want to specify which function and equation should bind to each key, under Operation. Note that the defaults work nicely for four inputs/four sound sequences.
Click on the Compile icon:
Oh, and this may on occasion throw an error of the ‘File was not found’ variety. Don’t worry about it. Another quirk. Just try it again.
Good enough? Let’s upload our files.