Odd sound playback
3 posters
Page 1 of 1
Odd sound playback
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.
Spotted in both stable and test builds.
Delsin- Posts : 313
Join date : 2016-08-20
Re: Odd sound playback
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
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)
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
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)
Re: Odd sound playback
Interesting, this may be unavoidable:
Page 21 of this guide-
https://www.openal.org/documentation/OpenAL_Programmers_Guide.pdf
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
Re: Odd sound playback
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- Posts : 1438
Join date : 2012-05-05
Age : 33
Location : Hofheim a.T., Hessen (Hesse), European Union
Re: Odd sound playback
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- Posts : 313
Join date : 2016-08-20
Re: Odd sound playback
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
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
Re: Odd sound playback
Can't reproduce the train.dat issue here- Sounds definitely fade to zero.
Some thoughts-
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?
Re: Odd sound playback
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.
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- Posts : 313
Join date : 2016-08-20
Similar topics
» Glitched audio playback when using the [Sound] section
» Sound.cfg help
» No Sound
» Some concerns on sound
» The new sound model
» Sound.cfg help
» No Sound
» Some concerns on sound
» The new sound model
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum