OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

[Bug] Inconsistent motor sound volume

Open hotdamndel opened this issue 1 year ago • 1 comments

Description

When motor sound is supposed to fade from 100% volume to silence linearly with speed, it sounds like it loses only around 50% of volume and then cuts out, meaning the fade isn't linear contary to intended behavior. In BVE4, 5 and Hmmsim 2, creating a linear fade would sound correctly.

Reproduction

Use any train.dat with blank motor sound data. Add a sound active from 0 to 40 (can be any speed) km/h. Draw a linear volume fade from 100% at 0 km/h to 0% at 40. Save then test drive it.

hotdamndel avatar Nov 23 '23 12:11 hotdamndel

First, from the documentation, a purely linear scale was not intended:

Volume: A non-negative floating-point number representing the volume of the sound. Nominal volume corresponds to a value of 128. The scale of volume is non-linear, and the exact behavior is implementation-specific. The default value is 128.

The volume scale is produced using a fractional exponent to produce a curve: https://github.com/leezer3/OpenBVE/blob/cc526ea67e36d53cf316f26c24e540a8cf1a41be/source/Plugins/Train.OpenBve/Train/BVE/TrainDatParser.cs#L964-L967C19

I'm not necessarily comfortable changing this- it's a pretty major shift, and Michelle must have had some sort of reason.

Possibly it had something to do with the limitations of OpenAL available at the time things were written originally (it certainly had issues with larger numbers of sounds and soe other bits)

@ginga81 do you have any thoughts?

leezer3 avatar Dec 01 '23 19:12 leezer3