Sound, target_speaker etc.

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Sound, target_speaker etc.

Post by Bliccer »

I wanted to write a bigger tutorial about sound for q3a.ath.cx.

Background: I built some kind of a jungle map. Looks neat for a tut map, imo. Now I want to add ambient sounds (fire, birds etc.), music and change some default sound effects.

And here are my problems:

1. Buttons: I connected the button to a target_speaker. Nothing happened, played default sound. I connected the button to a target_delay and this one to a target_speaker. Now it plays both button sounds. Is there any way to avoid the default one?

2. Doors: I have no clue how to change a door sound. One approach would be over a frags_filter. But first, this one is only available in Defrag and second, the game would still play the default sound. Is there again a way to bypass the activating of the default sound?

3. Jumppad: I could change the sound via a trigger_multiple connected to a target_push which is again connected to a target_position. The trigger also activates a target_speaker with the new sounds. Works perfectly. Just one thing. When I have the music in the background and have the volume for effects on max. and the music level on half I still can't hear the jumppad sound. Or, well, not as loud as without music. Is there any way to make it louder than to edit the jumppad sound itself?

Thanks for help!!

Added: I just came across an error: "No data chunk in *.wav". I also found a program which could then fix my wav. Perhaps someone is interested: http://www.btinternet.com/~AnthonyJ/projects/FixWAV/

One more: Didn't know that music defined by the worldspawn MUST be stereo and the rest of the soundeffects over a target_speaker MUST be Mono.
In other games it's like this: Mono plays on a constant volume if you are near the sound source; Stereo plays on the right loudspeaker or the left and varies where you stand; distance, left, right...
Last edited by Bliccer on Wed Apr 14, 2010 8:35 pm, edited 1 time in total.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

the entity inspector used to list all option for speakers and buttons...

Code: Select all

target_speaker

Map Entity Color: bright green
Dimensions: (-8 -8 -8) (8 8 8)
Game Function: Sound generating entity that plays .wav files. Normal non-looping sounds play each time the target_speaker is triggered. Looping sounds can be set to play by themselves (no activating trigger) or be toggled on/off by a trigger.

Keys
noise: path/name of .wav file to play (eg. sound/world/growl1.wav - see Notes).
wait: delay in seconds between each time the sound is played ("random" key must be set - see Notes).
Random: random time variance in seconds added or subtracted from "wait" delay ("wait" key must be set - see Notes).
targetname: the activating button or trigger points to this.
notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).

Check Boxes/Spawnflags
LOOPED_ON: sound will loop and initially start on in level (will toggle on/off when triggered).
LOOPED_OFF: sound will loop and initially start off in level (will toggle on/off when triggered).
GLOBAL: sound will play full volume throughout the level.
ACTIVATOR: sound will play only for the player that activated the target.

Notes

    * The path portion value of the "noise" key can be replaced by the implicit folder character "*" for triggered sounds that belong to a particular player model. For example, if you want to create a "bottomless pit" in which the player screams and dies when he falls into, you would place a trigger_multiple over the floor of the pit and target a target_speaker with it. Then, you would set the "noise" key to "*falling1.wav". The * character means the current player model's sound folder. So if your current player model is Visor, * = sound/player/visor, if your current player model is Sarge, * = sound/player/sarge, etc. This cool feature provides an excellent way to create "player-specific" triggered sounds in your levels.
    * The combination of the "wait" and "random" keys can be used to play non-looping sounds without requiring an activating trigger but both keys must be used together. The value of the "random" key is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random).

Code: Select all

func_button
Map Entity Color: N/A
Dimensions: size of map components used
Game Function: When a button is touched by a player, it moves in the direction set by the "angle" key, triggers all its targets, stays pressed by an amount of time set by the "wait" key, then returns to its original position where it can be operated again.

Keys
angle: determines the direction in which the button will move (up = -1, down = -2).
target: all entities with a matching targetname will be triggered.
speed: speed of button's displacement (default 40). Speed is in game units per second.
wait: number of seconds button stays pressed (default 1, -1 = return immediately).
lip: lip remaining at end of move (default 4 units).
health: if set to a non-zero value, the button must be damaged by "health" amount of points to operate.
light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).

Notes
Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value. 
Last edited by skinNCNmaster on Wed Apr 14, 2010 8:34 pm, edited 2 times in total.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

yu may want to work a timer into things if you looking to have an effects loop that continues for a long time with spacing between replays

Code: Select all

unc_timer
Map Entity Color: Dark blue (0.3 0.1 0.6)
Dimensions: (-8 -8 -8) (8 8 8)
Game Function: Time delay trigger that will continuously fire its targets after a preset time delay. The time delay can also be randomized. When triggered, the timer will toggle on/off.

Keys
wait: delay in seconds between each triggering of its targets (default 1).
random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
target: this points to the entities to trigger.
targetname: a func_button or trigger that points to this will toggle the timer on/off when activated.
notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).

Check Boxes/Spawnflags
START_ON: timer will start on in the game and continuously fire its targets.

Notes
When the random key is set, its value is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random). 
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Sound, target_speaker etc.

Post by Bliccer »

I have a solution for the button now by sst13.
But the doors?
I connected the door to the speaker. Now first the default sound plays and afterwards my sound.
And if the door shuts only the default sound plays.

@skin: I don't get what you want me to say by this. I mean there is already such a function by the trigger_always.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

show us the entity data
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

oh and i was just posting the relevant entity help info, cause its a good base for your issue..

as for the timer.. a button can trigger a thing AND connect to a relay which starts a timer to trigger a second thing and continue through as long a relay chain as you want to create the overall sound loop.. kind of like mario when he stands still.. timer.. tick tick tick, mario looks around.. tick tick tick.. mario scratches head.. tick tick tick.. mario takes off hat... tick tick tick. mario lays down and goes to sleep... tick tick tick mario dreams and talk "linguini".tick tick tick"spaghetti" tick tick tick snore... get it? daisy chain of environmental type effects with variable locations
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

I believe the door sounds are hard coded. There is a hack involving making the origin of the door far away from the player, thus removing the source of the default sound to a remote location. Then triggering a trigger_multiple or something to trigger the speaker when the door is activated.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
sock
Posts: 424
Joined: Sat Sep 09, 2000 7:00 am

Re: Sound, target_speaker etc.

Post by sock »

Button, doors and platforms are hard coded to play certain sounds. You can replace the default sounds with your own one's if you want but this will affect all other maps based on pk3 load sequence. The button sound is really quiet and can easy be drowned out with your own sound instead. The door sound is crazy loud but you can move the origin of the func_door by including a brush over 2000 map units away so the sound is played too far from the player. You can replace the default one's with silent samples and then just use triggered versions instead.

Looping sounds do not pay any attention to portals, it seems to be based on distance the player is from the entity. I once tried to kill a looping sound by putting it behind a closed door with a portal inside and the sound kept playing. If a button is retriggered before it has reset, it will not play a sound again, while the door will keep replaying the sound every trigger event.

Sadly the sound system lacks any real volume control or channel priority so all sounds are mixed together with no user control. The volume is normalized by the engine so increasing certain sounds to be louder does not work. (The actual volume of the sound sample is not what is played by Q3)

Looped_off does not work and it easy to fill up a map with constantly playing sounds if you are not careful. You can start looped sounds off at map start but once they are triggered they stay on. This can cause problems with older hardware and appear as crackle or sound distortion. (Sometimes even crash Q3 if the sound system is overloaded) The best thing is to arrange groups of sound entities with wait/delay triggers so the soundscape builds up over time and is not constantly on. (This is something I do in most of my recent maps and if you are interested you can check my source map files for examples)

target_speaker does count towards the total entities loaded in a map and it is possible to reach the map entity limit by using too many. Generally it is better to use a wide variety of spot sounds and set the music track to be something quiet just to fill the gaps. Most people hate/switch off worldspawn music tracks due to the amount of idiots that include crap playing on small loud loops and drowning out any important gameplay sounds like item/weapon pickup sounds.
Well he was evil, but he did build alot of roads. - Gogglor
My [url=http://www.simonoc.com/]Website[/url] & [url=http://twitter.com/SimsOCallaghan]Twitter[/url]
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Sound, target_speaker etc.

Post by Bliccer »

The thing with placing a brush away is the same sst13 showed me yesterday.
For the doors: the target_speaker is getting played. But only once of course. How could I set the entity to play automatically when the door shuts again? Don't think that there is any way, right? I mean it's not possible to stop and start a sound? (except looped_off... but sock already told me.)
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

yeah use a relay and a timer to time it to play a second time after the door close time duration
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Sound, target_speaker etc.

Post by Bliccer »

Oh yeah. Of course -.-
Didn't think about too long though ;D
cityy
Posts: 1020
Joined: Mon Aug 10, 2009 8:23 am

Re: Sound, target_speaker etc.

Post by cityy »

Sorry for abusing your topic Bliccer but I've got a question:

I want a sound to be heard all over the map so I create a target_speaker and check the "globally" box. (I also checked Looped_On) Now the target_speaker has spawnflags 5 in the entity inspector... Though the sound still is only hearable if I stand right to the speaker. What am I doing wrong here?
www.ferdinandlist.de/leveldesign
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

skinNCNmaster wrote:yeah use a relay and a timer to time it to play a second time after the door close time duration
I don't think the timer will work. What if the player is standing in the doorway leaving it open? The timer will count down and the close sound will initiate before the door actually closes.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

that would involve another trigger then.. one to force the sound not to play if the player is in the trigger.. possibly...
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

That would be ideal, but the problem is func_doors don't have a closing event trigger. In other words, it's not possible. Too bad.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
User avatar
Theftbot
Posts: 483
Joined: Thu Oct 08, 2009 4:03 am

Re: Sound, target_speaker etc.

Post by Theftbot »

cant you use a train to make a door then have the end path_corners trigger a sound.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

obsidian does not think it is possible.. in any way shape or form.. hes the dude... comes in to say.. nope, your idea is no good.. won't work etc. and does not have any ideas, suggestions or directions you might go in.. leads...


the train idea in place of a door is solid... though.. according to obsidian.. and he is the dude... its not possible.... your fired.

so when you do get this working... and it does function.. which im sure it will.. don't forget to say i told you so.. lol
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

FFS, you need to chill out.

If func_doors are hard coded to behave the way that they do then there's nothing you can do about it without actually changing the source code. Why are you getting mad at me for just pointing this out? Did I say your idea is a bad idea? No, on the contrary it would have been ideal had it been actually programmed to work that way, but unfortunately it's not. Don't blame me if you didn't completely think your way through your solutions before posting. Had you actually read what both sock and I said above, maybe you would have known this too.

Do you think I pointed this out just to spite you? I don't have enough hours in the day troll you had that been my intention. Rather, I pointed this out to save other people like Bliccer from having to test your idea when I know that it would not have worked as expected. Stop trying to read between the lines and trying to pick out stuff that you think is a personal attack. You shouldn't pad your ego into thinking that you are somehow important enough for me to constantly think of ways of "getting at you". Quite frankly, I don't give a flying fuck so just drop it.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Dark Metal
Posts: 5496
Joined: Sun Feb 20, 2000 8:00 am

Re: Sound, target_speaker etc.

Post by Dark Metal »

This guy looks upsetted on the interweb.
[WYD]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

interweb is serius bizness.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Sound, target_speaker etc.

Post by obsidian »

Increasing sound volume: sock is right about volume being normalized by the engine. Though you can use more than one target_speaker with the same sound placed in close proximity to each other to give the effect of a louder volume.
cityy wrote:I want a sound to be heard all over the map so I create a target_speaker and check the "globally" box. (I also checked Looped_On) Now the target_speaker has spawnflags 5 in the entity inspector... Though the sound still is only hearable if I stand right to the speaker. What am I doing wrong here?
Yes, curious. I tried this on a test map just now and it doesn't work. It's possible this is a feature that isn't supported by Q3 but by other games and somehow filtered its way into the entity definitions. Or perhaps there is something wrong with the way the compiler handles it. You might want to see if someone with the source code might be able to figure out exactly what's going on. Misantropia?
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Sound, target_speaker etc.

Post by ^misantropia^ »

Spawnflags 5 is 1 (loop) + 4 (broadcast) and should work as expected. Does your 'noise' key start with an asterisk? That makes it activator-only, i.e. only the client that triggers the target hears it.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Sound, target_speaker etc.

Post by skinNCNmaster »

been digging on the net for anything related.. found this tidbit also..
Some of func_door entities uses special option spawnflags 32 to mute doors sound that is used
only by the excessiveplus mod.
Try the mod with it you wont hear any sound on stargates, ring transporters and on catapolts
(jumppads) and others...
then i figure.. if you mute the door sounds...
you put a trigger for the sound to turn on when you are in trigger....inside the door...

and then another trigger on either side of the volume created by the door sound trigger... so that when leaving the door/trigger once sound.... one steps into the trigger door close sound brush.. then its more a matter of the spacing.. the size of the three triggers.... have to play with it a bit in quake... umping in and out of the sound triggers and watching the coincidence with the door motion...

the only trick here.. is the stepping into the close trigger brush from the outside....

maybe necessary to make the two close door triggers into trains or movers of some kind.. so the the in the door trigger activates them to rise into place when a player is in the door and then to lower out of the way when they've been triggered. meaning the close door sound triggers are normally below floor level..

and client activated for the door close.. hmm this could get complex.. when there are multiple players activating the trigger set.. possibly a set of relays would help.. i seem to remember a really complex relay tutorial from ydnar or someone a few years ago..
Last edited by skinNCNmaster on Mon Apr 26, 2010 6:57 pm, edited 3 times in total.
cityy
Posts: 1020
Joined: Mon Aug 10, 2009 8:23 am

Re: Sound, target_speaker etc.

Post by cityy »

^misantropia^ wrote:[...]Does your 'noise' key start with an asterisk? [...]
I am not sure what you mean - the sound file is sound/world/water1.
www.ferdinandlist.de/leveldesign
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Sound, target_speaker etc.

Post by ^misantropia^ »

You could set it to '*sound/world/water1' and it'd be activator-only. A little used feature, I suppose.
Post Reply