Devlog №5
I added sound effects for every button press on my mini-console! Sounds like a super quick and easy task, right? Well, it should have been. But a few architectural bumps in the road ended up eating way more time than expected.
What went wrong (and how I fixed it)
-
Hardware Pin Conflict:
My buzzer was originally soldered to a pin used by
SPI. As soon as the display initialized, things went sideways. -
Game Loop vs. Main Loop Architecture:
My game logic was running inside an infinite loop within a standalone function, while the sound playback logic lived in the main loop calling that function.
Solution: soldered the buzzer to another pin and quick architecture refactor solved both problems pretty easily — I spent about an hour on each issue.
The Biggest Problem: A very loud buzzer remains the biggest and unsolved issue.
I tried to tame it in software using PWM (Pulse Width Modulation) to decrease the volume. But PWM control is tricky on its own, and since the buzzer relies on a fixed frequency to generate tone, layering custom PWM over it completely broke the audio pitch.
Next Up:
- Implement smooth scrolling text for the console startup screen.
- Conquer this cursed PWM/volume issue once and for all.
- Start writing a Flappy Bird clone
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.