Forest audio ambience

forestambience.jar

@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)

this is really cool, the frog and the crickets playing at the same time sounds weird

Thanks!
It’s a simple matter to turn one or the other up or down.
At the local creek it is possible to hear both. (El Cerrito CA, where I recorded the frog and the creek noise used in another demo).
But I can see probably that in most places it might be one or the other.

This is impressive! I’d add a water stream somewhere :slight_smile:

:slight_smile:
I did a brook earlier! The following jar also has an endless campfire and procedural windchime (as well as an earlier iteration of the frogs and crickets).
http://hexara.com/peacefulbrook.jar
The file is a bit larger (around 2.5 MB) because I used wav files with zip compression instead of ogg. I should redo this. The size would be something like 4x’s smaller.

If I had a game to put them in, a new jar with a single api would be set up, of course.

Why don’t you share some of the generated audio as files.

For games we have screenshots, to lower the effort of getting a feel for the project - same could be done here (i’m on my phone, couldn’t run a jar to save my life…)

This is fantastic! however, the crickets are really annoying they overlap/get out of sync creating a wavy effect…

[quote]Why don’t you share some of the generated audio as files.
[/quote]
Has anyone set up Audacity to capture the output from a Java file?

If I knew how to set that up, that would be the easiest way to go. I’ll have to poke around and figure out how Microsoft is routing things. Yeah, I’m claiming to be a “sound guy” but I kind of clumsy/ignorant with OS routing and stuff like that. I’ve put most of my energy into coding within Java context, not OS configuration. :stuck_out_tongue:
[Stupid: the unit I bought for i/o only has low impedance inputs and my main mixer doesn’t have these as outs, so I can’t run the sound out and back in without swapping the mixer being used. And the miniplug stereo mike ins aren’t working for me as an alternate path.]

Alternatively, I could add some code I wrote elsewhere to capture and export, but it will take a little while to implement.

I’ll add this to the queue, since there is positive interest and a direct request!

[I just got my “ClipSectionChainer” working, a first test where it is taking fragments (via pointers into) from three different clips and chaining them together into a single play. Am using it to append/crossfade two thunder recordings and a thunder-fading away ending, making a nice long multistaged roll. Want to test more radical sectionings to see if I can vary the thunder enough so that the underlying recordings are not obvious. Looking forward to putting up the “rain” jar soon, too.]

I’ve had other comments on the crickets, as well, wishing to tweak them.

I spent some time on a hillside a while back, listening to the crickets and it seemed to me they weren’t particularly paying attention to each other. When a lot of them get going, I think there IS a lot of overlap and sync changing and phasing effects. We do have to avoid comb-filtering! With really large populations (memories of visiting relatives nearby to Baton Rouge as a kid) the sound can be very intense.

But even if one achieves veracity, that doesn’t mean that this is what will "reads best as a cue in a game or as an SF/X in a film.

The controller I wrote for the individual crickets is called a “SoundBlinker”. It is set to take a number of sources and occasionally stop and restart them, the odds and length of times being determined by parameters to a random number generator.

It seemed to me that having a cricket occasional pause or skip a ‘crick’ would be a good thing. But doing this can also call attention to the cue. Getting the right balance of activity seems tricky, and probably varies with the environment and desired dramatic tone.

tldr: There is a tool to change settings which may make it more to your liking.

I’ve setup reaper to record windows sounds in the past, I remember it being pretty easy. Not sure about audacity though.

About the crickets, I didn’t mean to come off as harsh as I’m sure it is difficult! Also, I don’t tend to pay that much attention to them so I’m sure you’re right.

No worries. I hope I didn’t sound like I was getting really defensive.

And I didn’t mean to make it sound like it is all that difficult, at least from the point of view of being able to tweak things. There are probably some super-geeky SF/X ninjas that really know their insects and would be able to tell us just how to do it and have it be this or that species or genus and at such and such an altitude and temperature. But if one has a clearly defined model, it shouldn’t be too hard to match it or fake it.

Reaper looks interesting. I already have Sonar but it is on another PC that has kind of been mothballed (no keyboard or monitor or internet connection.) I recall having to send a line out and back in for that too (and watching out for feedback). Not sure what I did with the connectors for it.

If someone wants to make a recording and post it on this thread, that would be appreciated!

[For the “wind/rain/thunder”, I now have the GUI set up, and the ClipSectionPlayer tool debugged, and have been experimenting with chaining slices of thunder, playing them back at different speeds. I think it is going to work. Am working on the auto-generator for the thunder, setting it up so that each clap is unique.]

You can use Audacity to record windows sounds, and it’s quite easy too :slight_smile: If you want me to record a sample from your jars please let me know, I’d be happy to help you this afternoon or during the weekend.

[quote]You can use Audacity to record windows sounds, and it’s quite easy too Smiley If you want me to record a sample from your jars please let me know, I’d be happy to help you this afternoon or during the weekend.
[/quote]
That would be great! After you post, I can put the links provided into the first post and credit you.

An explanation of how to set up Audacity to do this could also go in one of our tutorial or resource sections.

And I’m done :slight_smile: To record sounds using Audacity, the only thing you need to do (assuming your jar is the only process actually outputting sound on your computer when you do so) is to select Windows WASAPI as the ‘Audio Host’ (right under the Pause and Play buttons), then hit Record… At least this is what works for me!

Here are the 3 recordings I made (~30 seconds each; sorry if they’re not loud enough, too):
Forest Ambience - ‘day’ preset
Forest ambience - ‘night’ preset (I don’t think I got a single fox howling, too bad…)
Peaceful Brook

These files are currently on my DropBox; I don’t mind if you directly use these links, but I might at some point delete them (quite unlikely though). :wink:

Oh, also, don’t worry about giving me credit for these hahah, I don’t deserve any; all I did was record your jars for you!

J0 :slight_smile:

Thanks, J0! I will try your instructions. It is my own fault I set the default volumes on the gui’s too conservatively. If I can I will redo and post audio–meanwhile will use your links.