4 ms·
I had really good success abusing the PWM pins on AVR microcontrollers into acting as 8-bit DACs. Hooking up earbud headphones or a tiny powered speaker was all
by Nihilartikel 3y ago
I had really good success abusing the PWM pins on AVR microcontrollers into acting as 8-bit DACs. Hooking up earbud headphones or a tiny powered speaker was all that was needed for decent (for 8 bit) fidelity. No low pass necessary since the PWM artifacts were at the upper edge of audibility.
Those micros were much weaker than the ESP, so the audio was all synthesized with a roughly nintendo-parity waveform selection rather than samples. In fact the earliest version was on an attiny85 which had no hardware multiplication, so.. lots of fixed point arithmetic and lookup tables were involved.
My pet project was DuinoTune, which would convert tracker-music into ready-to-compile code.
https://www.youtube.com/watch?v=rFqvPWnolfY https://www.youtube.com/watch?v=rFqvPWnolfY
https://www.youtube.com/watch?v=G3baH5iTcFM https://www.youtube.com/watch?v=G3baH5iTcFM
https://github.com/blakelivingston/DuinoTune https://github.com/blakelivingston/DuinoTune
- ChainOfFools 3y ago> I had really good success abusing the PWM pins on AVR microcontrollers into acting as 8-bit DACs. This sounds like tricks demo scene coders use to coax sampled audio out of unlikely things like apple IIs and XT-era hardware.
- Nihilartikel 3y agoIt's not very far off to digital audio over PC speaker I'm sure! The AtTiny85 had a great setup for it though, a high speed PWM clock which gives you a 250khz carrier, so just use another hardware timer interrupt every 20khz or so to calculate the waveform and change the PWM duty cycle and boom - music on a pin!