Jump to content


Photo

Getting started with the EFX room reverb system (wip)

sound openal efx reverb delay tutorial

43 replies to this topic

#1 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 30 November 2017 - 06:00 AM

*
POPULAR

With TDM 2.06 mappers and players can use OpenAL EFX system, which is basically an open-source software replacement for systems like EAX, which, at the time, was available only for dedicated hardware by Creative. This allows us to set reverb definitions for rooms, and in my opinion, it's a game-changer for TDM FMs. If you ever played old Thief games with EAX-enabled hardware, you know what I mean. Otherwise, try playing Kingsal's Volta and the Stone with EFX On and Off to see the difference. It's a new life for game environments.
 
 
The EAX reference page in the Wiki can be quite intimidating though, there are many values to tinker with. I have some basic sound recording experience, but I'm not an audio guy. The purpose of this thread is to create clear guidelines for other non-audio guys. If you're an audio guy, these values will be familiar to you, because you can find similar parameters in Reverb plugins, e.g. for Adobe Audition. (Btw. feel free to correct me whenever I'm wrong about something.)
 
First off, your map has to use location system. EFX system needs location names, and it will define reverb per location. It also needs location separators touching visportals to make proper transition between reverb for different locations. Create 'efxs' folder in your project root folder, create a text file map_name.efx, and open it. Now, first thing EFX system needs is a version number, so every .efx file needs start with Version 1 (I don't think any other number works).
 
So, a typical .efx file with room definitions looks like this:
Version 1

reverb "location1_name_here" {

values here

}


reverb "location2_name_here" {

values here

}
etc.
 
 
And that's it. It seems like you don't need to include every parameter you see in the Wiki reference. Some variables don't do much or hardly do anything. Even if you delete something, the system will use the default value. You can have an empty set like above, and you won't break anything. You can also change the order of parameters, e.g. if you have your own workflow.
 
Even then, making efx presets for all your locations manually can be really time-consuming. I bet a lot of mappers will want to make this as fast as possible, so they can move to more important things. That's where default presets come in handy. I prepared a set of general-purpose presets you can use in your locations. I tested them both on headphones and speakers, and they tend to sound quieter on speakers. If you think a preset is too quiet or too loud for your location, just put a "room" parameter in your definition, to change the volume. -1500 is the default value, and the volume range is from -5000 to 0 where 100 equals 1 db. Also, feel free to modify these presets as you wish:
 
// Castle courtyard
"environment diffusion" 0.6
"room hf" -1500
"room lf" -2000
"decay time" 2.13
"decay hf ratio" 0.61
"decay lf ratio" 0.23
"reflections" -500
"reflections delay" 0.16
"reverb delay" 0.36
"echo depth" 0.37

// Castle bathroom
"environment size" 1.5
"environment diffusion" 0.75
"decay time" 1.8
"decay hf ratio" .5
"decay lf ratio" 2
"room hf" -4000
"reverb" 500

// Sewer pipe
"environment diffusion" 0.8
"room hf" -1500
"room lf" 0
"decay time" 2.81
"decay hf ratio" 0.14
"reflections" 0
"reflections delay" 0.014
"reverb" 600
"reverb delay" 0.021

// Cave
"environment size" 1.3
"environment diffusion" 0.75
"room hf" -200
"decay time" 3.5
"decay hf ratio" 1.5
"reflections" 400
"reflections delay" 0.015
"reverb" 1000
"reverb delay" 0.022

// Forest
"room hf" -2000
"decay hf ratio" 0.54
"reflections" -1500
"reflections delay" 0.162
"reverb" -4300
"reverb delay" 0.088
"echo depth" 1

// Short stone corridor
"environment diffusion" 0.6
"room hf" -400
"decay time" 1.2
"decay hf ratio" 0.75
"reflections" 400
"reflections delay" 0.004
"reverb" 1000
"reverb delay" 0.003
"echo time" 0.06
"hf reference" 5168.6
"lf reference" 139.5

// Small stone room
"room hf" -400
"decay time" 1.15
"decay hf ratio" 0.75
"reflections" 0
"reflections delay" 0.006
"reverb" 600
"reverb delay" 0.005
"echo time" 0.06
"hf reference" 5168.6
"lf reference" 139.5

// Medium stone room
"room hf" -400
"decay time" 1.5
"decay hf ratio" 0.75
"reflections" -1000
"reverb" 800
"echo time" 0.12
"hf reference" 5168.6
"lf reference" 139.5

// Large stone room
"room hf" -400
"decay time" 2.2
"decay hf ratio" 0.75
"reflections" -2800
"reverb" 750
"reverb delay" 0.03
"hf reference" 5168.6
"lf reference" 139.5

// Short wood corridor
"environment diffusion" 0.6
"room hf" -600
"room lf" -1600
"decay time" 1.75
"decay hf ratio" 0.5
"decay lf ratio" 0.87
"reflections" -650
"reflections delay" 0.012
"reverb" 200
"reverb delay" 0.024
"hf reference" 4705
"lf reference" 99.6

// Small wood room
"room hf" -1200
"room lf" -800
"decay time" 0.79
"decay hf ratio" 0.32
"decay lf ratio" 0.87
"reflections" -500
"reflections delay" 0.032
"reverb" 0
"reverb delay" 0.029
"hf reference" 4705
"lf reference" 99.6

// Medium wood room
"room hf" -1000
"room lf" -650
"decay time" 1.47
"decay hf ratio" 0.42
"decay lf ratio" 0.82
"reflections" -650
"reflections delay" 0.049
"reverb" 0
"reverb delay" 0.029
"hf reference" 4705
"lf reference" 99.6

// Large wood room
"room hf" -600
"room lf" -650
"decay time" 2.65
"decay hf ratio" 0.33
"decay lf ratio" 0.82
"reflections" -650
"reflections delay" 0.066
"reverb" -400
"reverb delay" 0.049
"hf reference" 4705
"lf reference" 99.6

// Cathedral
"environment diffusion" 0.87
"room hf" -1800
"room lf" -2400
"decay time" 9.48
"decay hf ratio" 0.19
"decay lf ratio" 0.1
"reflections" -500
"reflections delay" 0.09
"reverb" 0
"reverb delay" 0.042
"echo depth" 0.12
"hf reference" 2854.4
"lf reference" 20

// City streets
"environment diffusion" 0.78
"room hf" -600
"room lf" -750
"decay time" 1.79
"decay hf ratio" 1.12
"decay lf ratio" 0.91
"reflections" -750
"reflections delay" 0.046
"reverb" -1000
"reverb delay" 0.028
"echo depth" 0.2

// City - abandoned
"environment diffusion" 0.69
"room hf" -200
"room lf" -100
"decay time" 3.28
"decay hf ratio" 1.17
"decay lf ratio" 0.91
"reflections" -1200
"reflections delay" 0.044
"reverb" -1800
"reverb delay" 0.024
"echo depth" 0.2
"air absorption hf" -3.2

// Museum
"room hf" -1800
"room lf" -1800
"decay time" 3.28
"decay hf ratio" 1.4
"decay lf ratio" 0.5
"reflections delay" 0.039
"reverb delay" 0.0034
"echo time" 0.13
"echo depth" 0.17
"hf reference" 2854.4
"lf reference" 107.5
 
(...)
 
Now, if you're more interested in how the system works and how you can adjust values to get what you want, take a look at these values.
 
Main values
 
"room"
Value Range: -10000 to 0 (-100 to 0 db)
Master volume (gain) for both early reflections and reverb. Default value sits around -1500. Lower values actually decrease natural sound reverb.
 
"reverb"
Value Range: -10000 to 2000 (-100 to 20 db)
Reverb gain parameter. Default value is 0. Higher values feel like you're in a medium or small room with reflective surfaces. Lower values actually decrease natural reverb of the sounds.
 
"reflections"
Value Range: -10000 to 0 (-100 to 0 db)
Early reflections gain. The louder and less delayed these are, the more it feels like you're closer to the wall (inside a small empty room).
 
"decay time"
Value range: 0.1 to 20 (0.1 to 20 seconds)
Time for the reverb to decay. Helps determine the size of a room. Average small rooms will have a reverb decay around 0.35 sec. A cathedral or a cavern will have 4-6 sec. Default value is 1.49.
 
(...)
 
Values for fine-tuning
 
"reverb delay"
Value range: 0.0 to 0.1 (0-100 ms)
Creates delayed reverb effect. Default value is 0.011.
 
"reflections delay"
Value range: 0.0 to 0.3 (0-300 ms)
Delays early reflections. Default value is 0.007.
 
(...)
 
Example workflow:
 
1. Use "reverb" to define how dead or live the room is. Add some delay with "reverb delay" if needed.
2. If the room is large (think cavern, canyon, or cathedral), use "decay time" to define bigger space.
3. Use "room" if you want to make "reverb" or "decay time" sound louder or quieter than the default (-1500).
4. Use "reflections" to tweak early sound reflections.

 
(...)
 
Notes / tips:
 
1. For volume / db parameters, don't bother with testing very low values. In real life, good self-noise characteristics for microphones and recorders is around -60 db. That means most people won't hear that noise. So, whenever you have ranges from -10000 to 0 or 2000, using values below -6000 probably won't do much.
 
2. If possible, use closed headphones for testing and tweaking, and then see how it holds up on your PC speakers.
 
(...)
 
 
As you see, this is work in progress, I will update this post with new information and useful things we come up with.

Edited by Judith, 11 December 2017 - 04:14 AM.

  • Bikerdude, joebarnin, PsymH and 8 others like this

#2 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37385 posts

Posted 30 November 2017 - 08:46 AM

*
POPULAR

Some kind of simplified instructions are desperately needed, so thanks for taking this on.

 

As a mapper, what I'd love to have are a set of values for typical TDM environments.  For example, what values would a mapper use to create:

 

1.  A large outdoor environment

2.  A series of small underground caves/tunnels

3.  A typical series of indoor rooms

4.  A large ballroom or other indoor space

etc


  • Bikerdude, Judith, HMart and 3 others like this
TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#3 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20189 posts

Posted 30 November 2017 - 09:03 AM

1.  A large outdoor environment

2.  A series of small underground caves/tunnels

3.  A typical series of indoor rooms

4.  A large ballroom or other indoor space

+1, I will add this to my Elixir WIP,  so EFX can be added to the list of things that mappers can learn from this map!

 

@Judith I will PM you so we can work it before you add it to your OP if thats ok?


Edited by Bikerdude, 30 November 2017 - 09:59 AM.

  • HMart and Anderson like this

#4 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 30 November 2017 - 09:24 AM

Some kind of simplified instructions are desperately needed, so thanks for taking this on.

 

As a mapper, what I'd love to have are a set of values for typical TDM environments.  For example, what values would a mapper use to create:

 

1.  A large outdoor environment

2.  A series of small underground caves/tunnels

3.  A typical series of indoor rooms

4.  A large ballroom or other indoor space

etc

 

My thoughts exactly, we need a set of templates and guidelines, so mappers can start with something, and then adjust values to their liking.

 

 

+1  so I will add this to my Elixir WIP,  so EFX can be added to the list of things that mappers can learn from this map!

 

@Judith I will PM you so we can work it before you added it to your OP if thats ok?

 

Sure! Again, I can't say I understand how all values work (I still haven't touched stuff like environment size or environment diffusion), but we should be able to come up with something by just using main values.



#5 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20189 posts

Posted 30 November 2017 - 10:02 AM

I will test the old EAX map and see how it sounds, as I have done a comparison vid before when EAX was added as an non-public feature for a previous version of tdm (2.04 I think?)

 

Thans once I have a hand on it I will sgtart adding to my Elixir map.


  • HMart and Anderson like this

#6 stgatilov

stgatilov

    Lead Programmer

  • Active Developer
  • PipPipPip
  • 1032 posts

Posted 01 December 2017 - 11:47 AM

Also, testing these settings can be time-consuming; for now we don't have other means than restarting the game (reloadenginemap) to see any changes.

I have already made changes in SVN, so that "reloadSounds" command reloads the EFX file too.
So unless it gets into the "missed the train and has to wait for the next train" category, I hope it would be in 2.06  :D 
 

Create 'efxs' folder in your project root folder, create a text file map_name.efx, and open it. Now, first thing EFX system needs is a version number, so every .efx file needs start with Version 1 (I don't think any other number works).

This is correct, according to what I see in the code.
No idea why "Version 1" is necessary, since no other version number is accepted  :laugh:

 

It seems like you don't need to include every parameter you see in the Wiki reference. Some variables don't do much or hardly do anything. Even if you delete something, the system will use the default value. You can have an empty set like above, and you won't break anything. You can also change the order of parameters, e.g. if you have your own workflow.

This seems to be right.
When you specify a parameter, TDM asks OpenAL to take it into account (using alEffectfv method). When you don't specify it, or you specify wrong value, then TDM simply does not tell OpenAL about it. Most likely OpenAL takes default value in this case. If you specify wrong value, you will see a warning in console.
 

 

Main values

Well, I can try to explain how to read official docs on these values.
 
First of all, open page 66 of Effects Extentions Guide of OpenAL. Here you see the table of parameters for AL_EFFECT_EAXREVERB. They are mostly the same as the parameters described in EFX file, with two differences:

  • Names are a bit different. Everything starting with "reverb" maps to LATE_REVERB, some names without last word map to GAIN (e.g. "reflections" maps to AL_EAXREVERB_REFLECTIONS_GAIN), "room" maps to "GAIN", etc.
  • Everything looking like "gain" must be specified in millibels in EFX file, while in OpenAL EFX they are described by gain factor. So keep in mind that values are quite different for such parameters.

And for code-literate geeks, here is the exact code which converts EFX file parameters into OpenAL EFX parameters:

Spoiler
 

 

I hope this would help to write better docs.

 


  • Judith, Anderson and JackFarmer like this

#7 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 01 December 2017 - 12:10 PM

Thanks for the info, stgatilov! This guide might be helpful. Also, I've been watching a few Twitch livestreams by proffessonal audio engineers amd musicans on how to use Delay and Reverb. Since our EFX parameters are similar to Audition's Reverb plugin, it should help me understand which values do what, how they affect each other etc. Then I want to establish a clear workflow, so everyone will know what they're doing.

 

I have already made changes in SVN, so that "reloadSounds" command reloads the EFX file too.
So unless it gets into the "missed the train and has to wait for the next train" category, I hope it would be in 2.06  :D

 

Yes! I almost jumped with joy when I saw that entry resolved in the bug tracker! :D Please, please, please include this in final 2.06 release! You'll save us hours of tedious work, seriously.


Edited by Judith, 01 December 2017 - 12:11 PM.

  • Anderson likes this

#8 Abusimplea

Abusimplea

    Member

  • Member
  • PipPip
  • 471 posts

Posted 01 December 2017 - 03:19 PM

No idea why "Version 1" is necessary, since no other version number is accepted  :laugh:

It is generally a good idea to add an explicit version indicator to such definition files. Future parsers will have an easier job in parsing different versions of that stuff.



#9 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 02 December 2017 - 04:25 AM

Actually that Effect Extension Guide proved to be very useful. I went through most values in the Appendix on page 120 and further. Despite some differences in names ("room" is basically "gain" and value ranges can be a bit different), everything seems to be correct. Some values, like Reverb density, were probably added in Version 2 or later, so they don't work. Still, even stuff listed in .efx definitions on our Wiki page as "undocumented", like "echo depth" or "echo time" – they actually work. Some of these values just need to be grouped and adjusted together so you can hear the difference.

 

Now I'll need some time to wrap my head around this, and try to decide which of these parameters should be treated as primary and secondary, as it gets complicated pretty quick.



#10 Xircspheroth

Xircspheroth

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 02 December 2017 - 08:48 AM

Kind of just a random passing through. I was searching for stuff on EFX and signed up specifically to make this comment, but as far as I can tell no one has mentioned that there are labelled presets for a couple of different environments here: https://github.com/k...L/efx-presets.h and it seemed like that could be helpful here


  • Bikerdude, Judith, HMart and 1 other like this

#11 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 02 December 2017 - 09:04 AM

This will be helpful, thanks! Some of the ranges will be different, but I could try and use these to create presets for TDM.



#12 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 02 December 2017 - 11:54 AM

Using guide provided by Stgatilov and presets found by Xircspheroth, I made a comparison of values used in Open AL docs and in our documentation. If we take out orange ones, which are incompatible, and blue ones which share the same range, we end up with 6 parameters that need conversion from one range to another. Could have been worse :)

 

obraz.png


  • PsymH likes this

#13 stgatilov

stgatilov

    Lead Programmer

  • Active Developer
  • PipPipPip
  • 1032 posts

Posted 03 December 2017 - 12:33 AM

Using guide provided by Stgatilov and presets found by Xircspheroth, I made a comparison of values used in Open AL docs and in our documentation. If we take out orange ones, which are incompatible, and blue ones which share the same range, we end up with 6 parameters that need conversion from one range to another. Could have been worse :)

These are the parameters which express "gain".

All of them are converted between TDM and OpenAL the same way.

 

In OpenAL, you specify the gain factor F. It means something like "the loudness of this thing is F times greater than the generic loudness of the sound". So, it is just a plain ratio between two volumes, i.e. the sound pressure.

In TDM, you specify things in millibels, which is 1/100 of decibel. Decibel is logarithmic value typical to measure difference in sounds volume.

 

Here is the conversion:

  • each 2000 additional millibels increases gain in 10 times
  • each 200 additional millibels increases gain in pow(10, 1/10) = 1.258... times
  • each 20 additional millibels increases gain in pow(10, 1/100) = 1.0232... times

For example, -2000 millibels converts to 1/10 gain factor, -4000 millibels converts to 1/100 gain factor, and -6000 millibels converts to 1/1000 gain factor.


  • Judith and Anderson like this

#14 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1635 posts

Posted 03 December 2017 - 02:55 AM

millibels, which is 1/10 of decibel. 

.

1/100 IIRC


  • stgatilov and Obsttorte like this

#15 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 03 December 2017 - 03:37 AM

Yeah, I'm a math dummy, I was trying to convert these values as if ranges were linear ;)

 

And I think they changed ranges in white to more sensible scales in later versions. Range from -100 db to 0, +10, or +20 db isn't terribly useful. I mean, on a scale from 0 to -100 db, you'll won't hear much (or anything) beyond -60, -70 db (typically, this is the self-noise floor for microphones). Since we're talking about volume of reflections and reverberation, it's safe to assume you won't hear anything beyond -50 db, because of the foreground sound sources. Besides, values like room, reverb, and reflections (gain) need to be adjusted manually anyway, either to a specific map, or just because TDM sounds seem a bit louder than in other games.

 

Also TDM default EFX settings are not exactly "neutral". I'd say it's something close to a "medium dead room", so you have to take that into account as well.

 

I'm not sayin these presets are useless. But, I'm trying to create something more like "EFX for dummies" guide, not "here, use these presets". Maybe like a question system, e.g.: 1) how big is your room? Use X for small rooms, Y for medium rooms, and Z for large rooms, etc. So people can take these values and understand (roughly) what they do, and they won't have problems with changing them later.


  • Anderson likes this

#16 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20189 posts

Posted 03 December 2017 - 05:24 AM

Kind of just a random passing through. I was searching for stuff on EFX and signed up specifically to make this comment, but as far as I can tell no one has mentioned that there are labelled presets for a couple of different environments here: https://github.com/k...L/efx-presets.h and it seemed like that could be helpful here

Welcome to the forums :-)


  • HMart likes this

#17 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 03 December 2017 - 05:30 AM

I'm not sayin these presets are useless. But, I'm trying to create something more like "EFX for dummies" guide, not "here, use these presets". Maybe like a question system, e.g.: 1) how big is your room? Use X for small rooms, Y for medium rooms, and Z for large rooms, etc. So people can take these values and understand (roughly) what they do, and they won't have problems with changing them later.

 

On second thought, maybe it will be better to do both. First, let's have enough generic presets for people who just want to put these in a map and be done.



#18 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 06 December 2017 - 05:57 PM

I updated the first post with some general presets based on EFX tables found by Xircspheroth. Have fun :)


  • Anderson likes this

#19 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 11 December 2017 - 04:10 AM

(Oops, wrong button, sorry. I was editing the first post.)


Edited by Judith, 11 December 2017 - 04:11 AM.


#20 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5403 posts

Posted 11 December 2017 - 06:54 AM

Somebody ought to edit the EFX wiki page to add the info a mapper needs, especially if anything changes with what we have now, and be sure to put a link on the Location Settings wiki page.


Posted Image

#21 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 11 December 2017 - 09:21 AM

I don't have Wiki credentials, but maybe we should wait until we have the 2.06 ready, or at least stuff like no_efx spawnarg support in current beta. I also wanted to make some more user friendly explanations for the values, and a small tutorial for creating a reverb definition from scratch, if anyone feels like it.


  • Springheel likes this

#22 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20189 posts

Posted 11 December 2017 - 02:51 PM

I don't have Wiki credentials

Just request them, it will be with your forum credentials.


  • Judith likes this

#23 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 11 December 2017 - 04:06 PM

Awesome, will do.



#24 ERH+

ERH+

    Advanced Member

  • Member
  • PipPipPip
  • 726 posts

Posted 02 May 2018 - 02:24 AM

Will it be included in 2.06? Do you have alredy some copy/paste templates, like small room, big room, sever, street, cave, forest?

S2wtMNl.gif


#25 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1606 posts

Posted 02 May 2018 - 02:38 AM

Efx already works in 2.06 beta, and a few templates are in the first post :)
  • ERH+ and Anderson like this



Reply to this topic



  



Also tagged with one or more of these keywords: sound, openal, efx, reverb, delay, tutorial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users