Difference between revisions of "Sound"
DeamonHunter (Talk | contribs) (Created page with "Category:Modding") |
DeamonHunter (Talk | contribs) (Adding content to page.) |
||
Line 1: | Line 1: | ||
[[Category:Modding]] | [[Category:Modding]] | ||
+ | In Staxel, '''<tt>*.sound</tt>''' files are collections of sounds that the game will use depending on it's condition. These files include everything from UI sounds, to the sounds while stepping on blocks to the ambience and music. | ||
+ | |||
+ | There can be three type of music files used with Staxel. | ||
+ | * '''<tt>*.wav</tt>''' - Used for all sound effects. This includes tools, UI etc. | ||
+ | * '''<tt>*.wav.csr</tt>''' - Used to compress '''<tt>*.wav</tt>''' files on disc. The game will decompress them on load. | ||
+ | * '''<tt>*.ogg</tt>''' - Used purely for ambience and music. | ||
+ | |||
+ | As a note, these files will not play by themselves, some other component, such as a tile, needs to play these sounds. | ||
+ | |||
+ | |||
+ | = Adding New Sounds To Staxel = | ||
+ | Staxel also allows you to add new sounds to staxel. The process for doing so is actually quite simple and as long as you know how to get the sounds, the rest shall follow easily. | ||
+ | |||
+ | Before beginning make sure to follow [[#Setting up for Mod Creation]]. There are however two things that you will probably need before getting started however. | ||
+ | |||
+ | First, you need to have an object already made so that you can test the sound. Follow [[#Creating a In-game object]] to create one. Anything will do. | ||
+ | |||
+ | Second, you need to have some sound files already made. As a note, the game only allows '''<tt>*.wav</tt>''' files to be played as sounds. If your sounds are not in this format then you can use [http://www.audacityteam.org/download/ Audacity] and export them to '''<tt>*.wav</tt>''' files. | ||
+ | |||
+ | Once this is done, move the object and the sound files to a new mod folder. Then create a file with an ending of '''<tt>.sound</tt>''', and place the following into it. | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "code" : "mods.modname.modsoundname", | ||
+ | "sounds" : [ | ||
+ | { | ||
+ | "file" : "mods/modname/modsoundname1", | ||
+ | "volume" : 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "file" : "mods/modname/modsoundname2", | ||
+ | "volume" : 0.4 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | You can replace the temporary names with whatever will work for your mod. '''Do not add .wav to the end of the file. The game automatically adds this.''' Now in this example it shows 2 sound files added. You can add any number of sounds from 1 to some large number, and the game will just randomly select a sound from the list. If you only have one sound, then remove the content between the '''<tt>{ }</tt>''' and remove the preceding comma. | ||
+ | |||
+ | Congrats you have created your sound. Now to get an object to play it, add the following line to the object's '''<tt>*.tile</tt>''' file. | ||
+ | |||
+ | <pre> | ||
+ | "stepSoundGroup" : "mods.modname.modsoundname" | ||
+ | </pre> | ||
+ | |||
+ | Once this line is added in, head to <code>gamedata/bin/</code> and start up '''<code>Staxel.ContentBuilder.exe</code>'''. When this has started up, click '''<tt>Validate Resources</tt>''' and wait until the progress bar has done. Now you can load up and hear your sound whenever you walk over your object. | ||
+ | |||
+ | = Compressing Sounds = | ||
+ | Staxel also has the option to compress these files to save space but not lose quality. Before doing this, you will want to make sure you have a backup of the sound file, as it will be overwritten. You can compress your file by simply heading to <code>gamedata/bin/</code> and start up '''<code>Staxel.ContentBuilder.exe</code>'''. When this has started up, click '''<tt>Compress .wav assests</tt>''', wait a moment and then click '''<tt>Validate Resources</tt>''' and wait until the progress bar has done. Now all the sound assests you added are compressed and will still run in staxel. | ||
+ | |||
+ | = Config Options = | ||
+ | == "__inherit" == | ||
+ | '''Valid options (String): <code>Any path pointing to any text file (*.config recommended). Starting at, but not including, the "content" folder</code>''' | ||
+ | |||
+ | This option specifies a file, in which the game will import alongside the file you are creating. The game will then use the information in the inherited file and place the information in the current file over it. As in, any values that are in the file that is inheriting file will override any values in the inherited file. The main point of this option is to bring files with duplicated info into one file, thus reducing space used by files and also the ability to change one file and affect all items inheriting that file. | ||
+ | |||
+ | For example: If you have a '''*.config''' file that includes; | ||
+ | <pre>{ | ||
+ | "code" : "mods.testsound", | ||
+ | "sounds" : [ | ||
+ | { | ||
+ | "file" : "mods/modname/modsoundname1", | ||
+ | "volume" : 0.4 | ||
+ | } | ||
+ | ] | ||
+ | }</pre> | ||
+ | |||
+ | And then have the line <code> "_inherit" : "FilePathHere/file.config"</code> in your file, it will automatically pull any data from the inherited file, but then replace values in that file with the values above. | ||
+ | |||
+ | == "code" == | ||
+ | '''Valid options (String): <code>Any valid string. Common to make the string the path to the model but with periods [.] replacing slashes [/] </code>''' | ||
+ | |||
+ | This option is required to uniquely identify any object or resource. This path '''must''' be unique to all other codes, but does not have any other requirements. | ||
+ | |||
+ | For example: Having the code <code> "mods.testsound.soundgroup1"</code> creates an object that has the handle "mods.testsound.soundgroup1" | ||
+ | |||
+ | == "sound" == |
Revision as of 02:06, 10 February 2017
In Staxel, *.sound files are collections of sounds that the game will use depending on it's condition. These files include everything from UI sounds, to the sounds while stepping on blocks to the ambience and music.
There can be three type of music files used with Staxel.
- *.wav - Used for all sound effects. This includes tools, UI etc.
- *.wav.csr - Used to compress *.wav files on disc. The game will decompress them on load.
- *.ogg - Used purely for ambience and music.
As a note, these files will not play by themselves, some other component, such as a tile, needs to play these sounds.
Contents
Adding New Sounds To Staxel
Staxel also allows you to add new sounds to staxel. The process for doing so is actually quite simple and as long as you know how to get the sounds, the rest shall follow easily.
Before beginning make sure to follow #Setting up for Mod Creation. There are however two things that you will probably need before getting started however.
First, you need to have an object already made so that you can test the sound. Follow #Creating a In-game object to create one. Anything will do.
Second, you need to have some sound files already made. As a note, the game only allows *.wav files to be played as sounds. If your sounds are not in this format then you can use Audacity and export them to *.wav files.
Once this is done, move the object and the sound files to a new mod folder. Then create a file with an ending of .sound, and place the following into it.
{ "code" : "mods.modname.modsoundname", "sounds" : [ { "file" : "mods/modname/modsoundname1", "volume" : 0.4 }, { "file" : "mods/modname/modsoundname2", "volume" : 0.4 } ] }
You can replace the temporary names with whatever will work for your mod. Do not add .wav to the end of the file. The game automatically adds this. Now in this example it shows 2 sound files added. You can add any number of sounds from 1 to some large number, and the game will just randomly select a sound from the list. If you only have one sound, then remove the content between the { } and remove the preceding comma.
Congrats you have created your sound. Now to get an object to play it, add the following line to the object's *.tile file.
"stepSoundGroup" : "mods.modname.modsoundname"
Once this line is added in, head to gamedata/bin/
and start up Staxel.ContentBuilder.exe
. When this has started up, click Validate Resources and wait until the progress bar has done. Now you can load up and hear your sound whenever you walk over your object.
Compressing Sounds
Staxel also has the option to compress these files to save space but not lose quality. Before doing this, you will want to make sure you have a backup of the sound file, as it will be overwritten. You can compress your file by simply heading to gamedata/bin/
and start up Staxel.ContentBuilder.exe
. When this has started up, click Compress .wav assests, wait a moment and then click Validate Resources and wait until the progress bar has done. Now all the sound assests you added are compressed and will still run in staxel.
Config Options
"__inherit"
Valid options (String): Any path pointing to any text file (*.config recommended). Starting at, but not including, the "content" folder
This option specifies a file, in which the game will import alongside the file you are creating. The game will then use the information in the inherited file and place the information in the current file over it. As in, any values that are in the file that is inheriting file will override any values in the inherited file. The main point of this option is to bring files with duplicated info into one file, thus reducing space used by files and also the ability to change one file and affect all items inheriting that file.
For example: If you have a *.config file that includes;
{ "code" : "mods.testsound", "sounds" : [ { "file" : "mods/modname/modsoundname1", "volume" : 0.4 } ] }
And then have the line "_inherit" : "FilePathHere/file.config"
in your file, it will automatically pull any data from the inherited file, but then replace values in that file with the values above.
"code"
Valid options (String): Any valid string. Common to make the string the path to the model but with periods [.] replacing slashes [/]
This option is required to uniquely identify any object or resource. This path must be unique to all other codes, but does not have any other requirements.
For example: Having the code "mods.testsound.soundgroup1"
creates an object that has the handle "mods.testsound.soundgroup1"