Logo About   Features   Roadmap   Compatibility   Developer Log   Downloads   Forum

Features - Audio

This page should outline the internal audio model.

In openBVE, audio is not simply send to the speakers directly. Instead, every sound has a source in 3D world coordinates and a velocity vector, that is, a direction plus the speed the sound source travels at. The listener (the camera) has a similar set of properties, namely a position, a velocity vector and an orientation, which is a direction plus an up vector. The direction is the direction the camera is looking at, while the velocity vector could also point in a different direction. In other words, the listener can look in a different direction than moving to. The up vector simply tells where "up" is, and thus where left and right are.
Surround sound

The useful property about this system is that every sound has a position, and the listener has a position. This enables fading volume if sounds are far away. For example, if you are in external view, the train could approach and its motor sound and track sound get louder, it will pass near you, then the volume fades away once the train is far away again. As each sound and the listener also have a velocity, doppler effects are produced out-of-the-box.

For openBVE's 3D cabs, this means that sounds like the compressor could be located at a specific position in the train. Say the compressor is somewhere behind you, thus it will be audible from both speakers, then turning the view to the right would let the compressor sound come from the right. Of course this requires new file formats to let developers have full control over the graphics and sounds, but will vastly improve the sensation. If you have a 5.1 system, you would certainly profit from having that in openBVE.

Note:

A 3D positional audio system as presented above inherently requires sound files to be mono, because sounds are dimensionless points in world coordinates. It is not possible to use 3D positional effects with stereo sounds. As such, openBVE will convert stereo sounds to mono and instead relies on its 3D positional system for enabling stereo and surround effects.

Warning: Some stereo sounds used in existing BVE trains have channels which are mutually 180° out of phase. These channels will annihilate each other when converting the sound to mono (destructive interference), thus resulting in no sound at all. See here for a more elaborate explanation. Developers are encouraged to provide mono sounds only in order to avoid this.

Furthermore, only 22050/44100 KHz, 8/16 bit PCM mono wave files are guaranteed to work at the moment, not ADPCM or anything else.

Positions of train sounds

This sections explains where sounds of BVE trains are preconfigured to be played relative to the train. This does not apply to openBVE trains, for which it will be possible to define all positions manually.

The following abbreviations are used for positions:
  • Center: The sound originates from the center of the car, horizontally centered.
  • Front: The sound originates from the front of the car, horizontally centered.
  • Cab: The sound originates from the cab. This is at the default view point of the camera when being in interior view.
  • Panel: The sound originates from the panel. This is the same as Cab, just around one meter to the front.
  • Left: The sound originates from the center of the car, horizontally at the left.
  • Right: The sound originates from the center of the car, horizontally at the right.
The following abbreviations are used for radii:
  • Car: The sound will be best heard in a radius corresponding to half the car length.
  • Panel: The sound will be best heard in a radius of around 2 meters.
SoundPositionRadius
Adjust.wavPanelPanel
Air.wavCenterCar
AirZero.wavCenterCar
AirHigh.wavCenterCar
Ats.wavCabPanel
AtsCnt.wavCabPanel
Brake.wavPanelPanel
CpEnd.wavCenterCar
CpLoop.wavCenterCar
CpStart.wavCenterCar
Ding.wavPanelPanel
DoorClsL.wavLeftCar
DoorClsR.wavRightCar
DoorOpnL.wavLeftCar
DoorOpnR.wavRightCar
Eb.wavCabPanel
EmrBrake.wavPanelPanel
FlangeN.wavFront axle of the front carCar
Halt.wavCabPanel
Klaxon0.wavFront4 · Car
Klaxon1.wavFront4 · Car
Klaxon2.wavFrontCar
Leave.wavCabPanel
Loop.wavCenterCar
MotorN.wavCenterCar
Point.wavFront axle of the front carCar
Rub.wavFront axle of the front carCar
RunN.wavCenterCar
SpringL.wavLeftCar
SpringR.wavRightCar
ToAtc.wavCabPanel
ToAts.wavCabPanel

Furthermore, station arrival and departure sounds are played at around 5 meters to the sides of the train, depending on whether the doors should open to the left or right, and additionally around 3 meters above the rails. This is intended to correspond to the speakers that are installed on stations.

This is just a default layout for legacy trains. For openBVE trains, developers will be able to specify the positions manually. If you feel that this default layout does not match most of the trains around in the world of BVE, post in the forum to contribute your corrections.

Valid HTML 4.01 Transitional