leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
275 stars 52 forks source link

[Bug?]The volume of the motor sound does not change much #775

Open enjoysoftware opened 2 years ago

enjoysoftware commented 2 years ago

Description

I play BVE Trainsim train data in OpenBVE. I felt a little uncomfortable with the motor sound played by OpenBVE.(This does not occur in BVE Trainsim) The cause of the discomfort seemed to be that the change in the volume of the motor sound source was not reflected much in OpenBVE. Specifically, even if the volume value of the motor sound of train.dat is close to 0, it will be played with a fairly loud sound.

0,100,5

Here is the videos about this bug: BVE Trainsim(Expected):

https://user-images.githubusercontent.com/47489953/162407804-f77c3a01-e788-4fea-b95d-ae625891eded.mp4

OpenBVE:

https://user-images.githubusercontent.com/47489953/162407880-644ba7a6-124f-4480-afb6-bd9e828c3e16.mp4

Thanks in advance.

Train

Any trains that use train.dat.

leezer3 commented 2 years ago

Messing with this is something I'm not necessarily sure is a good thing. The current documentation states that the volume scale is on an exponential non-linear scale, which is what we do:

https://github.com/leezer3/OpenBVE/blob/b052f2fe96bc62624f6807653a48b35cde7bae6b/source/Plugins/Train.OpenBve/Train/BVE/TrainDatParser.cs#L965-L967

Doing it this way will always produce sounds clustered around nominal volume (e.g. 1.0)

A lot of stuff these days has been designed with OpenBVE, and presumably with it's foibles in mind. This has also been 'broken' for 10+ years.....


A brief bit of reverse engineering into the BVE5 convertor shows that this appears to use a simple linear scale, which is probably why there's a difference. I haven't got a working BVE2 setup to hand to start running comparison tests, although this might be enligtening?

TBQH, I'm conflicted on what to do next..... Changing to a linear scale is easy enough (just divide our value from the train.dat by 128 instead of the snippet above), but I'm concerned about breaking things....

Possibly we could change to a linear scale for BVE2 / BVE4 format content, but I've got no idea here how many people will notice the difference (and complain that we're now broken?!)

enjoysoftware commented 2 years ago

I thought it would be one way to separate the processing depending on whether the header of Train.dat is OPENBVE or BVE2 without completely changing the linear interpolation method. That way, the OpenBVE-only train won't "break" the motor noise, and backward compatibility won't break.