Homebrew Pinball #3, Part 74

Cross posted from the original Pinside thread, this is one of many posts regarding my third homebrew pinball machine, creatively nicknamed 'P3'



In between these playfield changes I've been making a bunch of tweaks to the code. I added another multiball, rounding out the main hands (straight, flush, and full house). Added a mystery award which is really fun but hard to explain via text. Lots of tweaks and bug fixes. But mainly I've been working on sound!

The game now has more than 100 sound effects and callouts (and still many to go). At first I was agonizing over trying to find some good sounds that fit everything well, etc, but I've realized that you don't need a 10/10 sound effect to add quality to the game. Even a 5/10 sound effect is way better than no sound effect, as long as you've got them everywhere. Sadly I've also realized that making 5/10 sound effects is way harder than I'd have guessed. I've spent a bunch of time with a mic, a few poker chips, and a deck of cards, making random sounds by hitting them against each other, etc, trying to get some good, real, 'poker' sounds to put in.

On the software side, I did some research into how other games handle sounds. Playing one sound is simple enough, but it seemed like if I just played every sound that came in (and every call out, etc) things would get messy. You never want two callouts at once, and I figured you may not want multiple sounds at once either, so there needs to be some system in place for that. Sadly, it turns out that getting Java to play a sound, and then kill that sound mid way, adjust volume on the fly, or even just get the length of the sound are all more complicated than you'd expect. I ended up writing a custom mixer to combine a music channel, a voice channel, and a few sound effects channels together on the fly, which gave me the level of control I wanted. Currently I've got a simple system set up where, if a sound is playing on a channel, nothing will interrupt it (after like 50ms). If you try to play a sound but there's already another one going, that new sound is ignored. If two sounds come in at once (which happens a lot since I might have the base game make one sound effect, but then the mode you're in at the time makes another), I just choose the longer one. Originally that was a hack until I could code some proper 'priority' system in to let me manually order the sounds but so far it's worked surprisingly well so I haven't had the need to go further. I've also implemented some ducking, so the music and effects will get quieter when there's voice playing, and the music will get quieter when there's effects playing. Took a bit of play to get that to sound natural, but once it did it worked well.

Posted Tuesday, November 16, 2021
at 11:41 AM


Tags: Blog Post, Pinball, Project, P3,


blog comments powered by Disqus