leezer3/OpenBVE

[Bug] Wrong behavior of certain sounds

Opened this issue · 11 comments

Description

Some sounds work differently from intended BVE4/5 ways, mostly it's using a simple "play once" condition instead of "while".
Examples:

  • Air brake release sounds, these should stop once brake cylinder pressure (brake pipe for emergency brake sound) stops decreasing rather than playing a sound once, during which a corresponding process can be interrupted and reversed (like when applying brake while brake cylinder pressure is still venting)
  • Same issue with door sounds, re-opening them while closing leaves the closing sound still playing
  • Air suspension, these are meant to be played while car body is swaying in a corresponding direction instead of just once it starts moving. Otherwise suspension sounds become a mess (observed on some BVE4 trains where suspension sounds are a long loop, much longer than a sway in one direction would last)
  • Some sounds intended to be looped but interrupted at certain times (run, flange, suspension, rub) always play from the beginning when restarted, in BVE4/5 these restart from where playback was stopped to avoid things like repetitive run sounds when starting from stations or flange sounds when entering curves
  • Flange and rub sound behavior is somewhat different in BVE4/5 (needs further analysis). Brake shoe sound stands out a lot since pitch shouldn't change as much as currently and there should be some pitch dependency on brake cylinder pressure
  • Compressor start/stop sounds are played without sound duration check, creating gaps or audible overlaps with certain sound samples (my research showed Openbve assumes 5 second duration for both)

Please see what you think of this build:
https://github.com/leezer3/OpenBVE/files/13451367/PauseResume.zip

That allows flange / run sounds to pause and resume, as that seems the easiest and most logical of your notes.

Suspension I suspect is probably fundamentally an issue in general. The physics around this are seriously exaggerated (see the loading sway), and might well require the entire physics for that re-writing to actually work more sensibly.

Most of the rest of them are subjective as to what is 'better' and have potentially breaking implications for OpenBVE content, which makes me reluctant to change them by default- For example, I'm aware of stuff playing an announcement using the door sounds, and cutting this off wouldn't be desirable.

Flanges and run sounds are better now.
Suspension sway seems more or less okay, but for Japanese trains, this is something that should be configurable later. But sounds are still broken, so we can have at least that properly for now (instead of one slight sway leading to the entire spring sound playing), btw it also seems only loading sway has sounds currently (BVE4/5 uses these for all suspension motions).
Door sounds shouldn't break anything, as playing a closing sound while opening is already a buggy behavior and using door sounds for announcements is wrong and shouldn't be supported.

Tweaked the compressor start sound slightly.

The 5s value is now only applied if there is no loop sound (I presume the intent of this code was to simulate the compressor run-up)
The end sound looks OK and has no reference to the 5s- are you sure it's broken?

https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2023-11-25.zip

Changed the spring sounds to loop / pause.
Not certain about this one yet however; it's logical, but it might lead to sway sounds being stuck on; the tolerance might possibly want tweaking, but see what you think.....

https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2023-11-26.zip

Another slight tweak- Spring sounds will now play for a minimum of 1s.

Seems like it triggers correctly, but suspension sounds keep playing even when train is fully stationary now.
I remember having issues with compressor sound not looping correctly in some cases, will attach an example when I find it again.

https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2023-11-27.zip

Any better?
Remember mind that if the doors are open and loading sway is active, this may well produce a continual sound...

File not found.

Yes, I actually test it by enabling the sway and checking how it sounds while the doors open. Easiest and most reliable for now (since I don't hear suspension much while driving currently)

Tested the Nov 28 build, suspension sounds work fine (but can agree the loading sway is unrealistically strong and repetitive, feels like if entire train at rush hour capacity is being unloaded and loaded in a loop).
Now only doors and air brakes are a bit off (as before), and will also test compressor sounds more.

Changed the brake sounds a bit:
The Air (BC Release), AirZero (BC Release Full) and AirHigh (BC Release High) sounds will now be stopped (if playing) when the pressure starts to increase again.

Need to do some checking before changing the emergency brake one too much.

Tested air sounds, seems fine. Emergency brake should be the same but linked to brake pipe pressure instead (as it's intended to be a BP venting sound).