Open Panzer

Developer's Forum => Open Source Sound Dev => Topic started by: Foxhood on December 01, 2025, 04:21:17 PM

Title: OPSC Lite
Post by: Foxhood on December 01, 2025, 04:21:17 PM
Took a detour from my TCB iterating efforts to experiment with sound involving one of the smaller AVR-Dx (AVR64DD28) and its built-in 10-bit DAC.

My reasoning is that if the original OPSC was a 72Mhz ARM processor juggling "6" channels of stereo, 16-bit, 44Khz PCM data from a uSD card via a SPI bus. Surely a 24Mhz AVR processor could juggle a few 8-bit mono channels. Benedini showed it was possible for AVR to do sound and that was with a older memory constrained ATmega8 type connected to slow Flash memory, no DAC and long before libraries like sdFat became the optimized beasts we know today. Only thing the AVR lacks is a DSP for floating point math so one has to cheat a little to keep mixing data within the ballpark of the ALU by using bit-shifts and multiplications for manipulating volume.

Approach is fairly simple. Two output buffers with one marked as active. A timer routine slowly goes through the active buffer pushing the values to the DAC output while the processor is prepping the other buffer. Grabbing pages of 8-bit signed 22Khz PCM via sdFat from files, manipulating volume and smashing them together. Been running through benchmarks with pages of 1024 bytes and i've managed to get it to handle 9 files before it started to fail at preparing before the DAC Timer caught up to it. Which is very promising considering the old benedini only managed 2 channels and the OPSC could do 6. Honestly would have been happy with just 4 really...

Next is to get Logic running and test with actual soundsets rather than little test-waveform files. Since I'm working with raw-files without a sound library i got a lot of freedom in how i deal with data. Can even do stuff like pre-processing files to make playback easy (e.g. behead them so you get RAW). Gonna take a lot of coding. But I'm fairly excited about my progress.

I've also drafted a small board for it with the minimum components to see how small it actually is. It is really just the AVR, a generic LDO, uSD Slot and the MAX9768 (same as regular OPSC). BOM puts it at like 10$ plus PCB which makes it the cheapest sound-card yet, may be good for existing boards, though i am definitely looking at fitting the circuit unto my TCB Re-design as a co-processor.