Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
cyber-menace

Ambient Sounds

Recommended Posts

I've been wondering! How can I have Ambient sounds playing throughout my level. Right now I have 2 sounds, one that sounds like thunder and one that sounds like rain! How would I get these playing as an ambient sound. Also is there anyway to muffle the sound in sectors where the ceiling isnn't F_SKY1? This is all I need to know for now.

Share this post


Link to post

To make an ambient background sound, try this:

script 1 open
{
    AmbientSound("Any sound", volume); // The quotation marks need to be included
    delay(random(2000, 5000));
    restart;
}
This will make an ambient sound which will repeat at random times. However, ambient sounds are always heard throughout the whole map. To make a more realistic sound which fades the further away you get, try this:
script 1 open
{
    ThingSound(tid, "Any sound", volume) // volume can be between 0 and 127
    delay(random(1000, 4000));
    restart;
}
This will make a sound appear to come from a source instead of being heard all throughout the map. You'll need to make a mapspot with that tid for the sound source.

Share this post


Link to post

I think I'll go with the whole map. It could just be LOUD thunder eh? Now if I remove the delay that will make it continuous right?

Share this post


Link to post

Yes, but I would at least have some delay, even if it's only 1. Otherwise, you may end up with an infinitely loopong script in an infinitesimally small amount of time, causing the game to freeze.

Share this post


Link to post

I have the rain sound going on and on and on just fine with this script:

AmbientSound ("WATER", 75);
Delay (5);
restart;

But for some reason my thungder will only play once when I'm using this script:

AmbientSound ("THUNDER", 150);
Delay (Random (350, 500);
restart;

What's wrong with my thunder?

Share this post


Link to post
Tobester said:

I don't suppose the block sound linedef thingy would work?


No, that only blocks the sounds monsters can hear (and you need two of them IRCC).

Share this post


Link to post

AmbientSound ("THUNDER", 150); change to 127
Delay (Random (350, 500)); add a parenthesis
restart;

I'm surprised that the script compiled with that missing ')'.

Share this post


Link to post

I made that change, but it still won't go more than once. The random is set for 350 to 500 tics (10 to 14 seconds) but I wait for over a minute and there still isn't anything. Do you think it might have something to do with the water sound?

Share this post


Link to post

It shouldn't, but just in case, remove the rain script to see what happens.

Share this post


Link to post

Since rain is generally a lot quieter than thunder, you could make the rain use the ThingSound and thunder use AmbientSound. I'm not sure this will work though. Doom is sort of funny about how many sounds are played at once.

Share this post


Link to post

Have you made sure that the ambient sounds are defined in the sndinfo?

(sectorsound, thingsound, activatorsound etc. do not need defining as ambient, but ambientsound and localambientsound do)

Share this post


Link to post

I think I know what's wrong. My water sound is a few seconds long. My guess is that by the time the script restarted the water sound haden't even finished! This having the same file open so many times probably messed up the thunder script. Am I right?

Share this post


Link to post

Well what do ya know! I figured out a problem on my own for once. I guessed right! The WATER sound didn't have enough time to play! Therefore it messed up the pattern!

Share this post


Link to post

Why bother with scripts at all?

Using SNDINFO, you can set up ambient sounds to be played all over a level, locally, at random or regular intervals or constantly. All you need to do is define them then you can place them in a map wherever you want using your map editor. You can also activate/deactivate them to switch on and off the sounds if you want.

http://zdoom.notgod.com/reference/sndinfo.html


Edit: And of course, if you do want a thunder sound, you can put it in the WAD, and use the MAPINFO lump to give the level the lightning special. This will play the thunder sound at random intervals and flash a bright light in all F_SKY sectors. If you specify 2 skies, it can also be used to show a brief flash of a second sky with lightning forks drawn on it.

For an example of this, go along to my Tripod site and download the redsky demo file.

http://members.lycos.co.uk/Enjay001/

Share this post


Link to post

I looked at that, but I had already started with the scripts so I just went with them. By the way Enjay I tried taking a look at scripting in your maps, but you don't seem to use them at all! That surprised me. I'm really clueless on a lot of things I just try and learn as I go along.

Share this post


Link to post
cyber-menace said:

By the way Enjay I tried taking a look at scripting in your maps, but you don't seem to use them at all!


I do use scripts. I use them quite a lot now, but I used to have a minimalist approach to scripts as it took me a long time to get to grips with them. I'm still not a world class scripter by any means. Zdoom has fantastic and very flexible scripting possibilities but it also has a wealth of other features in addition to scripting and they are always worth considering.

BTW, here's a quick example of setting up an ambient sound using SNDINFO.

Put a sound in your WAD called DSALARM then put the following in SNDINFO

ALARM   DSALARM 
$AMBIENT 1 ALARM POINT periodic 10.0 1.0


That's all you need. Now you can use thing number 14001 to place an alarm sound wherever you want in the map. The sound is played every 10 seconds at full volume (and can be activated/deactivated using a script or an activate/deactivate line).

Share this post


Link to post

Enjay`s solution is a lot better, you define an ambient sound object that loops the rain sound and place one object in a map and through out the map you will have raining sound, and also you can define in mapinfo so that the level has thunder strikes and lightnings in outside areas and define the thunder sound ind sound info lump then you will have automatic thunder strikes with lightnings and the sound, also you can define the thunder sound to play different strike sounds picked randomly from a set.

Share this post


Link to post

Well I half know how to use the SNDINFO for ambient sound, but I don't know how to get lightning to strike on anywhere that has the F_SKY1 texture so all I can say is TEACH ME! PLEASE!

Share this post


Link to post

Well that now... is not only incredibly easy... it's also very cool. Good call Epyo. And thanks.

EDIT: How could I synch this with my ambient sound though?

Share this post


Link to post

The lightning effect has its own thunder sound, which plays when the lightning flashes.

Share this post


Link to post

The lightning is far too slow. I don't even know how often it strikes. How can I set the lightning up so it comes every ten seconds?

EDIT: If there's no way to make the lightning go with the thunder than is there a way to synch the thunder to the lightning?

Also that sound that goes with the mapinfo lightning doesn't work.

Share this post


Link to post

I remember a little known script that a couple of old Hexen maps (including one of mine) that can trigger a lightning flash, even if there was no lightning listed in the mapinfo.txt. It's either ForceLightning, ForceThunder, or something like that. I can't remember right now and I don't have any way of finding out anytime soon. Try looking at this old thing to see what it was.

Share this post


Link to post

I have an idea but I doubt it will work. Is there anyway you can set up how often the lightning goes using the MAPINFO lump. If not then what's another way to do it. I really need to know.

Share this post


Link to post

I don't think lightning frequency can be altered via mapinfo. If you want to change the "weather" during play, you can use a script to simulate the lightning effect.

Give any sectors you want to flash with lightning a tag, very briefly raise their lighting level, then lower it again, play a sound and then have a random delay in the script before restarting.


2 things related to the MAPINFO lightning function you may be interested in.

1: There are 3 sector types 197 Outdoor lightning, 198 indoor lightning, 199 indoor lightning brighter.

The indoor lightning ones are used to identify a sector that should flash when the lightning strikes, even if they do not have F_SKY1 on their ceiling (useful for doorways etc). The outdoor lightning is intended to allow full outdoor ligtning in a sector without an F_SKY1 ceiling. Useful for getting a lighting flash in a skybox.

2: Lightning scripts. If you make a script a lightning type (instead of open, (void), etc) it will be executed everytime lightning strikes in your level.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×