User Tools

Site Tools


mtr:dev:custom_bve_sound

This is an old revision of the document!


Custom BVE Train Sound

The Minecraft Transit Railway mod supports applying train sounds from either BVE Trainsim and OpenBVE to a certain extents.

This tutorial covers how to apply train sounds from BVE/OpenBVE, for use with custom train resource pack.

This article is ported from https://www.joban.org/wiki/MTR:Custom_BVE_Train_Sound, and have not covered steps for importing sounds from BVE Trainsim 5/6.

You may help improving the page by filling in the missing knowledge.

Prerequisite

  1. Basic knowledge of adding custom Minecraft sound, custom trains via resource pack, and the JSON format.
  2. An existing BVE4/OpenBVE Train
  3. An custom MTR Mod train added with Resource Pack (Livery works as well).
  4. Software that is capable of exporting .ogg file (e.g. Audacity)
  5. (Optional, but makes life way easier) Bulk renaming software (PowerRename from PowerToys, KRename on Linux, etc.)

Process

  1. Make a copy of your BVE/OpenBVE Train folder, only make changes within the newly made copy, not your original one!
  2. Find the folder where the train sound are located. They're either located right in the main train folder (bunch of sound files), or there might be another sound folder within the train folder. (They usually contains bunch of .wav/.flac file)
  3. If you do find another sound folder, just put all the sound file inside to the main train folder
  4. Delete all other files except *.wav, *.flac, train.dat and sound.cfg
  5. Rename all files (Including sound.cfg and train.dat) in that folder to lowercase letter file name. You can do it with most bulk renaming software, or you can manually renaming each one of them
  6. Edit the sound.cfg file, by adding the following below the line Version 1.0:
    sound.cfg
    [MTR]
    MotorNoiseDataType = 4
    MotorVolumeMultiply = 1
    DoorCloseSoundLength = 1
  7. Explanation of the above config:
    1. MotorNoiseDataType = 4 indicates that this is a BVE4/OpenBVE format (train.dat) motor sound data.
    2. MotorVolumeMultiply = 1 requires some further explanation. Due to the different nature of the two games, sometimes the volume setting used by the train's creator in BVE is a bit quiet when used in Minecraft, so this setting is introduced to “multiply” the volume. However, Minecraft puts a clamp of 100% on the volume that MTR can programatically assign, which makes things complex.So, if the volume assigned in train.dat is moderate, but it's the WAV sound clips themselves that are quiet, then this settings won't have effect. (Let's say the originally assigned volume is 90%, you want to double it to get 180% by this setting, but Minecraft clamps it to 100%, and nearly no boost can be achieved by tweaking this setting.) In this case you need to dial up the volume of the WAV sound clips by the means of sound editing softwares like Audition.On the other hand, if the WAV sound clips are loud enough, but very low volumes are assigned in train.dat, then dialing up this setting would be the way to go. (10% doubled will give you the correct 20%. without hitting the clamp.) 1 represents 100% the original volume, 2 for 200%, etc.
    3. DoorCloseSoundLength = 1 is used to determine the time that the door closing sound should start playing. This should be the length of the sound in seconds. However, due to MTR's limitations, value longer than 1s are not accepted.
  8. The end result of sound.cfg should look something like this:
  9. Rename your BVE train folder to be lowercase and without space. (You may use underscore to replace space), this will be your Train sound ID to reference later on!
  10. Import all the .wav/.flac sound to an audio editor and convert them to Mono Channel
  11. Export all the .wav/.flac file to .ogg file (For Audacity user, use File > Export > Export Multiple, and choose Ogg Vorbis Files)
  12. Copy the train folder to Your Resource Pack/assets/mtr/sounds. (Make the folder if it doesn't exist)
  13. Make a sounds.json file in Your Resource Pack/assets/mtr if you haven't already, an example could be found here.
  14. Make a sound entry in sounds.json of every file in sound.cfg, the sound ID to put should be trainSoundID_filename
  15. Your sounds.json in the end should look something like this (I used kksp as my train directory name):
  16. Finally, add the following line to your custom train entry in mtr_custom_resources.json, replace soundID with your actual sound ID/Train Folder Name:
    1. “bve_sound_base_id”: “soundID”

Your train in mtr_custom_resources.json should now look something like this:

Now start your game, and everything should hopefully work.

Note / Troubleshooting

  1. You will need to re-select the train in the siding, or restart the client if you have made any changes to the sound config.
  2. point.ogg is played whenever the train crosses a rail node, which is different from BVE's behavior (Crossing a junction). If you feel the sound doesn't fit, please remove it in sounds.json
  3. Small motor noises may be heard even when the train is coasting, this is to simulate train adding small bits of power to maintain it's speed.
mtr/dev/custom_bve_sound.1708179021.txt.gz · Last modified: 2024/02/17 14:10 by sfsperseverance