Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Level Editor Tutorials

Closed Thread
Thread Tools
Old 24-11-06, 14:46   #1
Titak's Avatar
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 30,199
Default Sound issues


The LE uses two different sound types: Audio and sound effects .

The audio files are located in the TRLE/Audio folder and they are in *.wav format.
The audio files are basically background music, like background ambience, thrill music, mysterious music and offcourse the well known secret tune.

The files are numbered 000 to 111. You can replace existing files with new ones or you can add files. TRLE only came with a couple of audiotracks, but the LE won't accept files with numbers higher than 111!
It simply won't recognise any numbers higher than 111.wav and the audio won't be played ingame even when it is triggered correctly in your project.

WAV Format:
Microsoft ADPCM
44100 kHz
4 Bit

The audio files need to be activated with a trigger.

Open the trigger type window and choose CD in the trigger box.
Put in the number of the audio file you want to be triggered in the box next to it.

Audio files can only be played once in a level.
Exceptions are 005.wav (secret tune) and the background audio loops.

Unless... you change the codebits of the trigger. You can trigger an audio track to play up to six times when you adjust the codebits of the first trigger for that particular audio track. The below images shows you how to set the codebits. The image is taken from the manual.

The numbers in the top row indicate how many times the track can be triggered.
For example: If you want to play the track 3 times during the level you will only need to click codebit 2 . (It turns black when clicked)

Note 1:
The above information applies to the original TRLE.
When you are using TRNG, you can trigger audio as many times as you want through flipeffect triggers. TRNG also allows for different audio formats, like all WAV formats and MP3 and OGG.
TRNG also allows for playing two different tracks at the same time, one on channel1 and one on channel2.

Note 2:
Originally Posted by Lwmte View Post
I think there's general misunderstanding how trigger mask buttons (1-2-3-4-5) work with CD triggers. Manual is also completely wrong describing this feature. It is properly described in TRS3 document (look for 4.6.9. TrigAction 0x08 — Play Soundtrack chapter).

Simply said, you have to toggle either 1 or 2 or 3 or 4 or 5 trigger mask button to play same track once again, but it will only work if you use it on different triggers. E.g., you can play same track in two different parts of your level using different CD triggers with trigger mask 1 and trigger mask 2, but you can't force playing same track twice on same trigger, say, placing both CD triggers with mask 1 and 2 on the same sector. As long as track was triggered for that particular mask, it won't play again.

Also you can use one shot flag as extra play count, because for CD trigger, engine treats one-shot flag as extra trigger mask, so overall you can play the track 6 times in your level, using 6 different CD trigger setups.
Note 3:
Originally Posted by AkyV
Playing audio tracks

The old (TRLE) way to play an audio track is if you activate a trigger with CD subject type.
But I recommend using the new, TRNG method to play audio tracks, because the new method has some splendid features that CD triggers are unable to use.

Theoretically, you could use the old and the new methods collaterally with each other, if you want.
Due to some interactions between the two methods, I don’t recommend it, so choose only CD triggers or only the new method.

The differences between the old and the new methods:

a, The old method uses CD triggers (to play the track whose ID is typed in Window Object).
The new method uses F68 for channel1 or F129 for channel2 (to play the track whose ID chosen in Window Timer).

b, The old method plays only WAV files.
The new method is able to play other formats as well. (Probably they are only AIFF, MP1, MP2, MP3, OGG.)

c, The old method always, automatically plays the background (loop) audio on audio channel1 and the foreground (single) audio on audio channel2.
The new method is able to play the background track or the foreground track on any channel.

Usually the new method also plays the background audio on audio channel1 and the foreground audio on audio channel2, but it is not necessary, you can choose the required channel. – In fact, now you can use the two channels even to play two loop or two single tracks at the same time.

d, The old method plays a track only once, even without One Shot button pressed.

- TRLE manual says CD triggers will play tracks 2-6 times if you switch on/off some STT number buttons. However, it doesn’t work in TRNG. (Edit: this thing had been cleared up just before.)
- Be careful, if you want to change the loop (background) track with a CD trigger in TRNG. Because, if you have activated at least another CD trigger in the level, for a foreground track, then, after that, the background CD will work only if you save the game and then load that savegame.

The new method is able to play a track any times.

e, The old method plays the tracks of audio folder from ID0 to ID127.
The new method plays the tracks of audio folder from ID0 to ID255.

f, The old method plays these tracks automatically as foreground tracks: ID0-ID101, ID103-104, ID112-ID127, and these tracks automatically as background tracks: ID102, ID105-ID111.
With the new method, you are able to choose if the given track will be played as a foreground or a background track, using any ID from ID0 to ID255.

So the first background track in the Data Script commands could also have any ID, as opposed to TRLE.

g, CD triggers cannot be exported into the Script/WADMerger. FLIPEFFECT triggers can. (That’s why eg. you can use a timer for the audio track of the FLIPEFFECT, using that FLIPEFFECT in the Script, with an Organizer, to start the track only after given seconds elapsed after the start of the Organizer.)

h, The CD txt file in wads folder contains tracks only which are played by CD triggers, i.e. not including the tracks of the new method.

New features which are useable both with the old and the new method:

a, As you see above, both methods have two audio channels.

b, F69 will stop all the tracks immediately. F130 will do that only on the required channel.

c, F133 will adjust the volume of the track which is just playing or just starts playing. (Not bothering the general audio volume value in the Options menu of the game.)

See SoundSettings Script command for a preset of general audio volume.
This is the same you could adjust in the Options menu of the game.

d, The track interrupted won’t stop at once, it has a fade-out, which can be customized, using a Customize= CUST_NEW_SOUND_ENGINE Script command.

e, The audio tracks in TRLE won’t continue if you saved the game when the audio was playing and then you load that savegame. Now you can customize that, using a Customize=CUST_CD_SINGLE_PLAYBACK Script command. (The default value in TRNG is: to continue the track where it was interrupted.)

If you feel nostalgia for TRLE, so you’d like to use CD triggers exactly as in TRLE, i.e. without the new features of them - then these are your possibilities:

a, Adjust all the fade-out values with Customize= CUST_NEW_SOUND_ENGINE to 0, to remove fade-outs.

b, Use CDM_NO_SAVE in Customize=CUST_CD_SINGLE_PLAYBACK, not to continue the tracks which were interrupted, when you load the savegame.

c, Don’t place audio tracks over ID111 in audio folder, or don’t start them with CD triggers (because the biggest track ID with TRLE was 111).

d, Use a Customize= CUST_SET_OLD_CD_TRIGGER, ENABLED Script command. – The results:

- You can’t adjust the volume of tracks started by a CD trigger, using F133.
- ID0 audio track will start automatically (as a loop), if Lara dies, or maybe if you try to use some new audio triggers (eg. F133). (It is considered as a bug.)
- The CD triggers will use only one audio channel: the background track will be interrupted temporarily on that channel if you play a foreground track there. When the foreground track stops the background track will restart.

Maybe you want to use the new method, but in the good old “the background track will be interrupted temporarily on the channel if you play a foreground track there” way. In that case use F193 to play the single track (instead of F68 or F129), on any channel. - But this time the interrupted track will be restored where it has been stopped.
(In fact, this trigger can be used even to interrupt a foreground track with another foreground track, if both tracks just being played are single, not loop.)

- You can use F69 or (adjusting channel1) F130 to abort a track started by a CD trigger, but only if it stops a foreground audio on the one and only audio channel. (I.e. in the case of the background audio, they will start the track, from the beginning.)

I don’t recommend disabling the new method with NewSoundEngine= DISABLED Script command, if you want to use “a really classic audio system” with CD triggers.
I mean, NewSoundEngine= DISABLED causes the audio system will be more or less buggy.
Nowadays I see only one reason to disable NewSoundEngine: when you want to use the “Angkor type” cutscenes with Von Croy – because that cutscene feature works only if the new method is disabled. (“Angkor type” cutscenes are which you could see in the first level of The Last Revelation, where black stripes showed up at the bottom and the upper edges of the screen while you could hear Von Croy’s advices for the young Lara.) I.e. if the new method is enabled then you will be able to move Von Croy in the level, and make him do other things as well – but you will not be able to play “Angkor type” cutscenes with him.
However, there is a better way for the “Angkor type” cutscenes, without disabling the new method: you can simulate them as demo type cutscenes.

Some Script commands are also able to control single or loop audio tracks. See eg. Image or Diary commands.
Note 4:
Originally Posted by AkyV
Imported audio tracks

There is a special method to play audio tracks: in an imported way.
Each audio track you want to import (into Script.dat) must be placed anywhere in Level Editor main folder. The type must be AIFF, MP1, MP2, MP3, OGG or WAV, the name could be anything.
You need to type an ImportFile command (also using an IMPORT_MEMORY constant in it) for each audio track that will be imported, in the [Options] part of the Script. Each ImportFile command will contain the data about that track, including the ID and the name.

As opposed to the “usual” audio tracks, the ID and the name is different in the case of imported tracks – because the name is not equivalent with the ID.
Besides, the ID’s of ImportFile commands and the “usual” audio track ID’s are not the same.

After building the Script, the audio track is imported into Scipt.dat. It means you can remove the track from the Level Editor main folder, you don’t need it any more, the game will play the imported audio tracks directly from Script.dat.

- This Script.dat must be the final Script.dat of your game or else you will have a problem if you build the Script again. (The problem is you will get an error message about that audio track is missing in Level Editor main folder.)
- The aggregated size of the files like that can’t be bigger than about 20 MByte.

And why is it worth playing audio tracks from the Script.dat? – Because:

a, Usually if you play an audio track that will perhaps start with a bit slip – mostly if you start it from a compact disk, not from a HDD. It won’t happen ever with imported audio.

b, You don’t need to share that audio track via Level Editor audio subfolder with other people, when you release your game.

c, The new audio method is able to use “only” maximum 256 slots in the audio folder. If that is not enough, then you can use imported audio tracks as well.

The imported audio tracks work in the game exactly the way as an audio track played by the new audio method does, except: in loop mode you must use F131 to start an audio track, in single mode you must use F132.
The triggers will use the audio ID’s you typed in the ImportFile commands.

You can play ImportFile audio files even with “normal” audio triggers, if the name of the ImportFile audio file is a number, as if it were an audio file in audio folder. (This time naturally you cannot have an audio file with that number in audio folder.)

You can create maximum 199 ImportFile commands for each level, choosing ID’s for them from a 1, 2, 3,… 1998, 1999 interval. However, the biggest ImportFile ID in F131/F132 triggers is 200 – that’s why ImportFile with ID201-ID1999 can be used only:

= if the audio track of that ImportFile is played with a “normal” audio trigger, or
= it the command is used for another function of ImportFile (see more about it NG Center/Reference), so they are not useable for audios/triggers.
If it walks like a duck and if it quacks like a duck, it is a duck.

Last edited by Titak; 11-12-17 at 19:27.
Titak is offline  
Old 24-11-06, 14:47   #2
Titak's Avatar
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 30,199

Sound effects

Sound effects are the sounds Lara makes, like her footsteps, grunts, gunfire, etc. But also all other sounds an animating object, like a trapblade, or baddies make.

These so-called soundsamples are located in the TRLE/Sound/Samples folder.

22050 kHz
16 Bit

The game can crash if the format is wrong!

You can use Windows Sound Recorder to save a sample in the right format. But I've had problems with this myself (the sample seemed to have been saved in the right format but it still wouldn't play or the game crashed) and I now use Cool Edit 96. Works like a charm!

A soundeffect is activated by assigning the sound to the wad AND the object.
When you add a new object with sound to your wad using WADMerger the sound will usually automatically be added to your wad.
If this does not happen or if you have been creating your own objects you need to manually add the sound to the wad. To do so you need to edit the Sound.txt.

The sound.txt contains all sounds used by the LE and it is located in the TRLE/Sound/LevelSFX Creator folder.
I've coloured the text on the screenshot to make the columns I'm describing below more visible.

First column
(LARA_FIRE) is a description of the sound. This can be changed as you see fit.

Second column
(magnum) contains the name(s) of the associated samples. You can simply assign a new sound to an object by changing the name of the sample in this column.

Third column
(VOL75) indicates the volume of the sound. The higher the number, the louder the sound will be ingame. If the VOL is not set you won't be able to hear the sound ingame.

Fourth column
can contain the letters: P, V, R, L
- P = Pitch: A sound with V will have a random slight pitch change each time it is played.

- V = Volume: A sound with V will have a random slight volume change each time it is played. If you carefully listen to the shotgun sound ingame you will notice that not every shot sounds the same: the LARA_SHOTGUN line has V assigned to it.

P and V are used in cases where a sample tends to be repeated very often, which would sound too mechanical if it were repeated exactly the same way all the time.

- R Radius

- L Stands for looping . This needs to be assigned if you want a sample to play over and over again (=loop) The WATERFALL_LOOP line has an L assigned to it.

fifth column
can contain the letters CH followed by a two digit number.

- CH is the chance of the sound to be played when triggered. The smaller the CH number the less it will be played. If no CH is included in this column the sound will play every time it is triggered. Example: CH is assigned to Lara's climbing grunt: you don't hear it all the time when she is climbing.

Sixth column
contains the PIT of the sound, which stands for pitch.
PIT followed by a positive number raises the pitch, PIT followed by a negative number lowers the pitch. Leave the PIT out and no pitch change will occur.

Seventh column
contains the RAD values. RAD stand for radius/range . This value determines from how far away the sound can still be heard.
The higher the number the further away the sound can still be heard. The rollingball and spikes for example have a RAD of 26, which makes them heard from very far away. Normal sounds have RAD06.

eight and last column
contains a series of letters preceded by a #. These letters are associated with wads. The letters are case sensitive, so a is not the same as A.
Quoted from Skribbler from his tutorial on SFX Issues :
All sounds associated with the #g will be added to all *.sam and *.sfx files (except *.sam and *.sfx files associated with the #t), since they are considered vital to every wad. The #t is associated only with the Title Load Screen level, and only those sounds associated with the #t will be included with any *.sam and *.sfx files built with it. All other letters and combination of letters (except #G) may be used as associated with a level. These are the same as the sound code letters indicated on p. 65 of the Tutorial Manual (and also in the readme.txt file included with the New Wads download). The complete list is as follows:

g - General; all levels
t - Title Load Screen (title)
a - Angkor Wat (angkor, angkor1)
b - Race For The Iris (ang_race)
c - The Tomb Of Seth (settomb, settomb1)
d - Burial Chambers (settomb2)
e - Valley Of The Kings (jeepchas)
f - KV5 (jeepchs2)
h - Temple Of Karnak (karnak, karnak1)
i - The Great Hypostyle Hall (hall)
j - Sacred Lake (lake)
k - Lake 2 (Level associated with TR:TLR that was not released)
l - Tomb Of Semerkhet (semer)
m - Guardian Of Semerkhet (semer2)
n - Desert Railroad (train)
o - Alexandria (alexhub)
p - Coastal Ruins (coastal, alexhub2)
q - Pharos, Temple Of Isis (palaces)
r - Cleopatra’s Palaces (cleopal, palaces2)
s - Catacombs (catacomb, csplit1)
T - Temple Of Poseidon (csplit2)
u - The Lost Library (library)
v - Hall Of Demetrius (libend)
w - City Of The Dead (city, bikebit; also New City [newcity])
x - Trenches (nutrench)
y - Chambers Of Tulun (cortyard)
z - Street Bazaar (lowstrt)
A - Citadel Gate (highstrt)
B - Citadel (citnew)
C - The Sphinx Complex (joby1a)
D - The Valley Temple (joby 1b - Level associated with TR:TLR included on the CD, but not in the game)
E - Underneath The Sphinx (joby2)
F - Menkaure’s Pyramid (joby3a)
H - Inside Menkaure’s Pyramid (joby3b)
I - The Mastabas (joby4a)
J - The Great Pyramid (joby4b)
K - Khufu’s Queens Pyramids (joby4c)
L - Inside The Great Pyramid (joby5a)
M - Temple Of Horus (Part I, joby5b)
N - Temple Of Horus (Part II, joby5c)
Ti - The Times Exclusive (times)
Tu - Playable Tutorial Level (tut1)

Converting the oldfashioned way
Once you have edited the sound.txt you need to convert it into new .sfx and .sam files.

If you are running the LE on XP and if you are using one of the letters listed above you can do this by simply double clicking the SFX_Example.bat in the TRLE/Sound/LevelSFX Creator folder. The new files will automatically be placed in the Wads folder.

If you are using a custom letter sequence (eg I'm using hm for my levels) you need to use the DOS Prompt to convert the sound.txt file.
The manual says: "From the LevelSFX Creator directory type the following DOS command: pcwadsfx settomb c. Of course, use the WAD (along with its associated letter) you wish to change."
Settomb being the name of your wad, c being the letter or letter combination associated with your wad.
Once converted you need to put the new files into the Wads folder.

Convert the tom file of your wad and if all has been done correctly you will hear the changes you have made!

Many thanks to Idealist, Geckokid and Mulf for the info on sound samples!

Adding sounds using WADMerger
You can also add sounds to your wad by using WADmerger's Sound Manager.
- Open your wad and click the Sound Manager button. A small window will pop up with a list of the soundeffects.
- Scroll down to locate the sound effect you want to add and check it by clicking on the small white box in front of it.
- Save the wad.

Keep in mind that you can only ADD sounds to a wad with WADMerger. You can't remove them.
To remove sounds from you wad you need to edit the sounds.txt like described above.
Also, WADMerger Sound Editor tends to be buggy. So, use at your own risk.

Converting with Screamer:
You can use SCREAMER to open a sounds.txt file and you can then edit it like you would do the manual way.
So add sounds by assigning your level letter(s) to the sound, change the name of the sample it should use, change pitch, volume, etc.
Then save the sounds.txt and output the wad.
Screamer will then create new .SAM and .SFX files for your wad, which it places in the Screamer Output folder.
All you have to do then is move the new files to your wad folder and rename them if you haven't given the wad a name in Screamer.

Converting with TRLE Sound Editor:
Screamer does not always work on Windows8 but sapper made this great new sound editing tool called TRLE Sound Editor.
With it you can open the sounds.txt and edit it like you would do the manual way.
The converting is done by the program itself, just like with Screamer.

Converting with SFX Manager
Magplus also made a program with which you can edit and convert the sounds.txt file.

Note 1:
Remember that you do not have to use the letters mentioned in the list above.
You can use your own letter or letter combination. Just make sure you include/assign this letter or letter combo when converting and all lines with that letter(combo) will be added to your level wad.

Note 2:
If you are using a lot of custom sounds and if you are using a lot of different sounds per level, it can happen that you do not have enough slots/room for all levels in one sounds.txt.
Well, no problem, use one sounds.txt per level for example.
I'm not sure if the oldfashioned way of converting allows for different names for the sounds.txt, but Screamer, TRLE Sound Editor and SFX Manager surely can handle them.
Simply open the Sounds-06KA2.txt (This is what the sounds.txt for one of my MoA2 levels is called), edit it and convert.
In this case it is easiest to only assign "g" and your custom letter(combo) to the slots.

Here's an example of part of one of my sounds.txt files, Sounds-06KA2.txt, lines 60 to 82:
UNDERWATER:               undwatr                           VOL40          L        PIT00           #g 
UNDERWATER_SWITCH:        uw_swt                            VOL80  P                                #KA 
LARA_PICKUP:              lara_aha                          VOL40                            RAD13  #g 
PUSHABLE_SOUND:           l_pshst                           VOL35          L        PIT-20   RAD10  #KA 
DOOR_GENERAL:             gen_door                          VOL80  P V              PIT20           
HELICOPTER_LOOP:          l_moa_ratll                       VOL40          L                 RAD10  #KA 
ROCK_FALL_CRUMBLE:        sk_die_effect                     VOL50                            RAD10  #KA
ROCK_FALL_LAND:           sk_die_effect                     VOL70                   PIT10    RAD10  #KA
PENDULUM_BLADES:          polesrise                         VOL50                            RAD08
STALEGTITE:               splash2 splash3 splash4           VOL35                            RAD07  #KA 
LARA_THUD:                lar_th1 lar_th2                   VOL50  P V              PIT-10          #g 
GENERIC_SWOOSH:           swoosh1                           VOL45  P V                       RAD10  #g 
GENERIC_HEAVY_THUD:       gen_thud                          VOL80  P                PIT-50   RAD10  #g 
CROC_FEET:                fl_kick01 fl_kick02 fl_kick03     VOL40  P V              PIT-10   RAD10  #g 
SWINGING_FLAMES:          polesrise                         VOL40                            RAD08
STONE_SCRAPE:             spinhook                          VOL90                   PIT-50   RAD10
BLAST_CIRCLE:             hand_pl1 hand_pl2 hand_pl3        VOL20                            RAD08  #KA
BAZOOKA_FIRE:             polesrise                         VOL30                            RAD08
HECKLER&KOCH_FIRE:        d_eagle3                          VOL50                            RAD13  #KA 
WATERFALL_LOOP:           l_wfall                           VOL25          L                 RAD08  #g 
CROC_ATTACK:              landing2 landing3                 VOL55                   PIT00    RAD10  #g 
CROC_DEATH:               splash_waterfall                  VOL40  P                         RAD10  #KA 
PORTCULLIS_UP:            gate3                             VOL50                            RAD10
As you can see, only "g" and the lettercombo "KA" are assigned.
The purple entries are custom sounds.
TRLE Sound Editor marks custom sfx names in purple.
If it walks like a duck and if it quacks like a duck, it is a duck.

Last edited by Titak; 06-12-17 at 12:24.
Titak is offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 22:35.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.