BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Odd sound playback

3 posters

Go down

Odd sound playback Empty Odd sound playback

Post by Delsin Fri Nov 22, 2019 12:47 am

I noticed that almost all sounds feel differently in the sim as opposed to playing them from the train folder. A little research showed that the sim "flattens" all stereo tracks into one mono track.

Spotted in both stable and test builds.
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by leezer3 Fri Nov 22, 2019 11:19 am

Interesting.

I can definitely see it's loading all sounds as a mono mix when it loads the buffer: https://github.com/leezer3/OpenBVE/blob/master/source/SoundManager/Sounds.cs#L285

I don't think this is something that's been touched by me / contributors, so I wonder why Sad

Will try and do some proper digging, but may take a little while as this is the wrong time of year to be working in retail.

I wonder if this is the change SteveGR complains a lot about. (If so, it was introduced by Michelle when the sound model changed somewhere about 1.2 IIRC)

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by leezer3 Fri Nov 22, 2019 11:29 am

Interesting, this may be unavoidable:

Stereo data is expressed in interleaved format,
left channel first. Buffers containing more than one channel of data will be played without 3D
spatialization.


Page 21 of this guide-

https://www.openal.org/documentation/OpenAL_Programmers_Guide.pdf

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by Quork Fri Nov 22, 2019 12:53 pm

Maybe it'd do the trick to split stereo files into separate mono files before handing it over to the sound engine? Though I don't get the point of it right now - stereo has a fixed spatial position, that's what it's for. Why would one try to mix "fixed" 3D and dynamic 3D? Maybe I'm missing something, but it doesn't seem to make sense for what I can tell.
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by Delsin Fri Nov 22, 2019 8:56 pm

Seems like the sound will need some rework then, as trains feel kinda bland with mono sounds. I've also noticed that parsing of motor sound tracks is odd - you can never get a proper volume fade to 0 - even if the volume is set to 0 in train.dat, the sound will still be heard.
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by leezer3 Sat Nov 23, 2019 12:27 pm

Thinking about this some more, I'm not sure quite what we can do here.

Your stereo file contains both left and right channels.
These are obviously relative to the spatial position when the file was recorded. (listener position)
When we play back sounds within a 3D world, we're changing the relative position of the listener, and hence the volume of each channel must be altered to match what is heard at the new listener position.

The only way to do this sensibly is to mix both channels into mono.
This means that we've now got a single sound-source, emitting an equal amount of sound in all directions.

Moving the listener position now allows us to calculate the new L / R channels.

Need to check what happens with volume set to 0 in train.dat

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by leezer3 Sat Nov 23, 2019 1:11 pm

Can't reproduce the train.dat issue here- Sounds definitely fade to zero.

Some thoughts-

  • Try adding a couple more stops to the fade. Remember that each line in train.dat is equal to 0.2km/h and that especially at higher speeds you may end up running through multiple steps in one frame.
  • Do the loop / run sounds contain motor noises in the background?
  • Can you reproduce with a minimal setup (say 1 motor sound, no other sounds)- Is it crossfading or something from the other motor or brake notches?

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by Delsin Sat Nov 23, 2019 5:13 pm

I made a train to test that
https://www.dropbox.com/s/s31h58gfmhnopv1/standard%20test%20train.zip?dl=0

Sound fades at around 40kph. I made the volume curve very smooth, but I can still hear a noticeable "cut". It gets a bit softer if I drive at P1 around tht speed though, but it still exists. The fades were better and smoother in BVE4 and still are in BVE5 and Hmmsim (I can try converting to that or launching with 4 later to prove this), even with much steeper fade curves.
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

Odd sound playback Empty Re: Odd sound playback

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum