Audio Playback in the TRNG
by
Titak
New Audio Engine
The new TRNG soundengine is activated
by default. If you do not wish to use the TRNG soundengine and wish to
use the original TRLE soundengine, add the following line to your
script:
NewSoundEngine= DISABLED.
Audio formats
The new sound engine enables all
types of WAV formats (not just the original TRLE WAV formats) as well as
OGG, MP3, MP2 and AIFF formats. The engine will automatically detect
which audio formats are present in the Audio folder so you don't have to
assign them in the scripts.
The TRNG sound engine gives priority
to OGG files. If there are no OGG files, the engine will search for
MP3s, then WAV formats or the other formats MP2 and AIFF.
If for
example you have the following files in your Audio folder:
034.wav
034_Interlude.mp3
159_FlyBy.mp3
159_TopView.ogg
005.wav
the TRNG will play these files:
034_Interlude.mp3
159_TopView.ogg
005.wav
Naming the audio files
Notice the names of the audio files
in the above examples. You can now also add names to your audiotracks so
it will be easier to see which audiotrack is which selection of music.
Names say more than numbers, right? Just make sure that the number is
still there at the beginning of the name.
Keep in mind that TRNG
will also play the files with the longest name. So if you have for
example the following two tracks in your Audio folder:
005.wav
005_Secret.wav
the TRNG will play the file '005_Secret.wav'.
Two channels simultaneously
With this new sound
engine you can now play two audiotracks at the same time: one on the
background (channel 1) and one on the foreground (channel 2). This is
not possible with the original TRLE soundengine.
Audio flipeffects
Flipeffect triggers can be used to
trigger the audiotracks but they can also be used to reduce/increase the
volume of a track, to go back to the original track on that same channel
when the triggered track has finished playing, make an audiotrack play
only once or make it loop forever until triggered otherwise.
Below are a few examples of what can be done with this new sound engine
and with the audio flipeffects.
New Flipeffects for Audio Playback
Included audio-flipeffect-triggers can be seen
in the below screenshot:
In
this tutorial I'm am going to give examples on how you can use the
audio-flipeffects marked in
yellow
above.
If you use the
OGG format
for your audio, two audio tracks can be played at once: the background
audio/ambience (channel 1) and a foreground track (channel 2) which was
triggered.
Here are two examples of how you can setup flipeffect
triggers for playing two audio tracks at once.
EXAMPLE 1
107.ogg
- TRA mansion background audio track
-
background track
- is enabled in the script of the level so it plays
by default when the level starts
001.ogg
- TR2
Venice audio track
- foreground music
- triggered by a small
pushswitch
Since both audio tracks are music tracks you don't
want to have them play at the same volume because it sounds bad. The
volume of the background track is automatically reduced a bit when a new
foreground track is triggered but in this case it is still too loud. So
the volume of the audio track needs to be reduced a lot when the
foreground track is triggered and starts playing.
To accomplish
this you need to place the following two triggers on the same tile:
1. to
trigger track 001.ogg to start playing.
2. to reduce the volume of track 107.ogg.
As you can see you don't have to type in the number of the background
audio track. The engine knows automatically which audio track is set as
background track, even when you have used a regular CD trigger to change
background audio.
In this example I have set the volume to 10 so
the background audio can still be heard, but barely. You can also set it
to 0, so it can't be heard at all.
Okay, now I can hear you ask
'Why not use a regular CD trigger to trigger 001.ogg to play?'.
The
answer is that you can do that too, no problem.
The reason I used
the flipeffect trigger is because that way the audio track can be
triggered over and over again, as many times as the player wants. Each
time the player presses the pushswitch, 001.ogg will start playing from
the beginning, even is it hasn't finished playing yet. This is not
possible with the regular CD trigger.
Important: the volume of the background track does not return to full volume once the foreground track has finished playing because it was reduced with a flipeffect trigger. To make it return to full volume one would need to place another flipeffect trigger for it, with volume set to 100.
EXAMPLE
2
107.ogg
- TRA mansion background audio
track
- background track
- is enabled in the script of the level
so it plays by default when the level starts
016.ogg
- 'chains rattling' audio track
-
foreground music
- triggered by a rollingball (heavy trigger)
Since this 016.ogg track is more like a sound effect it is okay to
keep the background track at full volume.
To accomplish this you
need to place the following two triggers on the same tile:
1. to
trigger track 016.ogg to start playing.
2. to keep the full volume of track 107.ogg.
So now 107.ogg keeps playing at full volume
while 016.ogg plays at the same time, also at full volume.
This
is much better than having the background audio stop completely, for 2
reasons:
a.
it simply sounds better to also have the background audio still playing
when a foreground track is more like a sound effect.
b. no more silences
in between.
EXAMPLE
3
Examples 1 and 2 speak of
triggering an audiotrack that will only play once, because the trigger
was set to single playback
in the (E)tra
box of the trigger window. But if you have a closer look at this
(E)tra box you'll
see you can also set it to looped playback.
This is a very interesting feature because by setting the trigger to
looped playback
you can have as many looped audio tracks as you want, instead of only
the default range from 098.wav to 111.wav.
With this
looped playback
setting it does not matter what number the audio track has, it will
repeat itself over and over, until Lara steps on a new audio trigger.
Again, you can do this for background audio (channel 1) and for
foreground audio (channel 2).
channel 1
If you
use the flipeffect for channel 1 audio, the newly triggered audio will
replace the current background audio, just like it does when you trigger
a new background audio track with the CD-trigger. But with this
flipeffect trigger you can set whatever track you want to looping
background, even the 005 secret sound, as shown in the below screenshot!
channel
2
If you use the
flipeffect for channel 2 audio, the newly triggered audio will play
while the background audio also keeps playing.
You could use
this, for example, with an ambience audio track as background and then
trigger a music track on channel 2 in an area where Lara can hear a
radio playing. Or you could use it to add some extra atmospheric
ambience in a place where it becomes scarier, or where water is dripping
from the ceiling or where there are supposed to be more birds or bugs
flying around, or... (use you imagination!)
The trigger then
needs to be set up like this:
Note 1:
Keep in mind that in this case you can also
set a second flipeffecttrigger to reduce/increase the volume of the
background audio (channel 1), as described in EXAMPLE 1 and 2.
Note 2:
If you want to play around with reducing the
volume of the background track and increasing it again after the
triggered foreground track has finished playing, you can also export the
flipeffecttriggers, put them in Triggergroups in the script and use an
Organizer to time the increas in volume so it matches the length of the
triggered foreground track.
An Organizer can also be used for
other timed audio flipeffects but I'm not going into details about that
in this tutorial. You can read more about the Organizer and its use in
the 'Timed Events using the Organizer= Script Command' tutorial.