So, I’m wanting to build a photon-based halloween prop that can play some quick sound effects. I’ve got an Adafruit VS1053 board, but as I was assembling stuff, I wondered about just using the DAC and an amp.
I haven’t yet tried this approach, but I plan on working on it this week some evening. I wanted to get early feedback to see if was even worth chasing.
The idea is to take a very short, mono, 22khz (or 11khz), 8bit PCM .wav (u-law) file and write a script that could turn it into C code directly as an array of 12bit integers. (This also makes it easy to flash)
Then, I’d run use an interrupt timer every 22khz (or 11Khz) to write the next value from the array out to the DAC line. I’d run it through an audio amplifier like Adafruit’s Mono amp to a speaker.
Does that ‘sound’ feasible?
From a hardware perspective, would that approach be better than just using the un- u-lawed 8 bit integer and doing PWM out on a non-DAC pin?
I’m gonna have to re-read specs on .wav files and u-law companding. It’s been a while since I did audio file processing.
Some of my assumptions and/or other areas where I could use a gut check and advice:
- Are there any 12 bit audio codecs that are worth looking at? I’m familiar with ffmpeg and sox to convert audio, but I didn’t see any commonly-used 12bit ‘raw’ audio formats. Sox wouldn’t let me convert 16 or 8 bit to 12 bit wav since it’s not a standard.
- Assuming the 12bit DAC isn’t going to de-compand u-law, so I have to do it first. Once I have the decompanded 8bit value, I can
mapit to 12 bit space. I know I’ll lose some quality.
- I’m familiar with audio files, but not much with audio electronics and hardware. Will the above amp work ok? I probably have all the parts to build an op-amp -based amplifier, but I have no idea how good they are. I’ve seen some schematics online.
Any input would be awesome!!