The District of Joban MTR:Custom BVE Train Sound

MTR:Custom BVE Train Sound

From The District of Joban
Revision as of 15:40, 10 November 2023 by LX86 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Moved to https://wiki.minecrafttransitrailway.com/mtr:dev:custom_bve_sound

Note: This tutorial only covers BVE4/OpenBVE Sound

Prerequisite

  1. Basic knowledge of adding custom Minecraft sound and the json format.
  2. An existing BVE4/OpenBVE Train
  3. An Custom MTR Mod Trains (Livery included).
  4. Software that is capable of exporting .ogg file (e.g. Audacity)
  5. Bulk renaming software (e.g. PowerRename with PowerToys)

Process

  1. Make a copy of your BVE Train
  2. Find the directory of the sound folder, they're either located right in the BVE Train Folder, or there might be another Sound Folder. (They usually contains bunch of .wav file)
  3. If you find another sound folder, put all the sound file inside to the BVE Train Folder.
  4. Delete all files except .wav, 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 any bulk renaming software, or by manually renaming each one of them
  6. Add the following to sound.cfg, below Version 1.0

[MTR]
MotorNoiseDataType = 4
MotorVolumeMultiply = 1
DoorCloseSoundLength = 1


  • MotorNoiseDataType = 4 indicates that this is a BVE 4 format (train.dat) motor sound data.
  • MotorVolumeMultiply = 1 requires some explain. 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.

  • 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.


The end result of sound.cfg should look something like this: MTR-BVE1.png 7. Rename your train folder to be lower case and without space. (You may use underscore to replace space)

This will be your sound ID to reference.

8a. Import all the sound to any audio editor and convert them to Mono Channel

8b. Export all the .wav/.flac file to .ogg file.

(For Audacity user, use File > Export > Export Multiple, and choose Ogg Vorbis Files)


9. Copy the train folder to Your Resource Pack/assets/mtr/sounds. (Make the folder if it doesn't exist)

10. Make a sound.json file in Your Resource Pack/assets/mtr if you haven't already, an example could be found here.

11. Make a sound entry in sound.json of every file in sound.cfg, the ID should be sound_id_filename

Your sound.json in the end should look something like this (I used kksp as my train folder name): MTR-BVE2.png.png Finally, add the following line to your mtr_custom_resources.json, replace soundID to your actual sound ID/Train Folder Name

"bve_sound_base_id": "soundID"

Your train in mtr_custom_resources.json should now look something like this:MTR-BVE3.pngNow start your game, and everything should work.

Notes

  • You will need to re-select the train in the siding, or restart the client for the new sound changes to apply.
  • 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 sound.json
  • Small motor noises will still be heard when coasting, this is to simulate train adding small bits of power to maintain it's speed.
  • (Does not work on BVE Sound) You can add "const_playback_speed": true to your train, this will make the acceleration play back at a constant speed no matter your acceleration.