-
Notifications
You must be signed in to change notification settings - Fork 14
Music and Sound
There are two types of audio that can be used. One is NSF, the native NES sound format. The other is with audio files like WAV. This page describes how to specify music or sound effects to be played.
##Music
Music tags are used to say that a particular track should begin playing. For example, you use them in the top level of a Stage Select or stage, and in keyframes for cutscenes.
###NSF
If you are using NSF, you should have defined the location of your .NSF files somewhere in your main project file. The tag for NSF music is simple.
<Music nsftrack="14" />
This says that track 14 of the NSF file should be used. It should be obvious that the nsftrack attribute is required.
###WAV
In order to support an intro section and a loop section in non-NSF audio, the tag is more complex.
<Music>
<Intro>music\Sparkman-intro.wav</Intro>
<Loop>music\Sparkman-loop.wav</Loop>
</Music>
The file specified inside the Intro tag will be played once, and immediately followed by the file in the Loop tag, which repeats infinitely. Making the transition and loop sound clean is your responsibility.
##Sound Effects
Sound effects are defined in their own file and referenced by name throughout the project.
###Definitions
Sounds must be contained within a single Sounds
tag. Because there can only be one root-level tag per file, this means that the definitions must be in their own file. You'll need to use an Include tag in your main project file for it.
####NSF
<Sounds>
<Sound name="Life" track="37" priority="1" />
<Sound name="MeterTick" track="39" priority="2" loop="true" />
<Sound name="MMDeath" track="30" priority="3" />
<Sound name="pause" track="42" priority="4"/>
</Sounds>
Attribute | Required? | Type | Description |
---|---|---|---|
name | Required | String | You will use this name to refer to the sound elsewhere in the project. |
track | Required | Integer | The track in the NSF file for this sound. |
priority | Optional | Integer | Higher priority sounds (those with **lower** values) will override others for playback. Defaults to 100. |
loop | Optional | Boolean | Whether to loop this sound effect. Defaults to false. |
####WAV
The definitions for non-NSF sounds are almost identical to the above, with two exceptions.
- Replace the "path" attribute with "track" - it's value should be the relative path to the sound file.
- Priority isn't used, the attribute will be ignored.
##Usage
Calling a sound takes one short tag.
<Sound name="EnemyHurt" />
That is all.