v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Audio"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (updated setting link)
m
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Stub}}
+
{{Modding}}
  
 
''Dwarf Fortress'' contains music tracks which play at various points in game, including the main menu theme. Some types of audio seem to be triggered by events, while others play randomly while certain criteria are met. These seem to include some [[weather]] sounds, wild ambience, building sounds, river etc.
 
''Dwarf Fortress'' contains music tracks which play at various points in game, including the main menu theme. Some types of audio seem to be triggered by events, while others play randomly while certain criteria are met. These seem to include some [[weather]] sounds, wild ambience, building sounds, river etc.
  
According to Tarn, there are different settings for every track. One depends on the caverns being opened, one plays only after the second year, one is a first year track.  Strike the Earth plays when you first embark, and then gets mixed in with the others afterward.  And so forth; there's a raw format for this so you can change it if you like.[http://www.bay12forums.com/smf/index.php?topic=169696.msg8403423#msg8403423]
+
According to [[Toady One|Tarn]], there are different settings for every track. One depends on the caverns being opened, one plays only after the second year, one is a first year track.  Strike the Earth plays when you first embark, and then gets mixed in with the others afterward.  And so forth; there's a raw format for this so you can change it if you like.[http://www.bay12forums.com/smf/index.php?topic=169696.msg8403423#msg8403423]
  
 
Game Audio settings can be adjusted in the [[Settings#Audio|settings]] menu.  
 
Game Audio settings can be adjusted in the [[Settings#Audio|settings]] menu.  
Line 10: Line 10:
 
{{main|modding}}
 
{{main|modding}}
  
All sound and [[Soundtrack|music]] files used by ''Dwarf Fortress'' are stored in the [https://en.wikipedia.org/wiki/Ogg .ogg] format within the <code>[[Game folder|<Dwarf Fortress>]]/data/sound/</code> subfolders. You can replace the existing ogg files with different ones. That has to be performed manually and isn't actually supported by the game. You can also change some of the definitions of when certain musical cues are played, using available music tokens and sound tokens in the [[raw file]]s found in <code>[[Game folder|<Dwarf Fortress>]]\data\vanilla\vanilla_music\</code>. However, you can't add new music or sounds other than replacing what's already there.
+
All sound and [[Soundtrack|music]] files used by ''Dwarf Fortress'' are stored in the [https://en.wikipedia.org/wiki/Ogg .ogg] format within the <code>[[Game folder|<Dwarf Fortress>]]/data/sound/</code> subfolders. You can replace the existing ogg files with different ones. That has to be performed manually and isn't actually supported by the game. You can also change some of the definitions of when certain musical cues are played, using available music tokens and sound tokens in the [[raw file]]s found in <code>[[Game folder|<Dwarf Fortress>]]\data\vanilla\vanilla_music\</code>. You can add new music and sounds with raws in the sound folder{{version|0.50.09}}, formatted like so:
  
;Sound effects
+
==Identifiers==
  
All vanilla sound tokens are found within <code>sound_standard.txt</code>. All sound files must begin with the file name{{verify}}, followed by the <code>[OBJECT:SOUND]</code> token that tells the game that the file contains sound definitions.
+
To allow the game to read audio files consistently, they must be given an identifier. Identifiers can be any arbitrary string, just like any other raw object.
 +
 
 +
Identifier files are stored in a mod's <code>sound/</code> directory (not the <code>objects/</code> directory, where the logic for playing them is stored), and their name must start with <code>sound_file_</code> or <code>music_file_</code>.
 +
 
 +
Their first line must be the filename, followed by <code> [OBJECT:SOUND_FILE]</code> or <code>[OBJECT:MUSIC_FILE]</code> respectively.
 +
 
 +
sound_file_example
 +
[OBJECT:SOUND_FILE]
 +
[SOUND_FILE:<identifier>]
 +
    [FILE:file name]
 +
 
 +
music_file_example
 +
[OBJECT:MUSIC_FILE]
 +
[MUSIC_FILE:<identifier>]
 +
    [FILE:file name]
 +
    [AUTHOR:author name]
 +
    [LOOPS] optional
 +
    [TITLE:piece title]
 +
 
 +
{| {{prettytable}}
 +
|- bgcolor="#dddddd"
 +
!Token
 +
!Arguments
 +
!Extra Information
 +
|-
 +
| {{text anchor|FILE}}
 +
|
 +
* path to audio
 +
| (Required) Usually stored as <code>sound/...ogg</code>.
 +
|-
 +
| {{text anchor|AUTHOR}}
 +
|
 +
* string
 +
| (Music only) Displays as the song author on pause menu.
 +
|-
 +
| {{text anchor|LOOPS}}
 +
|
 +
| (Music only) If set, should play continuously until interrupted.{{verify}}
 +
|-
 +
| {{text anchor|TITLE}}
 +
|
 +
* string
 +
| (Music only) Displays as track title on pause menu.
 +
|}
 +
 
 +
==Sound effects==
 +
 
 +
All vanilla sound tokens are found within <code>objects/sound_standard.txt</code>. All sound definition raws must begin with <code>sound_</code>, followed by the <code>[OBJECT:SOUND]</code> token that tells the game that the file contains sound definitions.
  
 
  [SOUND:<identifier>]
 
  [SOUND:<identifier>]
     [FILE:<???>]
+
     [FILE:<[[Audio#Identifiers|file identifier]]>]
 
     [ANNOUNCEMENT:<announcement>]
 
     [ANNOUNCEMENT:<announcement>]
 
     ...
 
     ...
 
     [ANNOUNCEMENT:<announcement n>]
 
     [ANNOUNCEMENT:<announcement n>]
  
* identifiers seem to correlate with the file name <code>data\sound\sounds</code>
+
{| {{prettytable}}
* [[announcement]]s trigger condition, can use more than one announcement in the list.
+
|- bgcolor="#dddddd"
 +
!Token
 +
!Arguments
 +
!Extra Information
 +
|-
 +
| {{text anchor|FILE}}
 +
|
 +
* [[Audio#Identifiers|sound file]]
 +
| (Required) [[Audio#Identifiers|File identifiers]] can be any of various hardcoded sounds (all present in the vanilla raws) or custom [SOUND_FILE] objects.
 +
|-
 +
| {{text anchor|ANNOUNCEMENT}}
 +
|
 +
* [[Announcements.txt|announcement(s)]]
 +
| Trigger condition, can use more than one announcement in the list.
 +
|-
 +
| {{text anchor|SAVAGE_AREA}}
 +
|
 +
| Played randomly in a [[Surroundings#Savage|savage]] area.
 +
|}
  
; Music tracks  
+
==Music tracks==
All vanilla music tokens are found within <code>music_standard.txt</code>. All music files must begin with the file name{{verify}}, followed by the <code>[OBJECT:MUSIC]</code> token that tells the game that the file contains music definitions.
+
All vanilla music tokens are found within <code>objects/music_standard.txt</code>. All music logic raws must begin with <code>music_</code>, followed by the <code>[OBJECT:MUSIC]</code> token that tells the game that the file contains music definitions.
  
 
  [MUSIC:TRACK_02]
 
  [MUSIC:TRACK_02]
Line 38: Line 103:
 
  [FREQUENCY:UNCOMMON]
 
  [FREQUENCY:UNCOMMON]
  
* Event/Context - These are the triggers for the music
+
{| {{prettytable}}
* Frequency (optional) can be set to 'UNCOMMON' to set the frequency half as often as the other candidates
+
|- bgcolor="#dddddd"
 +
!Token
 +
!Arguments
 +
!Extra Information
 +
|-
 +
| {{text anchor|FILE}}
 +
|
 +
* [[Audio#Identifiers|music file]]
 +
| (Required) Can be any of the many hardcoded [[Audio#Identifiers|files]] for the [[soundtrack]], or it can be a custom [MUSIC_FILE] object.
 +
|-
 +
| {{text anchor|CARD}}
 +
|
 +
* [[Audio#Identifiers|music file(s)]]
 +
| Mostly unexplored, listed as a "shuffled deck of short bits." Appears to be played only if no song is currently playing? Before the song proper starts, the game will play a few of these in random order.
 +
|-
 +
| {{text anchor|CONTEXT}}
 +
| [[Audio#Contexts|context(s)]]
 +
| This song can randomly play if any of the contexts are met.
 +
|-
 +
| {{text anchor|EVENT}}
 +
| [[Audio#Events|event(s)]]
 +
| When the chosen event occurs, this song automatically plays and overrides the current song. If multiple songs match the event, a random song will be played from among them.
 +
|-
 +
| {{text anchor|FREQUENCY}}
 +
|
 +
* UNCOMMON or RARE
 +
| Can be set to 'UNCOMMON' to set the frequency half as often as the other candidates or 'RARE' to make it 1/5 as often as other candidates.
 +
|}
  
Known possible events:
+
; Contexts
[EVENT:JUST_EMBARKED]
+
{| {{prettytable}}
[EVENT:SIEGE]
+
|- bgcolor="#dddddd"
[EVENT:FIRST_CAVERN_OPENED]
+
!Token
[EVENT:MEGABEAST_ATTACK]
+
!Extra Information
[EVENT:FORGOTTEN_BEAST_ATTACK]
+
|-
[EVENT:DEATH_SPIRAL]
+
| {{text anchor|ANY}}
[EVENT:TAVERN_MUSIC_PRESENT]
+
| Can play at any time, including in menus.
[EVENT:TAVERN_DANCE_PRESENT]
+
|-
[EVENT:LOST_FORT]
+
| {{text anchor|MAIN}}
 +
| The gamemode is [[Fortress Mode]].
 +
|-
 +
| {{text anchor|FIRST_YEAR}}
 +
| You are controlling a fortress that is less than one year old.
 +
|-
 +
| {{text anchor|SECOND_YEAR_PLUS}}
 +
| Your fortress has been around for more than one year.
 +
|-
 +
| {{text anchor|CAVERNS_OPENED}}
 +
| Your fortress has access to the [[cavern]]s.
 +
|-
 +
| {{text anchor|SPRING}}
 +
| The current season is [[spring]]. Appears to also be played in Legends mode and the main menu.
 +
|-
 +
| {{text anchor|SUMMER}}
 +
| The current season is [[summer]]. Appears to also be played in Legends mode and the main menu.
 +
|-
 +
| {{text anchor|AUTUMN}}
 +
| The current season is [[autumn]]. Appears to also be played in Legends mode and the main menu.
 +
|-
 +
| {{text anchor|WINTER}}
 +
| The current season is [[winter]].
 +
|}
  
Known possible context :
+
; Events
[CONTEXT:ANY]
+
{| {{prettytable}}
[CONTEXT:MAIN]
+
|- bgcolor="#dddddd"
[CONTEXT:FIRST_YEAR]
+
!Token
[CONTEXT:SECOND_YEAR_PLUS]
+
!Extra Information
[CONTEXT:CAVERNS_OPENED]
+
|-
[CONTEXT:WINTER]
+
| {{text anchor|JUST_EMBARKED}}
 +
| Plays when [[embark|founding]] a new fortress.
 +
|-
 +
| {{text anchor|SIEGE}}
 +
| A [[siege]] is announced.
 +
|-
 +
| {{text anchor|FIRST_CAVERN_OPENED}}
 +
| A new cave layer is discovered {{verify}}
 +
|-
 +
| {{text anchor|MEGABEAST_ATTACK}}
 +
| Plays when a [[megabeast]]'s arrival is announced. It is unknown if it is also relevant for [[Semi-megabeast|semi-megabeasts]] or [[Titan|titans]].
 +
|-
 +
| {{text anchor|FORGOTTEN_BEAST_ATTACK}}
 +
| Plays when a [[forgotten beast]]'s arrival is announced.
 +
|-
 +
| {{text anchor|DEATH_SPIRAL}}
 +
| Many citizen deaths have occurred in short succession.
 +
|-
 +
| {{text anchor|TAVERN_MUSIC_PRESENT}}
 +
| Many units have gathered to perform or watch a [[Performer#Music|musical form]].
 +
|-
 +
| {{text anchor|TAVERN_DANCE_PRESENT}}
 +
| Many units have gathered to perform or watch a [[Performer#Dance|dance]].
 +
|-
 +
| {{text anchor|LOST_FORT}}
 +
| Ending a game: a fortress has just been [[Reclaim fortress mode|abandoned or retired]] or your [[adventurer]] has died.
 +
|}
  
 
== See Also==  
 
== See Also==  
Line 64: Line 205:
 
* [https://www.youtube.com/watch?v=mJyMhgadpcQ ambiences and music snippets]
 
* [https://www.youtube.com/watch?v=mJyMhgadpcQ ambiences and music snippets]
 
* [[Soundsense]]
 
* [[Soundsense]]
 +
* [https://github.com/Putnam3145/dwarf-fortress-example-sound-mod Example sound mod] by [[User:Putnam3145|Putnam]]
  
 
[[Category:game]]
 
[[Category:game]]

Latest revision as of 15:49, 27 September 2024


Dwarf Fortress contains music tracks which play at various points in game, including the main menu theme. Some types of audio seem to be triggered by events, while others play randomly while certain criteria are met. These seem to include some weather sounds, wild ambience, building sounds, river etc.

According to Tarn, there are different settings for every track. One depends on the caverns being opened, one plays only after the second year, one is a first year track. Strike the Earth plays when you first embark, and then gets mixed in with the others afterward. And so forth; there's a raw format for this so you can change it if you like.[1]

Game Audio settings can be adjusted in the settings menu.

Modding[edit]

Main article: modding

All sound and music files used by Dwarf Fortress are stored in the .ogg format within the <Dwarf Fortress>/data/sound/ subfolders. You can replace the existing ogg files with different ones. That has to be performed manually and isn't actually supported by the game. You can also change some of the definitions of when certain musical cues are played, using available music tokens and sound tokens in the raw files found in <Dwarf Fortress>\data\vanilla\vanilla_music\. You can add new music and sounds with raws in the sound folderv0.50.09, formatted like so:

Identifiers[edit]

To allow the game to read audio files consistently, they must be given an identifier. Identifiers can be any arbitrary string, just like any other raw object.

Identifier files are stored in a mod's sound/ directory (not the objects/ directory, where the logic for playing them is stored), and their name must start with sound_file_ or music_file_.

Their first line must be the filename, followed by [OBJECT:SOUND_FILE] or [OBJECT:MUSIC_FILE] respectively.

sound_file_example
[OBJECT:SOUND_FILE]
[SOUND_FILE:<identifier>]
    [FILE:file name]
music_file_example
[OBJECT:MUSIC_FILE]
[MUSIC_FILE:<identifier>]
    [FILE:file name]
    [AUTHOR:author name]
    [LOOPS] optional
    [TITLE:piece title]
Token Arguments Extra Information
FILE
  • path to audio
(Required) Usually stored as sound/...ogg.
AUTHOR
  • string
(Music only) Displays as the song author on pause menu.
LOOPS (Music only) If set, should play continuously until interrupted.[Verify]
TITLE
  • string
(Music only) Displays as track title on pause menu.

Sound effects[edit]

All vanilla sound tokens are found within objects/sound_standard.txt. All sound definition raws must begin with sound_, followed by the [OBJECT:SOUND] token that tells the game that the file contains sound definitions.

[SOUND:<identifier>]
    [FILE:<file identifier>]
    [ANNOUNCEMENT:<announcement>]
    ...
    [ANNOUNCEMENT:<announcement n>]
Token Arguments Extra Information
FILE (Required) File identifiers can be any of various hardcoded sounds (all present in the vanilla raws) or custom [SOUND_FILE] objects.
ANNOUNCEMENT Trigger condition, can use more than one announcement in the list.
SAVAGE_AREA Played randomly in a savage area.

Music tracks[edit]

All vanilla music tokens are found within objects/music_standard.txt. All music logic raws must begin with music_, followed by the [OBJECT:MUSIC] token that tells the game that the file contains music definitions.

[MUSIC:TRACK_02]
	[FILE:EXPANSIVE_CAVERN]
		[CARD:EXPANSIVE_CAVERN_CARD_1] for the shuffled deck of short bits
		[CARD:EXPANSIVE_CAVERN_CARD_2]
		[CARD:EXPANSIVE_CAVERN_CARD_3]
		[CARD:EXPANSIVE_CAVERN_CARD_4]
	[EVENT:FIRST_CAVERN_OPENED]
	[CONTEXT:CAVERNS_OPENED]
	[FREQUENCY:UNCOMMON]
Token Arguments Extra Information
FILE (Required) Can be any of the many hardcoded files for the soundtrack, or it can be a custom [MUSIC_FILE] object.
CARD Mostly unexplored, listed as a "shuffled deck of short bits." Appears to be played only if no song is currently playing? Before the song proper starts, the game will play a few of these in random order.
CONTEXT context(s) This song can randomly play if any of the contexts are met.
EVENT event(s) When the chosen event occurs, this song automatically plays and overrides the current song. If multiple songs match the event, a random song will be played from among them.
FREQUENCY
  • UNCOMMON or RARE
Can be set to 'UNCOMMON' to set the frequency half as often as the other candidates or 'RARE' to make it 1/5 as often as other candidates.
Contexts
Token Extra Information
ANY Can play at any time, including in menus.
MAIN The gamemode is Fortress Mode.
FIRST_YEAR You are controlling a fortress that is less than one year old.
SECOND_YEAR_PLUS Your fortress has been around for more than one year.
CAVERNS_OPENED Your fortress has access to the caverns.
SPRING The current season is spring. Appears to also be played in Legends mode and the main menu.
SUMMER The current season is summer. Appears to also be played in Legends mode and the main menu.
AUTUMN The current season is autumn. Appears to also be played in Legends mode and the main menu.
WINTER The current season is winter.
Events
Token Extra Information
JUST_EMBARKED Plays when founding a new fortress.
SIEGE A siege is announced.
FIRST_CAVERN_OPENED A new cave layer is discovered[Verify]
MEGABEAST_ATTACK Plays when a megabeast's arrival is announced. It is unknown if it is also relevant for semi-megabeasts or titans.
FORGOTTEN_BEAST_ATTACK Plays when a forgotten beast's arrival is announced.
DEATH_SPIRAL Many citizen deaths have occurred in short succession.
TAVERN_MUSIC_PRESENT Many units have gathered to perform or watch a musical form.
TAVERN_DANCE_PRESENT Many units have gathered to perform or watch a dance.
LOST_FORT Ending a game: a fortress has just been abandoned or retired or your adventurer has died.

See Also[edit]