Difference between revisions of "Music.tbl"

From FreeSpace Wiki
Jump to: navigation, search
($Soundtrack Name:)
m (Various spelling and grammar corrections)
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{TableVersion|5307}}
 +
 +
The '''music.tbl''' defines the soundtracks and how they are played in FSO.
 +
 +
 +
This table is one of the [[Modular Tables]] and can be extended with xxx-mus.tbm
 +
 +
[[Tables|List of Tables]]
 +
 
==General Format==
 
==General Format==
*Music.tbl consist of several sections. Some are used to define in-game soundtracks and others various other musics.
+
*Music.tbl consists of two sections: one for in-game soundtracks, another for menu music tracks.
*Sountrack entries
+
*Soundtrack entries
 
**'''#SoundTrack Start'''
 
**'''#SoundTrack Start'''
 
**Soundtracks names and definitions
 
**Soundtracks names and definitions
 
**'''#SoundTrack End'''
 
**'''#SoundTrack End'''
*Other musics
+
*Menu music tracks
 
**'''#Menu Music Start'''
 
**'''#Menu Music Start'''
 
**Music names and definitions
 
**Music names and definitions
 
**'''#Menu Music End'''
 
**'''#Menu Music End'''
  
==Soundtrack Musics==
+
 
 +
==Soundtrack Music==
 +
 
  
 
===$Soundtrack Name:===
 
===$Soundtrack Name:===
 
*Soundtrack Name is immediately followed by the soundtrack order number and the name of the soundtrack.
 
*Soundtrack Name is immediately followed by the soundtrack order number and the name of the soundtrack.
*Syntax: ''Value'': ''Name''
+
*Syntax: '''Integer''': '''String'''
 
**Example: 1: Genesis
 
**Example: 1: Genesis
 +
 +
 +
===+nocreate===
 +
{{Table3610|
 +
*Used with [[Modular Tables|modular tables]] to set the parser to use the modular table only for modifying an existing entry instead of creating a new (possibly incomplete) one.}}
 +
  
 
===Soundtrack Flags===
 
===Soundtrack Flags===
 +
{{Table3610|
 
If the music should be played according to the FS1 style, the following flags should be added after $Soundtrack Name:
 
If the music should be played according to the FS1 style, the following flags should be added after $Soundtrack Name:
  
*+Cycle: FS1
+
*'''+Cycle: FS1'''
 
**This cycles the NRML and BTTL tracks the FS1 way, instead of the FS2 way.
 
**This cycles the NRML and BTTL tracks the FS1 way, instead of the FS2 way.
  
*+Allied Arrival Overlay: NO
+
*'''+Allied Arrival Overlay: NO'''
**This allows the Allied Arrival track to play on its own, as it did in FS1.
+
**This allows the Allied Arrival track to play on its own, as it did in FS1.}}
 +
 
  
 
===Music Tracks===
 
===Music Tracks===
*All music track lines beging with '''$Name:''' followed by the '''filename''' of music track. After the tracks filename the '''number of measures''' in the track is defined followed by the '''number of samples per measure'''.
+
*All music track lines beging with '''$Name:''' followed by the '''filename''' of music track, with file extension. After the tracks filename the '''number of measures''' (NM) in the track is defined followed by the '''number of samples per measure''' (SPM).
*Syntax: $Name: ''Filename.xxx'' ''Value'' ''Value''
+
*Syntax: '''String''' '''Float''' '''Integer'''
 
**Example: $Name: FS2_Amb_A01.wav 25.0 105840
 
**Example: $Name: FS2_Amb_A01.wav 25.0 105840
 +
*The SPM value is computed using the formula '''SPM = 2 * SF * L / NM''', where SF is the sampling frequency in hz and L is length of the music piece in seconds (exact seconds up to about 3 decimal places). The NM value is important. The game uses SPM to determine how long a measure is, and it will stop playing the track after the specified number of measures. Whenever the game situation changes and one track must be interrupted by another, the game will interrupt the current track at the end of the currently playing measure.
 +
So if you enter wrong numbers here, say using a different calculation, the track might still be played to the end - but when it should be interrupted it might not be for quite a while because you specified the length of one measure wrong.
 +
E.g.: If you set NM to 1 and SPM to 2*SF*L the track will be played without problems - BUT, the interrupt will never happen. You have informed the game that the entire track basically consists of one large measure, so it will keep playing the track until that measure is over before switching to any other track - and this can take a while.
 +
So make sure you use correct values here. If the exact measure count is not known you best use the following method:
  
====Hints for sorting out problems====
+
Set NM to half the length of the track in seconds, say 61.202s = 30.601, and SPM to 4 * SF, say 4 * 22050Hz = 88200.
'''[[User:Goober5000|Goober5000]]:'''
+
By doing this you state that one measure is 2 seconds long. This leads to a max delay of 2 seconds.
:'''Number of measures'''
 
::''Find out the number of measures in the file.  The best way to do this is to keep time (by clapping or getting a metronome, finding the average time for one measure, and multiplying by the number of seconds. For reference, FS2_AArv_A01 is a march. Count "ONE, two, ONE..." and don't quite make it to "two" again.  This corresponds with the table, where it says that this bit of music is 1.8 measures long.  This is rather straightforward. The next part is what people had trouble figuring out, and needed the source to see.''
 
:'''Number of samples per measure'''
 
::''The number of samples per measure is the number of bytes per measure divided by 2.  The event-driven music is usually formatted as 16 bits per sample.  A stereo track at 44,100 Hz will be 172 kilobytes per second.  So multiply this number by the length, in seconds, of your music to get the total number of kilobytes actually used by the music itself. Multiply this by 1024 to get the number of bytes in your music.  Now divide the number of bytes by the number of measures to get bytes per measure, and then again by 2 to get samples per measure.''
 
  
===Order of the music tracks:===
 
*'''Ambience'''
 
*'''Allied Arrival during Normal'''
 
*'''Enemy Arrival during Normal'''
 
*'''Battle 1'''
 
*'''Battle 2'''
 
*'''Battle 3'''
 
*'''Allied Arrival during Battle'''
 
*'''Enemy Arrival during Battle'''
 
*'''Victory 1 ( goal completed )'''
 
*'''Victory 2  ( all enemies dead, goals completed )'''
 
*'''Goal Failed'''
 
*'''Player dies'''
 
  
==Menu Musics==
+
Another important result of this is that a track must not contain any quiet at the beginning or end of the file, since that distorts the location of the measures in the file. The game considers the entire file to be the track, it does not check where the actual music starts. So make sure you cut the track so it is a snug fit, begins with music and ends with music.
*Menu musics are defined with '''filename''' after the name of the tracks '''name'''.
+
This is however less important if you do not know the number of measures anyway and use the 2 second work-around described above, since an exact fade after a measure cannot be done that way anyway.
*Syntax for all of the '''Menu Music''' entries are similar
 
*Syntax: $Filename: ''Filename.xxx''
 
**Example: $Filename: FS2_Brief_01.wav
 
  
===$Name: Brief1===
 
*Defines the file used for music when briefing music 1 is selected
 
  
===$Name: Brief2===
+
====Order of the music tracks:====
*Defines the file used for music when briefing music 2 is selected
+
{|-
 +
| style="width:350px"|'''Ambience'''
 +
| style="width:100px"|''"Normal 1"''
 +
|-
 +
|'''Allied Arrival during Normal'''
 +
|''"Ally arrival 1"''
 +
|-
 +
|'''Enemy Arrival during Normal'''
 +
|''"Enemy arrival 1"''
 +
|-
 +
|'''Battle 1'''
 +
|''"Battle 1"''
 +
|-
 +
|'''Battle 2'''
 +
|''"Battle 2"''
 +
|-
 +
|'''Battle 3'''
 +
|''"Battle 3"''
 +
|-
 +
|'''Allied Arrival during Battle'''
 +
|''"Ally arrival 2"''
 +
|-
 +
|'''Enemy Arrival during Battle'''
 +
|''"Enemy arrival 2"''
 +
|-
 +
|'''Victory 1 ( goal completed )'''
 +
|''"Victory 1"''
 +
|-
 +
|'''Victory 2  ( all enemies dead, goals completed )'''
 +
|''"Victory 2"''
 +
|-
 +
|'''Goal Failed'''
 +
|''"Failure 1"''
 +
|-
 +
|'''Player dies'''
 +
|''"Dead 1"''
 +
|-
 +
|}
 +
{{Table3610|
 +
*Following entries have been added by SCP}}
 +
{|-
 +
| style="width:350px"|'''Ambience 2'''
 +
| style="width:100px"|''"Normal 2"''
 +
|-
 +
|'''Ambience 3'''
 +
|''"Normal 3"''
 +
|-
 +
|}
  
===$Name: Brief3===
+
===Specific Music Tracks===
*Defines the file used for music when briefing music 3 is selected
+
{{Table3610|
 +
*If table doesn't have retail like '''$Name:''' at the beginning of the line then a new method for parsing tables can be used
 +
*Instead $'''String''': can be used where the string is shortened name of the music track.
 +
*After the initial entry on the line, rest of the music entry is added after it.
 +
*Name of the music track, name of the associated music file with file extension, number of measure, number of samples per measure
 +
*Syntax: $'''String''': '''String''' '''Float''' '''Integer'''
 +
*Example: $Battle 1:    FS2_Btl_G01.ogg            25.8  176400}}
  
===$Name: Brief4===
 
*Defines the file used for music when briefing music 4 is selected
 
  
===$Name: Brief5===
+
==Menu Music Tracks==
*Defines the file used for music when briefing music 5 is selected
+
*Menu music tracks are defined with '''filename''' after the track's '''name'''.
 
+
*There is a limit of 50 menu music tracks.
===$Name: Brief6===
+
*Syntax for all of the '''Menu Music''' entries are similar
*Defines the file used for music when briefing music 6 is selected
+
*Syntax: $Filename: ''Filename.xxx''
 
+
**Example: $Filename: FS2_Brief_01.wav
===$Name: Brief7===
 
*Defines the file used for music when briefing music 7 is selected
 
 
 
===$Name: Success===
 
*Sets the music played during debriefing after successful mission
 
  
===$Name: Average===
 
*Sets the music played during debriefing after average mission
 
  
===$Name: Failure===
+
===$Name:===
*Sets the music played during debriefing after failed mission
+
*Defines the name of the menu music
 +
*Syntax: '''String'''
  
===$Name: Aquitaine===
+
===+nocreate===
*Defines the main menu music
+
{{Table3610|
 +
*Used with [[Modular Tables|modular tables]] to set the parser to use the modular table only for modifying an existing entry instead of creating new (possibly incomplete) one.}}
  
===$Name: Psampik===
 
*Defines the alternate (Vasudan) menu music
 
  
===$Name: Cinema===
+
===$Filename:===
*Defines the music that is playing when credits are shown
+
*Defines the actual file
 +
*Syntax: '''String''', filename with file extension
  
 
==Sample==
 
==Sample==
*Uses normal soundtrack and menu musics from FS2
+
*Uses normal soundtrack and menu music tracks from FS2
  
 
   #SoundTrack Start
 
   #SoundTrack Start

Revision as of 06:30, 3 February 2013

Revision information.....

FSO Revision: 5307
Note: Please update the version when the page is updated. If your edit had nothing to do with new code entries then please do not edit the version


The music.tbl defines the soundtracks and how they are played in FSO.


This table is one of the Modular Tables and can be extended with xxx-mus.tbm

List of Tables

General Format

  • Music.tbl consists of two sections: one for in-game soundtracks, another for menu music tracks.
  • Soundtrack entries
    • #SoundTrack Start
    • Soundtracks names and definitions
    • #SoundTrack End
  • Menu music tracks
    • #Menu Music Start
    • Music names and definitions
    • #Menu Music End


Soundtrack Music

$Soundtrack Name:

  • Soundtrack Name is immediately followed by the soundtrack order number and the name of the soundtrack.
  • Syntax: Integer: String
    • Example: 1: Genesis


+nocreate

FS2 Open 3.6.10:
  • Used with modular tables to set the parser to use the modular table only for modifying an existing entry instead of creating a new (possibly incomplete) one.


Soundtrack Flags

FS2 Open 3.6.10:

If the music should be played according to the FS1 style, the following flags should be added after $Soundtrack Name:

  • +Cycle: FS1
    • This cycles the NRML and BTTL tracks the FS1 way, instead of the FS2 way.
  • +Allied Arrival Overlay: NO
    • This allows the Allied Arrival track to play on its own, as it did in FS1.


Music Tracks

  • All music track lines beging with $Name: followed by the filename of music track, with file extension. After the tracks filename the number of measures (NM) in the track is defined followed by the number of samples per measure (SPM).
  • Syntax: String Float Integer
    • Example: $Name: FS2_Amb_A01.wav 25.0 105840
  • The SPM value is computed using the formula SPM = 2 * SF * L / NM, where SF is the sampling frequency in hz and L is length of the music piece in seconds (exact seconds up to about 3 decimal places). The NM value is important. The game uses SPM to determine how long a measure is, and it will stop playing the track after the specified number of measures. Whenever the game situation changes and one track must be interrupted by another, the game will interrupt the current track at the end of the currently playing measure.

So if you enter wrong numbers here, say using a different calculation, the track might still be played to the end - but when it should be interrupted it might not be for quite a while because you specified the length of one measure wrong. E.g.: If you set NM to 1 and SPM to 2*SF*L the track will be played without problems - BUT, the interrupt will never happen. You have informed the game that the entire track basically consists of one large measure, so it will keep playing the track until that measure is over before switching to any other track - and this can take a while. So make sure you use correct values here. If the exact measure count is not known you best use the following method:

Set NM to half the length of the track in seconds, say 61.202s = 30.601, and SPM to 4 * SF, say 4 * 22050Hz = 88200. By doing this you state that one measure is 2 seconds long. This leads to a max delay of 2 seconds.


Another important result of this is that a track must not contain any quiet at the beginning or end of the file, since that distorts the location of the measures in the file. The game considers the entire file to be the track, it does not check where the actual music starts. So make sure you cut the track so it is a snug fit, begins with music and ends with music. This is however less important if you do not know the number of measures anyway and use the 2 second work-around described above, since an exact fade after a measure cannot be done that way anyway.


Order of the music tracks:

Ambience "Normal 1"
Allied Arrival during Normal "Ally arrival 1"
Enemy Arrival during Normal "Enemy arrival 1"
Battle 1 "Battle 1"
Battle 2 "Battle 2"
Battle 3 "Battle 3"
Allied Arrival during Battle "Ally arrival 2"
Enemy Arrival during Battle "Enemy arrival 2"
Victory 1 ( goal completed ) "Victory 1"
Victory 2 ( all enemies dead, goals completed ) "Victory 2"
Goal Failed "Failure 1"
Player dies "Dead 1"
FS2 Open 3.6.10:
  • Following entries have been added by SCP
Ambience 2 "Normal 2"
Ambience 3 "Normal 3"

Specific Music Tracks

FS2 Open 3.6.10:
  • If table doesn't have retail like $Name: at the beginning of the line then a new method for parsing tables can be used
  • Instead $String: can be used where the string is shortened name of the music track.
  • After the initial entry on the line, rest of the music entry is added after it.
  • Name of the music track, name of the associated music file with file extension, number of measure, number of samples per measure
  • Syntax: $String: String Float Integer
  • Example: $Battle 1: FS2_Btl_G01.ogg 25.8 176400


Menu Music Tracks

  • Menu music tracks are defined with filename after the track's name.
  • There is a limit of 50 menu music tracks.
  • Syntax for all of the Menu Music entries are similar
  • Syntax: $Filename: Filename.xxx
    • Example: $Filename: FS2_Brief_01.wav


$Name:

  • Defines the name of the menu music
  • Syntax: String

+nocreate

FS2 Open 3.6.10:
  • Used with modular tables to set the parser to use the modular table only for modifying an existing entry instead of creating new (possibly incomplete) one.


$Filename:

  • Defines the actual file
  • Syntax: String, filename with file extension

Sample

  • Uses normal soundtrack and menu music tracks from FS2
  #SoundTrack Start
  $Soundtrack Name: 1: Genesis
  $Name:   FS2_Amb_A01.wav      25.0     105840
  $Name:   FS2_AArv_A01.wav     1.8      105840
  $Name:   FS2_Arv_B01.wav      3.8      81415
  $Name:   FS2_Btl_A01.wav      25.8     66150
  $Name:   FS2_Btl_A02.wav      27.8     81415
  $Name:   FS2_Btl_A03.wav      39.8     81415
  $Name:   FS2_AArv_A01.wav     1.8      105840
  $Name:   FS2_Arv_B02.wav      3.8      81415
  $Name:   FS2_Vict_A01.wav     2.8      52920
  $Name:   FS2_Vict_A02.wav     30.8     52920
  $Name:   FS2_Dth_A01.wav      23.8     132300
  $Name:   FS2_Dth_A01.wav      23.8     132300
  #SoundTrack End
  #Menu Music Start
  $Name:      Brief1
  $Filename:  FS2_Brief_01.wav
  $Name:      Brief2
  $Filename:  FS2_Brief_02.wav
  $Name:      Brief3
  $Filename:  FS2_Brief_03.wav
  $Name:      Brief4
  $Filename:  FS2_Brief_04.wav
  $Name:      Brief5
  $Filename:  FS2_Brief_05.wav
  $Name:      Brief6
  $Filename:  FS2_Btl_A01.wav
  $Name:      Brief7
  $Filename:  FS2_Cinema2.wav
  $Name:      Success
  $Filename:  FS2_DB_01.wav
  $Name:      Average
  $Filename:  FS2_DB_02.wav
  $Name:      Failure
  $Filename:  FS2_DB_03.wav
  $Name:      Aquitaine
  $Filename:  Aquitaine.wav
  $Name:      Psampik
  $Filename:  Psampik.wav
  $Name:      Cinema
  $Filename:  FS2_Cinema2.wav
  #Menu Music End