XML:SNDD: Difference between revisions

m
somehow I missed the atm_low_perc variants that also use BaseTrack2
(wording around TRAM sound lookup; added blurb on PreventRepeat; more links between sections)
m (somehow I missed the atm_low_perc variants that also use BaseTrack2)
 
(One intermediate revision by the same user not shown)
Line 505: Line 505:
==Scripting music==
==Scripting music==
===BSL commands===
===BSL commands===
'''sound_music_start name:string [volume:float]''', e.g. <tt><code>sound_music_start mus_asian 0.75</code></tt>
'''sound_music_start name:string [volume:float]''', e.g. <code>sound_music_start mus_asian 0.75</code>


'''sound_music_stop name:string''', e.g. <tt><code>sound_music_stop mus_asian</code></tt><br>
'''sound_music_stop name:string''', e.g. <code>sound_music_stop mus_asian</code><br>
If .amb file has InterruptTracksOnStop flag, music will proceed immediately to <OutSound>, otherwise current segment will finish playing and then <OutSound> will play.
If .amb file has InterruptTracksOnStop flag, music will proceed immediately to <OutSound>, otherwise current segment will finish playing and then <OutSound> will play.


'''sound_music_volume name:string volume:float [time:float]''', e.g. <tt><code>sound_music_volume mus_asian 0.35 1.0</code></tt><br>
'''sound_music_volume name:string volume:float [time:float]''', e.g. <code>sound_music_volume mus_asian 0.35 1.0</code><br>
Volume change takes effect instantly unless you specify a time as the third parameter.
Volume change takes effect instantly unless you specify a time as the third parameter.


===Stopping the music===
===Stopping the music===
When Oni's BSL scripting wants to stop some music, it will either:
When Oni's BSL scripting wants to stop some music, it will either:
# Call <tt>sound_music_stop</tt>.
# Call <code>sound_music_stop ''mus_name''</code>.
# Fade out the music with <tt>sound_music_volume</tt> and then call <tt>sound_music_stop</tt> when the music has reached zero volume.
# Fade out the music with <code>sound_music_volume ''mus_name'' 0.0 4.0</code> and then call <code>sound_music_stop ''mus_name''</code> when the music has reached zero volume. (4.0 is a sample fade-out time. Oni uses values ranging from 0.25 to 6.0 in various situations.)


When setting up your .amb file, you have to think about the timing of how the music will be used. If a music track has an <OutSound> in its .amb, then the sequence of events will be:<br>
When setting up your .amb file, you have to think about the timing of how the music will be used. If a music track has an <OutSound> in its .amb, then the sequence of events will be:<br>
:<tt>sound_music_stop</tt> called → current body segment finishes playing → outro segment plays
:<tt>sound_music_stop</tt> called → current body segment finishes playing → outro segment plays


Thus it can be quite a while before the music really stops. If this lag time is a problem, you could:
Thus it can be quite a while before the music really stops. If this is a problem, you could:
# Leave out the <OutSound> so that <tt>sound_music_stop</tt> ends the music after the current segment finishes.
# Leave out the <OutSound> so that <tt>sound_music_stop</tt> ends the music after the current segment finishes.
# Fade out the music over the desired amount of time with <tt>sound_music_volume</tt>. Don't forget to call <tt>sound_music_stop</tt> after the fade-out finishes so that the sound system can stop playing the music.
# Fade out the music over the desired amount of time with <tt>sound_music_volume</tt>. Use <tt>sound_music_stop</tt> on the track after its fade-out finishes so that the sound system can stop playing the music.
# Use the InterruptTracksOnStop flag so that <tt>sound_music_stop</tt> skips to playing <OutSound> immediately.
# Use the InterruptTracksOnStop flag so that <tt>sound_music_stop</tt> skips to playing <OutSound> immediately.


====InterruptTracksOnStop====
====InterruptTracksOnStop====
Oni contains many music OSBDs that come in two variants – with and without the InterruptTracksOnStop flag – such as OSBDmus_amasian.amb and OSBDmus_amasian_hd.amb; they play the same actual SNDDs, but the "_hd" variant has the InterruptTracksOnStop flag. When <tt>sound_music_stop</tt> is called on a "_hd" OSBD, you will hear it immediately jump to the outro, which is slightly jarring but can be useful in some cases. An easily observed example is OSBDmus_fiteb_hd, which plays in {{C2}} when combat starts after the opening cutscene in the lobby. When the last blow is delivered to the last standing Striker, the music will immediately jump to its outro. Any discontinuity in the rhythm is masked by the final attack sound effect, and in fact the hard transition serves to punctuate the end of the action. By contrast, if a track was interrupted in this way during a quiet moment in the game it would probably sound awkwardly abrupt.
Oni contains many music OSBDs that come in two variants – with and without the InterruptTracksOnStop flag – such as OSBDmus_amasian.amb and OSBDmus_amasian_hd.amb; they play the same actual SNDDs, but the "_hd" variant has the InterruptTracksOnStop flag. When <tt>sound_music_stop</tt> is called on a "_hd" OSBD, you will hear it immediately jump to the outro, which is slightly jarring but can be useful in some cases. An easily observed example is OSBDmus_fiteb_hd, which plays in {{C2}} when combat starts after the opening cutscene in the lobby. When the final blow is delivered to the last standing Striker, the music will immediately jump to its outro. Any discontinuity in the rhythm is masked by the sound of the attack that triggers it, and in fact the hard transition serves to punctuate the end of the action. By contrast, if a track was interrupted in this way during a quiet moment in the game it would probably sound awkwardly abrupt.


==Registering sounds for characters==
==Registering sounds for characters==
Line 720: Line 720:


===Mixing music tracks===
===Mixing music tracks===
Oni uses this feature in order to layer one music track over another, but only in one functioning OSBD: '''OSBDmus_xtr2''', the sorrowful string piece which plays in the Shinatama farewell scene in {{C8}} and at the conclusion of Hasegawa's monologue at the start of {{C11}}. The OSBD's use of <BaseTrack1> and <BaseTrack2> leads to the high string note SNDDmus_xtr2hi.aif playing continuously over the melody in SNDDmus_xtr2_[1-6].aif.
Oni uses this feature in order to layer one music track over another, but only in three (working) OSBDs: '''OSBDatm_low_perc1''', '''OSBDatm_low_perc2''', and '''OSBDmus_xtr2'''. In this article we'll just consider the latter piece, but the two atm_low_perc variants can be heard at {{SectionLink|Music/Ingame|atm_low1}}. '''OSBDmus_xtr2''' is the sorrowful string piece which plays in the Shinatama farewell scene in {{C8}} and at the conclusion of Hasegawa's monologue at the start of {{C11}}. The OSBD's use of <BaseTrack1> and <BaseTrack2> leads to the high string note in SNDDmus_xtr2hi.aif playing continuously over the melody in SNDDmus_xtr2_[1-6].aif.


The benefit of this live-mix approach is that you can also use the individual tracks in other places, or in combination with a different second track; for instance, '''OSBDmus_choral1''' calls for the same SNDDmus_xtr2_[1-6].aif to be mixed with SNDDmus_choral1.aif (except that SNDDmus_choral1.aif doesn't exist and the OSBD is never called…).
The benefit of this live-mix approach is that you can also use the individual tracks in other places, or in combination with a different second track; for instance, the relic '''OSBDmus_choral1''' calls for the same SNDDmus_xtr2_[1-6].aif to be mixed with SNDDmus_choral1.aif (except that SNDDmus_choral1.aif doesn't exist and the OSBD is never called…).


Note that when mixing two tracks in this way, both tracks will have to share the same <InSound> and <OutSound>. For this reason, SNDDmus_xtr2endmx.aif was created to end the mix of SNDDmus_xtr2hi.aif and SNDDmus_xtr2_[1-6].aif, as opposed to SNDDmus_xtr2_end.aif which provides an end for only SNDDmus_xtr2_[1-6].aif when playing on its own.
Note that when mixing two tracks in this way, both tracks will have to share the same <InSound> and <OutSound>. For this reason, SNDDmus_xtr2endmx.aif was created to end the mix of SNDDmus_xtr2hi.aif and SNDDmus_xtr2_[1-6].aif, as opposed to SNDDmus_xtr2_end.aif which provides an end for only SNDDmus_xtr2_[1-6].aif when playing on its own.