@ags1 will recognize this!
I thought I’d go ahead and post this “in progress” audio jar. Much to do still but I think it gives a good demo of what is achievable using Java to create ambient sound for a game. This jar is just 1MB, and on my PC registers around 1% CPU when active.
I set this up for two soundscapes: one for day and one for night. There are various effects that contribute. Hit “Play Day” or “Play Night” to hear the mixes I hard-coded. Change the sliders and hit “Save” and the mix can be recalled (during the session only, I didn’t do save to file yet for this).
Nothing is being looped in the normal sense. All the sounds have random elements so the background sound should never repeat exactly (astronomical odds).
A couple of the sounds are synthesized. Most come from fragments of SF/X gleaned from freesound.org. I’m running them via classes that schedule varied playback in various fashions. The wind, for example, uses a “continuous slicing” technique combined with a low frequency random wave for the volume. Some of the fragments are played back at semi-random time intervals with slightly different pitches/volumes/pans. The woodpecker has been broken into start/middle/end and the middle is repeated a variable number of times. There’s lots of little tricks like that.
The simple GUI sliders correspond to api inputs, one per each SFX, with ranges from 0…1.
On the TODO list: ability to code one’s own “behavior” for the SF/X “creatures”, in particular, to set up a parameter for timing/likelihood. Also, figure out some better timing behavior algorithms! When left on for a longer period, some of the SFX start to wear out their welcome, as well as could do a better job of suggesting a real living creature is making them.
I was working on a low-to-moderate intensity wind/rain combo cue to add to this, and had an idea for a low-frequency noise wave that seemed kind of neat: random number-generated line fragments with multiple box filter passes to round the corners. I’m experimenting with that right now, sped up to audible rates rather than low-freq, as a cheap way to make gunshots/explosions/engines/etc. The box filtering seems to lack any Q but there are still things that can be done, and box filters are computationally really cheap.
To go with the rain, I also have a pair of thunder SF/X. I was in the middle of writing code to allow generating variable-length thunderclaps by mixing slices from the two cues. I think it is going to sound pretty cool but the original cues are somewhat “distant” in quality, so no super-close dramatic claps will be available from this source.
Anyway, the idea is more to suggest what is doable with no budget, and what could be possible with a decent budget for effects and skilled sound design.
A couple audio wavs that J0 recorded for me (posted below):
forest day wav
forest night wav
Further down the PeacefulBrook jar is mentioned – here are two recordings I was able to make (thank you J0 for the help!) of two “endless” components – each is an original recording of about 4 seconds played via a “slicer” tool, thus always changing rather than looping:
endless brook ogg (recorded nearby Cerrito Creek–could definitely use a less noisy initial recording)
endless campfire ogg (from a freesound.org cue, I’m pretty sure it was #170247, with some processing)