Moderators: Huki, jigebren

[Done] [RVGL] 3D surround sound

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

23 Dec 2015, 02:05 PM #1

Just tested RVGL on my X-Fi Titanium, hardware OpenAL works perfectly on it :)
I am using driver version WIN8_BETA_US_2_17_0008C. Newer versions "forget" to set a static source to stopped when it finish playing (it only works for streaming sources), causing lots of problems. (I did not test the new drivers with RVGL)

I have a little program that can measure the X-RAM usage and the number of sources used, and I can confirm that it generates various sources and uses the extra RAM for samples :thumbs-up:

I have one problem when using a 5.1 surround system though. For some reason almost all sound come only from the surround speakers, and this happens when using both Creative OpenAL and OpenAL Soft.

Is 3D positioning of the sources enabled, or does it just pan between left and right each source for now? It seems that every source is getting generated behind the car and is being stereo-panned according to its position, maybe the Z coordinate wasn't converted from DirectSound to OpenAL? (OpenAL coordinate system is right-handed (just like OpenGL), while DirectSound is left-handed)
Any plan on adding basic support for EFX? (if it is not there already, I did not test it)
It would be just like EAX 2.0, but better :)

Anyway, great work, and thanks for doing it! :D

EDIT:
Just tested the new build, 15.1220a.
Now the sources doesn't seem to be only panned, nice :)
This might have fixed it:

Code: Select all

  - Fixed loud sfx volume, now uses an exponential volume curve that fades away 
    quickly as you move away from the source. Also fixed an inconsistency in 
    panning.
But the Z-coordinate is definitely flipped, I tested with just my front speakers and I can only hear cars behind me.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

23 Dec 2015, 02:47 PM #2

LAGonauta @ 23 Dec 2015, 07:35 PM wrote: EDIT:
Just tested the new build, 15.1220a.
Now the sources doesn't seem to be only panned, nice :)
This might have fixed it:

Code: Select all

  - Fixed loud sfx volume, now uses an exponential volume curve that fades away 
    quickly as you move away from the source. Also fixed an inconsistency in 
    panning.
But the Z-coordinate is definitely flipped, I tested with just my front speakers and I can only hear cars behind me.
Thanks LAGonauta, and welcome to the forum.
As you guessed, we are just panning each source between left and right for now. We do this by setting the X coordinate of each source's position between -1.0 to 1.0. The Y and Z coordinates should ideally be zero, but this causes the audio to glitch out. To prevent this, I had to set the Z coordinate to a small non-zero value (0.1). That's why the audio seems to appear from behind.
Supporting real 3D positioning is definitely planned though.


EDIT: Can you try this build? rvgl_surround_test.7z
In this one I set the Y coordinate to 0.1 rather than the Z (so the source is positioned slightly above the camera).
Quote
Like
Share

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

23 Dec 2015, 03:53 PM #3

So my first hunch was right after all, stereo panning :)

Thanks for this build, it is a lot better. The volume is still greater on the back, but now it is more balanced :thumbs-up:

I believe the ideal would be Z = -0.1 and Y = 0 (or maybe Y = 0.1 and Z = 0; or Y = 0.1 and Z = -0.1), but I do not know if there is something else not allowing that. For now I will be using the new build as it is still better than pure stereo for me :)

Good to know that 3D positioning is planned :D
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

23 Dec 2015, 04:52 PM #4

Here is a first attempt in implementing real surround: rvgl_surround_test1.7z
The position is now updated in all 3 directions (in the -1.0 to 1.0 range). As before, we also adjust the volume by ourselves. The sounds coming from behind are slightly lowered.
Can you try it and let me know how it sounds?


EDIT: I moved this discussion to a separate thread.
Quote
Like
Share

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

23 Dec 2015, 07:43 PM #5

Already? Impressive! :o

Just tested, it is working very well as long as I disable the center speaker and swap the connectors for front and rear speakers. What should be playing on the front is playing on the back, and vice versa.

I tested with hardware OpenAL from X-Fi and OpenAL Soft 1.17.1. The new ambisonics panner and bsinc resampler (both added on 1.17.0) from OpenAL Soft are impressive! A lot better than those used on the X-Fi.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

23 Dec 2015, 10:11 PM #6

LAGonauta @ 24 Dec 2015, 01:13 AM wrote:Just tested, it is working very well as long as I disable the center speaker and swap the connectors for front and rear speakers. What should be playing on the front is playing on the back, and vice versa.
Ok, this time the Z coordinate was actually flipped. ;) Fixed now.
Try the fixed build: rvgl_surround_test2.7z
Quote
Like
Share

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

23 Dec 2015, 10:42 PM #7

Just tested this new build. Working perfectly! :D
Thank you very much :)

As the game is using OpenAL now anyone can play with full surround sound with any number of speakers and even use HRTF for virtual spherical sound over headphones :)

I see that the engine is doing the volume calculations and using OpenAL to position the sources and change their gain. Is this a design choice?
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

24 Dec 2015, 12:18 PM #8

Glad to know it's working. :)
LAGonauta @ 24 Dec 2015, 04:12 AM wrote:I see that the engine is doing the volume calculations and using OpenAL to position the sources and change their gain. Is this a design choice?
Yes, this is by design. We follow our own "inverse distance" attenuation model (double the distance = half the volume) up to a certain point. After that point, we have the volume decrease linearly until it disappears. This lets us better manage our sources (we can avoid wasting slots for inaudible sounds), while at the same time prevents abrupt cut-off (because we switched over to linear decrease).
We also do some special mixing for split-screen mode taking into account the source relative to each player's camera (as if there are multiple listeners).

Much of this work was already done by jigebren for v1.2 when we were still using Miles. When I ported over to OAL I continued to closely follow the same model. Of course, as we found out, OAL makes it easy to implement surround positioning without any significant changes to our model. I'm quite happy about that. :D
Quote
Like
Share

Joined: 24 Sep 2014, 05:08 PM

4 Jan 2016, 06:57 PM #9

I've experienced a sound bug in this (rvgl_gamma_test.7z)* test RVGL version of the game (in rvgl_surround_test version as well), but this bug doesn't exist in the newest version of RVGL (rvgl_15.1220a)

When i'm using "rear view", sounds of my car (especially engine, because it's loud) are much quieter than when I'm using normal camera. It also seems for me that car sounds are more quiet (with rear view) when I'm driving forward than backwards.

Or maybe this is intended? Because of the introduction of 3D surround sound? If that's the case, I didn't find a bug but just pointed it out :)

*[Vaid]: I assume it's gamma correction test build, since this post was originally posted in "[RVGL] Gamma correction" thread.
Quote
Like
Share

nuclearhythmics
Regular
Joined: 17 Jul 2007, 01:53 AM

4 Jan 2016, 09:31 PM #10

Cool, thanks again guys! I've been testing it with Razor Surround which is virtual requiring headphones for total separation of stereo to get binaural 3d sound. Binaural sounds like a better idea than surround speakers to me but not sure how the Razor driver works to emulate 3d audio; probably just uses binaural to simulate speakers of a 5.1 or 7.1 channel system. I tried to capture a video example of it with fraps which didn't record the razer surround enhancement :(
Quote
Like
Share

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

7 Jan 2016, 12:48 PM #11

nuclearhythmics @ 4 Jan 2016, 10:31 PM wrote: Cool, thanks again guys! I've been testing it with Razor Surround which is virtual requiring headphones for total separation of stereo to get binaural 3d sound. Binaural sounds like a better idea than surround speakers to me but not sure how the Razor driver works to emulate 3d audio; probably just uses binaural to simulate speakers of a 5.1 or 7.1 channel system. I tried to capture a video example of it with fraps which didn't record the razer surround enhancement :(
Razer Surround works by virtualizing 7.1 surround to headphones using HRTF. Technically you only get 7 channels worth of positioning data and no vertical cues.
As you are using OpenAL Soft, you might want to try disabling Razer Surround and enabling OpenAL Soft's own HRTF's ;)
It comes with a very good HRTF set (for me), but you can choose your own if you want. (Do not forget to update to the newest version, 1.17.1)

If you need any help with OpenAL Soft HRTF's just send me a PM, create a new topic about this subject or Google/Bing/Yahoo it (there is tons of info available) :thumbs-up:
Quote
Like
Share

urnemanden
... as a Newt
urnemanden
... as a Newt
Joined: 21 Apr 2008, 05:03 PM

7 Jan 2016, 10:26 PM #12

@LAGonauta: do you by chance perceive a difference in sound quality when hearing music in Re-Volt and playing music outside of Re-Volt?

I found out that when I have hrtf turned on, the high frequencies in the music sound muffled in Re-Volt (in comparison standard playback in a media player).
Quote
Like
Share

nuclearhythmics
Regular
Joined: 17 Jul 2007, 01:53 AM

9 Jan 2016, 04:57 AM #13

Thanks for the info LAGonauta :thumbs-up: OpenAL HRTF seems more real and immersive than virtual surround! can sense vertical positions!
guess I'll save the razor virtual surround driver for RV1.2 but prefer OpenAL HRTF in RVGL.

Urne, I don't really notice a difference in music treble with HRTF but maybe bass sounds louder or enhanced since I chose "headphones" as Stereo Mode in the OpenAL Soft Configuration gui. I think I notice slight muffled sound effects and music in Re-Volt's front end however with HRTF on.

Fraps records the HRTF effect! I recorded two races in JungleVolt to compare: HRTF on, and off at 1:54
[youtube]vIDNGpE8muM[/youtube]
3D effect requires headphones for binaural separation
Quote
Like
Share

LAGonauta
Sober
Joined: 22 Dec 2015, 11:21 PM

10 Jan 2016, 03:26 AM #14

urnemanden @ 7 Jan 2016, 11:26 PM wrote: @LAGonauta: do you by chance perceive a difference in sound quality when hearing music in Re-Volt and playing music outside of Re-Volt?

I found out that when I have hrtf turned on, the high frequencies in the music sound muffled in Re-Volt (in comparison standard playback in a media player).
I do not perceive any quality reduction, but I am using a sound card which has a fairly high quality sample rate converter and a HRTF set that I am used to (CMSS-3D Headphones for headphones and CMSS-3D Virtual for stereo speakers). Maybe OpenAL Soft is configured to only used the linear ressampler (low quality, I can hear some artifacts when using it).
This is why on my machines where I have to Use OpenAL Soft I updated it to the newest version (1.17.1) and enabled bandwidth limited sinc ressampler. There is probably no perceived difference between this ressampler and the 8-point sinc ressampler, but I like to be certain that there is no loss of quality.

About HRTF muffling high frequencies, if I am not mistaken high frequencies are the ones which can give the brain the cues needed to virtualize the sound. You probably feel they are muffled because the HRTF set that comes with OpenAL Soft is an average and it can be very different from your real personal HRTF (ear size, head size, quantity of hair, trunk size, shoulder size... There are lots of variables)
Our brain is really good on learning new HRTF, so eventually one will get used to it and identify all sounds positions (as long there are visual and auditory cues at the same time)

nuclearhythmics, your video is private and we are not able to see it... Well, at least not me, haha :P
Quote
Like
Share

Gotolei
Alcoholic
Gotolei
Alcoholic
Joined: 12 Mar 2014, 12:26 AM

11 Jan 2016, 08:18 AM #15

A question about this, posted here so as to not derail the main topic.

Where is the sound projection centered? At the car's CoM, or the camera?
Meaning normal in-race [F1] cameras, not tvtime or replay.

Also as mentioned in that thread, most of the sound cuts off if there's too many of them running at once.
Quote
Like
Share

Skarma
Everclear-Addict
Skarma
Everclear-Addict
Joined: 20 Jul 2004, 01:05 PM

11 Jan 2016, 05:04 PM #16

The CoM or car itself.
Quote
Like
Share

Huki
... as a Newt
Huki
... as a Newt
Joined: 30 Dec 2006, 04:01 PM

11 Jan 2016, 05:20 PM #17

Gotolei @ 11 Jan 2016, 01:48 PM wrote:A question about this, posted here so as to not derail the main topic.

Where is the sound projection centered? At the car's CoM, or the camera?
Meaning normal in-race [F1] cameras, not tvtime or replay.
You mean the point where the sounds are actually heard (i.e., where the player's ear / microphone is situated)?
The "listener" is always the camera itself. So with normal F1 camera, the camera is behind your car. That means your car's engine sound is coming from in front of you.
Quote
Like
Share

nuclearhythmics
Regular
Joined: 17 Jul 2007, 01:53 AM

12 Jan 2016, 06:10 PM #18

I reset the previous video privacy setting and uploaded another with HRTF 3D with cool ambient sounds on 2 circuits:
Floating World and WR4 Terminus.
[youtube]86kLo4HH38s[/youtube]
The 3D effect requires headphones for binaural separation
It might be nice if the engine volume were lower for more clarity of environmental sound,
maybe I switch to another car that doesn't use petrol.wav
This time I turned the music off to feature ambient sounds and to defer youtube's copyright holder muting my audio like last time with my WR4 bonnet view video in Terminus which had hil's mp3 of Third Stone From the Sun:
[youtube]N4JWvNDgUe0[/youtube]
by the way I like the WR4 bonnet view as it moves independently from the cam (not as rigid) but maybe I could make a similar view in RVGL as a custom cam.

I'm up for suggestions of custom tracks that have cool immersive sounds.
Quote
Like
Share

nuclearhythmics
Regular
Joined: 17 Jul 2007, 01:53 AM

12 Jan 2016, 09:41 PM #19

stock circuits ambient sounds are enhanced alright by 3D audio. Here's some multiplayer RVGL from this afternoon in RV House:
Toytanic1, GhostTown1 2:52, Hood1 4:31
[youtube]wLJ_Zah8kRo[/youtube]
for 3D audio use headphones for binaural seperation
Quote
Like
Share