Music modding

本頁面講述的內容長期有效


Creating a mod that adds music to Stellaris is rather easy. Following this guide, you'll create a mod that is essentially a modular music pack. That is to say, if you create a music pack as described in this guide, then create another, a user could download either or both from the Steam Workshop, install them both concurrently and have all the music that was included in both mods.

Essentially, one music pack does not override the other - you can install multiple over top of one another and so build a whole library of music to listen to in-game.

Getting Started[編輯 | 編輯原始碼]

Let's take a look at the required folder structure and files. These are the contents of the base game's music folder:

Stellaris/music/[編輯 | 編輯原始碼]

Folder/File Summary
*.ogg A music file.
songs.asset Controls the assignment of music to a code name, and sets the volume of playback.
songs.txt List of the code names mentioned in songs.asset.

We will use this same structure in our mod in order to add foreign music files to the game.

Setting Up[編輯 | 編輯原始碼]

First of all, follow the step-by-step modding guide to create the folder structure for your mod and enter all the relevant data in the newly created "YOUR-MOD-NAME-HERE.mod" file.

Once you've done that initial set up, it's time to create the folder structure for your music pack mod.

In quick overview, your created mod's folder will by the end of this guide contain this:

  • a "descriptor.mod" file;
  • a "music" folder containing:
 * music files in .OGG format;
 * a "YOUR-MUSIC-PACK.asset" file;
 * a "YOUR-MUSIC-PACK.txt" file.
  • and finally a "YOUR-MOD-THUMBNAIL.jpg" image for the Steam Workshop.

Mod structure[編輯 | 編輯原始碼]

So create a folder inside your music pack mod's main folder and call it "music". Add to this folder two files:

  • a "YOUR-MUSIC-PACK.asset" file;
  • a "YOUR-MUSIC-PACK.txt" file.

Call them whatever you like.

However, you generally should not call it "songs.asset" and "songs.txt", because this is the name that Stellaris uses for its own files and doing so might overwrite the base game's settings and songlist.

In order to ensure that no other music packs will overwrite your own songlists, call it something unique like I did for my "shrooblord-musicpack.asset".

Next, put music files in Ogg Vorbis format (.OGG) in this same "music" folder. If you have music files in a different file format, convert them to Ogg Vorbis (44.1 kHz) first. A tool you could use for this is Audacity, which is free.

That's all for the main structure of the mod! Now, let's edit those ".asset" and ".txt" files so that Stellaris actually loads our music pack into the game.

Creating the List of Songs[編輯 | 編輯原始碼]

To know which file names should be displayed as what song title in-game, Stellaris uses the syntax described below. Follow this same syntax and your music will show up in-game and be automatically played by the music player!

songlist.asset[編輯 | 編輯原始碼]

First, let's build the ".asset" file; we'll call it "songlist.asset" for sake of simplicity.

So say I have placed in my "music" folder two songs I want to add to the game. One is called "LemonDemon-DinosaurchestraPartOne.ogg" and the other is "FoolsGarden-LemonTree.ogg". To get them to show up in-game, I have to put the following in the "songlist.asset" file:

songlist.asset

music = {
 	name = "Dinosaurchestra - Part One"
 	file = "LemonDemon-DinosaurchestraPartOne.ogg"
 	volume = 0.50
}

music = {
 	name = "Lemon Tree"
 	file = "FoolsGarden-LemonTree.ogg"
 	volume = 0.50
}

What are these entries? The first variable "name" is the name that will show up in the Music Player*. The "file" variable is the exact filename of the song as it appears in the "music" folder that's in the mod's main folder you created for this music pack mod. "volume" is a relative volume for the music to play at. With it you can normalize volume for your tracks and avoid one getting louder than another. 0.5 is a standard value for it.

  • If the music file got a name in his metadate, it's is this name that'll show up in the Music Player. If two song got the same name in metadata, only the first one will appear in game.

songlist.txt[編輯 | 編輯原始碼]

Next, we write the following to the "songlist.txt" file: songlist.txt

song = {
   name = "Dinosaurchestra - Part One"
}

song = {
   name = "Lemon Tree"
}

These are simply the same "name" variables as described in the "songlist.asset" file.

In the references I've seen, the order of the songs in both the "songlist.asset" and "songlist.txt" files are identical; I'm not sure if this is crucial, but it's probably best to follow that example.

Tools & utilities[編輯 | 編輯原始碼]

  • Audacity - Powerful, well-documented and free audio processing program that allows you to, for example, convert between music file types.
  • dir2ogg - For Linux users, a very easy command line tool for converting mp3, m4a, wma, and wav files in bulk into the ogg-vorbis format.
  • soundconverter - Also for Linux users, Soundconverter is a no Terminal based bulk converter for the most common formats into the Stellaris needed ones.

See also[編輯 | 編輯原始碼]

References[編輯 | 編輯原始碼]


帝國 帝國思潮政府 • 國民理念 • 起源承諾議程傳統 • 飛升天賦法令政策遺珍科技自定義帝國
人口 崗位派系
領袖 領袖領袖特質
物種 物種物種特質
行星 行星行星特徵 • 軌道礦藏建築 • 區劃行星決議
星系 星系恆星基地巨型結構蟲洞 • 星門地圖
艦隊 艦隊艦船 • 部件
地面戰 陸軍轟炸姿態
外交 外交 • 聯邦 • 星海共同體評價修正宣戰理由 • 戰爭目標
事件 事件異常現象特殊項目考古遺址
遊玩 遊玩定義研究 • 經濟遊戲開局
動態修改 動態指令效果觸發條件作用域修正變量AI
媒體/本地化 Maya 導出器圖形肖像旗幟事件圖片界面圖標音樂本地化
Other 控制台命令存檔編輯Steam 創意工坊模組製作教程