Environmental Sounds!

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Mewmew
Red Slime
Posts: 47
Joined: Thu May 05, 2011 5:19 am
Contact:

Environmental Sounds!

Post by Mewmew »

Hello! And thank you for taking the time to look at this thread!

I was wondering if there's any way to place in a looping environmental sound that gets progressively louder when the hero gets closer to it?

An example would be... a waterfall, you can hear it from the distance, and it gets louder as you approach it... Is there a simple copy/paste example that someone can kindly provide through hamster speak? I'd really appreciate it! Thanks again for the help!
ImageImage Arien and Fran HD Sprites
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Unfortunately it's not yet possible to set the volume of a sound effect, so you can't even script this (IIRC, the music volume, which you can set via script, doesn't affect sound effects). But that's definitely something I want, in fact I'll try to add it in the next few days. And I want to be able to place environmental sound sources in the map editor so that the volume attenuation and left/right panning is handled automatically. I just need to figure out how to handle large (non-point-source) sound sources like a river.
Chronoboy
Slime Knight
Posts: 281
Joined: Tue Nov 30, 2010 6:01 am
Location: Canada

Post by Chronoboy »

This would be an awesome feature, it would make games feel much more modern and less silent when it comes to ambient sound effects.

Is there plans to implement sound channels? Say one can increase/decrease the volume for a whichever sound effects are assigned to a specific channel?
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I'm not happy with the way sound effects currently work, which doesn't allow playing the same sound effect multiple times at once. Ironically that was how sound effects worked when they were first implemented -- you had to specify channels on which to play them -- but that interface is deprecated, because manually managing channels was too awkward. I need to figure out a better way.
Last edited by TMC on Thu Jan 05, 2012 1:44 pm, edited 1 time in total.
User avatar
Pepsi Ranger
Liquid Metal Slime
Posts: 1419
Joined: Thu Nov 22, 2007 6:25 am
Location: South Florida

Post by Pepsi Ranger »

I seem to recall fading sound sources being one of the arguments for implementing zones.

Mewmew, if fading sound effects isn't implemented in the next few days, what you could do, and this will suck but it'll work, is create several consecutive zone rings around your source (or walls, if your source is a river or something elongated), and then attach a "read zone" command to an each-step script that checks which zone you're standing in, and plays a specific sound that you have assigned to that zone. The reason it will work is because you can have each zone play the same sound at a different volume level. The reason it will suck is because you'll have to manually rerecord those sounds at different volume levels, import each version of the sound effects, and script each version of the sound to stop playing as each new version is triggered. You'll also run the risk of the sound effect "skipping" as each new volume level will likely reset the sound effect.

But, volume fading will get implemented eventually. TMC has been talking about it since before zones were introduced. He's also, incidentally, been talking about scripts getting triggered upon entering and exiting zones, which he still hasn't had a chance to do, but has been saying he'll do for months now. (That's an elbow to the side, TMC, as I'm sure you've figured out.)
Place Obligatory Signature Here
User avatar
Mewmew
Red Slime
Posts: 47
Joined: Thu May 05, 2011 5:19 am
Contact:

Post by Mewmew »

Wow... thank you for all the replies! I see that it isn't quite implemented yet... Thanks for the thorough explanation, Pepsi! Unfortunately, I have no idea what zones are... and not brave enough to test it. XD

It's no biggy if there's no simple way to do it for now, I can manage without it, but thanks for the replies!
ImageImage Arien and Fran HD Sprites
User avatar
shakeyair
Slime Knight
Posts: 215
Joined: Fri Jun 12, 2009 6:15 am

Post by shakeyair »

just posting to say i am super excited about this becoming a thing the OHR can do.

even adjusting sound effect volume (preferably individually) would be a huge step for the engine in terms of professional presentation and atmosphere.
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

It's been three weeks? Felt like a week!

Update: after getting seriously distracted by other features, I think that I will finally get this done "in the next few days".
Pepsi Ranger wrote:TMC has been talking about it since before zones were introduced. He's also, incidentally, been talking about scripts getting triggered upon entering and exiting zones, which he still hasn't had a chance to do, but has been saying he'll do for months now. (That's an elbow to the side, TMC, as I'm sure you've figured out.)
Next few weeks.
Pepsi Ranger wrote:I seem to recall fading sound sources being one of the arguments for implementing zones.
Zone triggers are good for non-directional sound effects (or music) which play while you're in a zone. But more sophisticated environmental sound effects, such as a point source which becomes much quieter when you leave the room (and is also attenuated by distance) could be modelled as a point source plus a zone. And what about a moving source (e.g. NPC footsteps) that is diminished when you're not in the same room/zone as it?

This might all sound like overkill, but I think that if I implement it, people will use and appreciate it. Unlike some of my other overkilled features.
Last edited by TMC on Thu Jan 26, 2012 6:08 am, edited 1 time in total.
User avatar
MirceaKitsune
Red Slime
Posts: 43
Joined: Mon Jan 23, 2012 7:50 pm
Location: Romania, Bucharest

Post by MirceaKitsune »

Pretty sure it's not possible yet, but I love the idea and wanted to suggest it too. So please do consider it :)

If this gets implemented, it could also allow stereo sound based on the hero's position from the source. Might be a bit tricky with top-down movement, but it would be fun.
User avatar
Newbie Newtype
Reigning Smash Champion
Posts: 1873
Joined: Mon Oct 15, 2007 9:44 pm

Post by Newbie Newtype »

Is it possible to work-around this by just making different sound files and set the volumes of each externally?
User avatar
msw188
Metal Slime
Posts: 783
Joined: Tue Oct 16, 2007 1:43 am
Location: Los Angeles, CA

Post by msw188 »

to NewbiePower:
yes, this seems to be what Pepsi Ranger essentially said.

to TMC:
Setting point sources (or NPC sources, as in your walking example) for sound seems like an amazing idea, and not overkill at all. Unless you mean overkill for the coding and/or runtime memory eating, which I guess might be possible...? Is there a limit to how many sounds can be playing at once? Should they automatically be normalized and/or compressed so things don't get bizarrely loud? I don't know anything about how this works, I'm just spouting stuff off that pops into my head.

to Pepsi:
I was the one (or maybe one of the ones) who mentioned using zones for sound effects and/or music, but this idea for sources sounds much better, AND more intuitive.
I am Srime
User avatar
Pepsi Ranger
Liquid Metal Slime
Posts: 1419
Joined: Thu Nov 22, 2007 6:25 am
Location: South Florida

Post by Pepsi Ranger »

to Pepsi:
I was the one (or maybe one of the ones) who mentioned using zones for sound effects and/or music, but this idea for sources sounds much better, AND more intuitive.
Ambient sounds came up in the IRC discussion TMC and I had when he was getting the idea to implement zones to make my insane boxing of sections (which I used mainly for sounds, though also for minor cosmetic effects like sprite changes and whatnot) more sensible. So, he's been considering how to use zones to control sound effects since before zones were made public knowledge. The fading of sounds, I'm certain, was part of the discussion, since I recall the jagged river in my massively huge forest map being a pain to script for sound proximity without zones, and the novelty of hearing the river grow louder as the player approaches was part of the consideration. I seem to recall that a lack of volume control for sound effects was also thrown into the discussion at some point, and the reason the conversation about proximity didn't get very far that day.

But yeah, he's been talking about it for awhile. Just not publicly. I'm glad that a solution for it is finally underway.
Place Obligatory Signature Here
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

msw, I didn't mean that point sources were overkill, but rather the more complex stuff, like having a (zone based?) emulation of sounds quietening when you're in a different room from the source or there's some other obstacle in the way. I'm just not sure how to do that: a single zone isn't sufficient if your map can't be split into "inside" and "outside".

EDIT:
You two, Jabber informs me that he would like to take credit for the idea as well!
Is there a limit to how many sounds can be playing at once? Should they automatically be normalized and/or compressed so things don't get bizarrely loud?
music_sdl currently has a limit of 8 sound effects, which I think is fairly reasonable (maybe raise it a bit), and music_native/2 apparently has no limit. I would just stop the sound effect that's been playing for longest when the limit is reached. I've never heard the normalising/compressing idea before; does anyone else do that?
Last edited by TMC on Fri Jan 27, 2012 2:07 pm, edited 2 times in total.
Post Reply