XML:SNDD: Difference between revisions
m (correcting prev/next types in nav header) |
m (copy-edit) |
||
Line 2: | Line 2: | ||
{{finish}} | {{finish}} | ||
{| border=0 cellspacing=20 cellpadding=0 style="margin-left:auto; margin-right:auto" | {| border=0 cellspacing=20 cellpadding=0 style="margin-left:auto; margin-right:auto" | ||
| More OSBD .grp / .amb information could be useful and .imp is completely left out so far. | | Needed: More OSBD .grp / .amb information could be useful, and .imp is completely left out so far. | ||
|} | |} | ||
{{TOClimit|2}} | |||
==General information== | |||
*The XML on this page is based on OniSplit '''v0.9.61.0'''. | |||
*In order to make your sounds work on both Windows and Mac, you need to create them twice (one time from a WAV source and another time from an AIFF source). | |||
==Source file creation== | ==Source file creation== | ||
Line 57: | Line 53: | ||
Note the double ".aif" suffix applied to the outputted files. If you are replacing existing Oni sounds, this is necessary due to Oni's sound resources possessing a ".aif" suffix as part of their <u>actual resource names</u> (yes, even the WAV-encoded sounds in Windows Oni). So if you import them with a name like "SNDDgears.aif", the file suffix gets changed to ".oni" upon import by OniSplit, and you end up with a resource simply titled "SNDDgears" in-game. Oni will be looking for a sound titled "SNDDgears.aif", and won't find it. Hence, we title the AIFF file "SNDDgears.aif.aif" so that OniSplit yields "SNDDgears.aif.oni" upon importing, which in turn produces the resource named "SNDDgears.aif" that Oni desires. | Note the double ".aif" suffix applied to the outputted files. If you are replacing existing Oni sounds, this is necessary due to Oni's sound resources possessing a ".aif" suffix as part of their <u>actual resource names</u> (yes, even the WAV-encoded sounds in Windows Oni). So if you import them with a name like "SNDDgears.aif", the file suffix gets changed to ".oni" upon import by OniSplit, and you end up with a resource simply titled "SNDDgears" in-game. Oni will be looking for a sound titled "SNDDgears.aif", and won't find it. Hence, we title the AIFF file "SNDDgears.aif.aif" so that OniSplit yields "SNDDgears.aif.oni" upon importing, which in turn produces the resource named "SNDDgears.aif" that Oni desires. | ||
If you're using Windows, you may find | If you're using Windows, you may find that your newly-converted '''ima4''' AIFF files will not play. This does not mean the files themselves are broken — they will actually play on Macs, but not in Windows, despite having been created in Windows. The reason for this remains to be investigated. | ||
==Oni file creation== | ==Oni file creation== | ||
=== | ===Via Vago=== | ||
Installation: | Installation: | ||
* Oni/AE/[[Anniversary_Edition/Installer#Tools|AEInstaller2.exe > Tools > Manage Tools]] | * Oni/AE/[[Anniversary_Edition/Installer#Tools|AEInstaller2.exe > Tools > Manage Tools]] | ||
Line 68: | Line 64: | ||
* Tools > Sound Wizard | * Tools > Sound Wizard | ||
===Via batch file=== | |||
=== | |||
'''SNDD for Windows''' | '''SNDD for Windows''' | ||
onisplit -create output_PC_files input/*.wav | onisplit -create output_PC_files input/*.wav | ||
Line 82: | Line 77: | ||
pause | pause | ||
===Via command line=== | |||
=== | |||
For those who want to do it on their own. | For those who want to do it on their own. | ||
Line 90: | Line 84: | ||
: -create output_directory_'''PC''' input_directory/'''*.wav''' | : -create output_directory_'''PC''' input_directory/'''*.wav''' | ||
: -create output_directory input_directory/*.xml | : -create output_directory input_directory/*.xml | ||
For fast | For fast XML text changes and naming, give them all ''yourfile'' as the name, if you have only one sound: | ||
: <font color=#AAAAAA>SNDD</font>yourfile<font color=#AAAAAA>.oni</font> | : <font color=#AAAAAA>SNDD</font>yourfile<font color=#AAAAAA>.oni</font> | ||
: <font color=#AAAAAA>OSBD</font>yourfile<font color=#AAAAAA>'''.grp'''.oni</font> | : <font color=#AAAAAA>OSBD</font>yourfile<font color=#AAAAAA>'''.grp'''.oni</font> | ||
: <font color=#AAAAAA>OSBD</font>yourfile<font color=#AAAAAA>'''.amb'''.oni</font> | : <font color=#AAAAAA>OSBD</font>yourfile<font color=#AAAAAA>'''.amb'''.oni</font> | ||
==OSBD information== | ==OSBD information== | ||
OSBD files are stored globally (in level0_Final). | OSBD files are stored globally (in level0_Final). | ||
''' | '''When to use what''' | ||
* OSBD*.'''amb''' | * OSBD*.'''amb''' | ||
Line 120: | Line 113: | ||
''' | '''Details on music''' | ||
: OSBD_newmusic.amb.oni (The main file | : OSBD_newmusic.amb.oni (The main file — links to the group, intro and ending files) | ||
: OSBD_newmusic.grp.oni ( | : OSBD_newmusic.grp.oni (Links to the music files) | ||
: OSBD_newmusic_in.grp.oni (Links to intro part of the music | : OSBD_newmusic_in.grp.oni (Links to intro part of the music — optional) | ||
: OSBD_newmusic_out.grp.oni (Links to the ending of the music | : OSBD_newmusic_out.grp.oni (Links to the ending of the music — optional) | ||
: SNDD_newmusic1.oni (The individual music files | : SNDD_newmusic1.oni (The individual music files; it's best to break up the music into segments of perhaps 30 secs to a minute each — Oni may crash or become sluggish if you use a single file for the music) | ||
Breaking the main loop of the music into parts allows Oni to more smoothly transition to the ending part when necessary; the amount of time that a track will play cannot be predicted, after all, since players will take varying amounts of time to clear that segment of the level. | |||
The parts of the music between intro and outro are played in a randomized order, probably to add more variety to the loop. | |||
grp files have a <Weight> tag under <Permutation>. [[wikipedia:Permutation|Permutation]] should have something to do how music parts get repeated. However, it's not clear what influence <Weight> has on the repetitions. Is it like TRAC's <Weight> used for probability? | Note that .grp files have a <Weight> tag under <Permutation>. "[[wikipedia:Permutation|Permutation]]" should have something to do how music parts get repeated. However, it's not clear what influence <Weight> has on the repetitions. Is it like TRAC's <Weight>, used for probability? | ||
===OSBDfile.imp.xml=== | ===OSBDfile.imp.xml=== | ||
What is an impulse? Looking at the XML it | What is an impulse? Looking at the XML, it has these special features: <Volume><Angle> / <Volume><MinAttenuation> / <ImpactVelocity> / <MinOcclusion>. This is because impulses are the preferred choice for moving sound sources. A few more facts: | ||
*They cannot be stopped by BSL once triggered to play. | |||
*AIs can hear them. | |||
*The minimum and maximum volume angle seem to be always 360 degrees. These properties might be a development artifact, since sound should propagate through space in all directions, and the area of effect is mostly determined by their volume distance. | |||
{| class="wikitable" width=100% | {| class="wikitable" width=100% | ||
|width=120px| ''' | |width=120px| '''Tag''' | ||
|width=100px| ''' | |width=100px| '''Type''' | ||
| ''' | | '''Description''' | ||
|- | |- | ||
| <ImpulseSound> | | <ImpulseSound> | ||
Line 160: | Line 148: | ||
|valign="top"| flag | |valign="top"| flag | ||
| When are these different flags used? | | When are these different flags used? | ||
: Low (default | : Low (default for impacts? (ONIE concrete) + shell (ammunition)?) | ||
: Normal (AI, animation and impact related?) | : Normal (AI, animation and impact related?) | ||
: High (OSBDtrigger_hit.imp.xml only?) | : High (OSBDtrigger_hit.imp.xml only?) | ||
Line 175: | Line 163: | ||
| <Min> | | <Min> | ||
| float | | float | ||
| | | From the sound's origin point out to Min radius (distance), the sound volume is equally strong. | ||
|- | |- | ||
| <Max> | | <Max> | ||
| float | | float | ||
| | | Between Min and Max radius (distance) the sound volume decreases; a greater distance than Max makes the sound inaudible. | ||
|- | |- | ||
| <Angle> | | <Angle> | ||
| - | | - | ||
| | | Spatial angle? Does this work like the <Distance> tag? | ||
|- | |- | ||
| <Min> | | <Min> | ||
Line 213: | Line 201: | ||
| | | | ||
|} | |} | ||
===OSBDfile.amb.xml=== | ===OSBDfile.amb.xml=== | ||
In case you want to create a simple sound file you can basically copy the | In case you want to create a simple sound file, you can basically copy the examples below and change the portions marked in red. | ||
: OSBDfile.grp.xml, OSBDfile.amb.xml, BINACJBOSound.xml are showing the | : OSBDfile.grp.xml, OSBDfile.amb.xml, BINACJBOSound.xml are showing the markup from the [http://mods.oni2.net/node/177 '''Nyan Cat mod''']. | ||
{| class="wikitable" width=100% | {| class="wikitable" width=100% | ||
|width=120px| ''' | |width=120px| '''Tag''' | ||
|width=100px| ''' | |width=100px| '''Type''' | ||
| ''' | | '''Description''' | ||
|- | |- | ||
| <AmbientSound> | | <AmbientSound> | ||
Line 240: | Line 226: | ||
|valign="top"| flag | |valign="top"| flag | ||
| | | | ||
: InterruptTracksOnStop | : InterruptTracksOnStop — this flag must be set if you want to use the BSL command ''sound_music_stop'' | ||
: PlayOnce | : PlayOnce | ||
: CanPan | : CanPan | ||
Line 308: | Line 294: | ||
| | | | ||
|} | |} | ||
An example: | An example: | ||
Line 339: | Line 324: | ||
</AmbientSound> | </AmbientSound> | ||
</Oni> | </Oni> | ||
===OSBDfile.grp.xml=== | ===OSBDfile.grp.xml=== | ||
{| class="wikitable" width=100% | {| class="wikitable" width=100% | ||
|width=120px| ''' | |width=120px| '''Tag''' | ||
|width=100px| ''' | |width=100px| '''Type''' | ||
| ''' | | '''Description''' | ||
|- | |- | ||
| <SoundGroup> | | <SoundGroup> | ||
Line 361: | Line 345: | ||
| <Flags> | | <Flags> | ||
| flag | | flag | ||
| PreventRepeat - | | PreventRepeat - Oni will play different permutations of the sound, if there is more than one permutation | ||
|- | |- | ||
|valign="top"| <NumberOfChannels> | |valign="top"| <NumberOfChannels> | ||
|valign="top"| int32 | |valign="top"| int32 | ||
| Here you tell Oni if your sound file is mono or stereo. | | Here you tell Oni if your sound file is mono or stereo. 44.1 kHz sounds in Windows are an exception. | ||
{|class="wikitable" width="100%" | {|class="wikitable" width="100%" | ||
Line 379: | Line 363: | ||
|} | |} | ||
; | ;Consequences of wrong imports: | ||
: | : If the .grp's <NumberOfChannels> is 1 and the sound file is 22.05 kHz stereo then the sound won't get played | ||
: | : If the .grp's <NumberOfChannels> is 1 and the sound file is 44.1 kHz mono then the sound will play distorted | ||
|- | |- | ||
| <Permutations> | | <Permutations> | ||
| - | | - | ||
| int32 array for the <Permutation> tags | | int32 array for the <Permutation> tags | ||
|- | |- | ||
| <Permutation> | | <Permutation> | ||
Line 424: | Line 408: | ||
| <font color=#AAAAAA>SNDD</font>name<font color=#AAAAAA>.oni</font>, file prefix and suffix aren't used | | <font color=#AAAAAA>SNDD</font>name<font color=#AAAAAA>.oni</font>, file prefix and suffix aren't used | ||
|} | |} | ||
An example: | An example: | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<Oni> | <Oni> | ||
Line 453: | Line 435: | ||
==BINACJBOSound.xml== | ==BINACJBOSound.xml== | ||
This is for area | This is for sounds fixed to a certain area. | ||
{| class="wikitable" width=100% | {| class="wikitable" width=100% | ||
|width=120px| ''' | |width=120px| '''Tag''' | ||
|width=100px| ''' | |width=100px| '''Type''' | ||
| ''' | | '''Description''' | ||
|- | |- | ||
| <Objects> | | <Objects> | ||
Line 467: | Line 448: | ||
| <SNDG Id="..."> | | <SNDG Id="..."> | ||
| integer | | integer | ||
| This tag marks the file as a sound list. ID doesn't matter at import time. | | This tag marks the file as a sound list. The ID doesn't matter at import time. | ||
|- | |- | ||
| <Header> | | <Header> | ||
Line 475: | Line 456: | ||
|valign="top"| <Flags> | |valign="top"| <Flags> | ||
|valign="top"| flag | |valign="top"| flag | ||
| | | You can ignore these flags, as they are defunct: | ||
: None | : None | ||
: Locked | : Locked | ||
Line 484: | Line 465: | ||
| <Position> | | <Position> | ||
| float x3 | | float x3 | ||
| | | Here you tell Oni where you want the sound to be [[OBD_talk:BINA/OBJC|located]]. | ||
|- | |- | ||
| <Rotation> | | <Rotation> | ||
Line 504: | Line 485: | ||
| <MinRadius> | | <MinRadius> | ||
| float | | float | ||
| | | From the point of the sound's origin (<Position>) out to Min radius, the sound volume is equally strong. | ||
|- | |- | ||
| <MaxRadius> | | <MaxRadius> | ||
| float | | float | ||
| | | Between Min and Max radius, the sound volume will decrease; greater distance than Max makes the sound inaudible. | ||
|- | |- | ||
| <Box> | | <Box> | ||
| - | | - | ||
| alternative to <Sphere> | | You can use this alternative to <Sphere> if you want to limit a sound to a specific room. | ||
|- | |- | ||
| <Min> | | <Min> | ||
Line 522: | Line 503: | ||
| X2 Y2 Z2 | | X2 Y2 Z2 | ||
|} | |} | ||
An example: | An example: | ||
<SNDG Id="8805"> | <SNDG Id="8805"> | ||
<Header> | <Header> | ||
Line 543: | Line 522: | ||
</SNDG> | </SNDG> | ||
==Sound-related BSL commands== | |||
* [[BSL:Functions#sound|Commands listed on wiki]] | |||
* [http://ssg.oni2.net/commands.htm#sound Original list on ssg's website] | |||
sound_music_stop ''soundtrack'' — can only be used if .amb file has the InterruptTracksOnStop flag<br> | |||
sound_music_stop ''soundtrack'' 1 — music drops to zero volume over 1 second | |||
You need a custom function if you want to fade out a soundtrack over more than one second. It could look like this: | |||
You need a custom function if you want to fade out a soundtrack over more than one | |||
var float x = 1; | var float x = 1; | ||
var int y = 0; | var int y = 0; | ||
# | # Don't test this function with the console or the function might stop working after 4 cycles | ||
func fade_music | func fade_music | ||
{ | { | ||
# if statement with float values doesn't seem to work therefore the int y | # An 'if' statement with float values doesn't seem to work, therefore the int y | ||
y = y + 1 | y = y + 1 | ||
x = x - .01 | x = x - .01 | ||
Line 576: | Line 553: | ||
} | } | ||
==OCF thread about making new music== | |||
==OCF thread about new music== | |||
See [http://oni.bungie.org/forum/viewtopic.php?id=798 here]. | See [http://oni.bungie.org/forum/viewtopic.php?id=798 here]. | ||
==How to register sounds to characters== | ==How to register sounds to characters== | ||
... such as sounds of heavy attacks and taunts. | ...such as the sounds of heavy attacks and taunts. | ||
'''Let's see how sounds become picked up:'''<br>Schemata: | '''Let's see how sounds become picked up:'''<br>Schemata: | ||
: TRAM -> ONCC -> OSBD.amb -> OSBD.grp -> SNDD | : TRAM -> ONCC -> OSBD.amb -> OSBD.grp -> SNDD | ||
Explanation: | Explanation: | ||
* The character performs a move / attack | * The character performs a move/attack where the TRAM file holds a sound ID (<Vocalization>). | ||
* A link (OSBD.amb name) in ONCC file | * A link (OSBD.amb name) in the ONCC file will be looked up based on the sound ID. Note that the ONCC file has also a probability value that decides whether a sound will be played or not. | ||
* The game engine looks into OSBD.amb and follows the link into OSBD.grp. | * The game engine looks into OSBD.amb and follows the link into OSBD.grp. | ||
* '''OSBD.grp can hold multiple links to SNDD files.''' That's why Konoko can have multiple taunt sounds. | * '''OSBD.grp can hold multiple links to SNDD files.''' That's why Konoko can have multiple taunt sounds. | ||
===Step 1: Preparing the TRAM=== | |||
=== | |||
'''Search for <Vocalization> in the TRAM file''' and give it an ID according to the following table. | '''Search for <Vocalization> in the TRAM file''' and give it an ID according to the following table. | ||
{|class="wikitable" width="100%" | {|class="wikitable" width="100%" | ||
Line 606: | Line 577: | ||
|- | |- | ||
| 0 | | 0 | ||
| <TauntProbability> | | <TauntProbability> — '''taunt(s)''' | ||
|- | |- | ||
| 1 | | 1 | ||
| <AlertProbability> | | <AlertProbability> — AI being surprised by a sound | ||
|- | |- | ||
| 2 | | 2 | ||
| <StartleProbability> | | <StartleProbability> — AI being surprised by an enemy | ||
|- | |- | ||
| 3 | | 3 | ||
| <CheckBodyProbability> | | <CheckBodyProbability> — AI death taunt, played when enemy dies | ||
|- | |- | ||
| 4 | | 4 | ||
| <PursueProbability> | | <PursueProbability> — Play this sound when AI loses track of enemy | ||
|- | |- | ||
| 5 | | 5 | ||
| <CoverProbability> | | <CoverProbability> — Play this sounds when afraid (e.g. "Don't hurt me!") | ||
|- | |- | ||
| 6 | | 6 | ||
| <SuperPunchSound> | | <SuperPunchSound> — '''Sound of ######punch_heavy.oni''', super punches don't have sound IDs | ||
|- | |- | ||
| 7 | | 7 | ||
| <SuperKickSound> | | <SuperKickSound> — '''Sound of ######kick_heavy.oni''', super kicks don't have sound IDs | ||
|- | |- | ||
| 8 | | 8 | ||
| <Super3Sound> | | <Super3Sound> — AI specialty, Mukade use it for his devil star attack (TRAMNINCOMfireball) | ||
|- | |- | ||
| <font color=#777777>9</font> | | <font color=#777777>9</font> | ||
Line 636: | Line 607: | ||
|} | |} | ||
===Step 2: Preparing the ONCC=== | |||
Search for <SoundConstants> and set a value between 0 and 100. 100 means "always play this sound". | |||
Let's look at Konoko's settings, with a focus on her taunt sound. In ONCCkonoko_generic.xml, we see this: | |||
Let's | |||
In ONCCkonoko_generic.xml | |||
<SoundConstants> | <SoundConstants> | ||
Line 666: | Line 635: | ||
</SoundConstants> | </SoundConstants> | ||
===Step 3: Preparing the OSBD.amb=== | |||
=== | |||
Do you see the <BaseTrack1> tag? In this case it holds the link <font color=#AAAAAA>OSBD</font>c17_99_28konoko<font color=#AAAAAA>.grp.oni</font>. | Do you see the <BaseTrack1> tag? In this case it holds the link <font color=#AAAAAA>OSBD</font>c17_99_28konoko<font color=#AAAAAA>.grp.oni</font>. | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Line 701: | Line 666: | ||
</Oni> | </Oni> | ||
===Step 4: Preparing the OSBD.grp=== | |||
=== | |||
Since <NumberOfChannels> is only once presented all the SNDD files must have the same number of channels. | Since <NumberOfChannels> is only once presented all the SNDD files must have the same number of channels. | ||
Line 717: | Line 681: | ||
|} | |} | ||
(It's possible to speed up sounds with <Pitch>, e.g. the Fury's taunt is sped up by 1.14 to ''brighten'' the voice. But in most cases you probably want to keep it as "1".) | |||
(It's possible to speed up sounds with <Pitch> | |||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
Line 757: | Line 720: | ||
</Oni> | </Oni> | ||
As you can see, Konoko has multiple sounds to choose from. | |||
As you can see Konoko | * <font color=#AAAAAA>SNDD</font>c17_99_28konoko.aif<font color=#AAAAAA>.oni</font> ("You're gonna get beat by a girl!") | ||
* <font color=#AAAAAA>SNDD</font>c17_99_28konoko.aif<font color=#AAAAAA>.oni</font> ("You're gonna get beat | * <font color=#AAAAAA>SNDD</font>c17_99_29konoko.aif<font color=#AAAAAA>.oni</font> ("Ready to lose?") (You can play sounds in Simple OniSplit GUI (Windows only). | ||
* <font color=#AAAAAA>SNDD</font>c17_99_29konoko.aif<font color=#AAAAAA>.oni</font> ("Ready to lose?") (You can play sounds | |||
* ''[...]'' | * ''[...]'' | ||
"aif" is here part of the name, | "aif" is here part of the name, as explained in the "Source file creation" section above. | ||
Permutations in .grp files are the reason why Konoko has multiple sounds that can play during the same taunt animation. | |||
=== | ===Step 5: Everything else that's left=== | ||
* [[#Source_file_creation| | * [[#Source_file_creation|Create your SNDD]] if you haven't yet. | ||
* | * Put your files into a mod package. | ||
* | * Test your stuff in-game! | ||
{{XML}} | {{XML}} |
Revision as of 01:48, 28 March 2021
SNDD : Sound Data | ||
---|---|---|
XML
PSUI << Other file types >> StNA |
This page is unfinished. Can you fill in any missing information? |
Needed: More OSBD .grp / .amb information could be useful, and .imp is completely left out so far. |
General information
- The XML on this page is based on OniSplit v0.9.61.0.
- In order to make your sounds work on both Windows and Mac, you need to create them twice (one time from a WAV source and another time from an AIFF source).
Source file creation
In Windows, SNDDs use WAV as their internal data format, but on Macs the AIFF format is used. Here are the details:
Windows | Mac |
---|---|
|
|
To create suitable files for importing into Oni using a GUI program, you could use Audacity and its ffmpeg Export Library. After you've installed Audacity and the ffmpeg library, go to Edit > Preferences... > Libraries, click the Locate... button and find the installed library file. Open your sound file then go to File > Export... > Save As: yourfile.wav; Format: Custom FFmpeg Export; Options... > wav; pcm_s16le; Sample Rate: 22050; OK and save the file (adpcm_ms doesn't work as of Audacity 1.3 Beta).
- Mirror for backup purpose: http://mods.oni2.net/node/384
If you want to convert sounds into the AIFF format for Macs, the major catch with Audacity is that its batch processing feature does not support AIFF exporting even though it's a part of the underlying ffmpeg program that Audacity uses. To convert a large number of sound files, you can install ffmpeg using your package manager of choice (MacPorts, Homebrew, etc.). Building can take a while, but you can also find pre-built ffmpeg binaries around the Web fairly easily. The basic command you want to use is:
ffmpeg -i input.wav -acodec adpcm_ima_qt -ar 22050 output.aif
Note that the order of arguments is critical: the rate and encoding are being applied to the outputted file, whereas if they came before the input file's name they would be instructions on how to read the input sound. Here is a simple shell script for converting a folder of sounds from WAV to the AIFF format suitable for importing:
#!/bin/sh
IFS=" "
IN_DIR="/path/to/SNDD-wav" OUT_DIR="/path/to/SNDD-aif" for WAV in `find $IN_DIR | grep .wav$ ` do FILENAME=$(basename "$WAV") echo "Converting $FILENAME to IMA-compressed AIFF..." ffmpeg -i "$IN_DIR/$FILENAME" -acodec adpcm_ima_qt -ar 22050 "$OUT_DIR/${FILENAME%.wav}$aif.aif" done
Note the double ".aif" suffix applied to the outputted files. If you are replacing existing Oni sounds, this is necessary due to Oni's sound resources possessing a ".aif" suffix as part of their actual resource names (yes, even the WAV-encoded sounds in Windows Oni). So if you import them with a name like "SNDDgears.aif", the file suffix gets changed to ".oni" upon import by OniSplit, and you end up with a resource simply titled "SNDDgears" in-game. Oni will be looking for a sound titled "SNDDgears.aif", and won't find it. Hence, we title the AIFF file "SNDDgears.aif.aif" so that OniSplit yields "SNDDgears.aif.oni" upon importing, which in turn produces the resource named "SNDDgears.aif" that Oni desires.
If you're using Windows, you may find that your newly-converted ima4 AIFF files will not play. This does not mean the files themselves are broken — they will actually play on Macs, but not in Windows, despite having been created in Windows. The reason for this remains to be investigated.
Oni file creation
Via Vago
Installation:
Usage: Oni/AE/Tools/VagoGUI/Vago.exe
- Target Platform: choose the desired mode
- Tools > Sound Wizard
Via batch file
SNDD for Windows
onisplit -create output_PC_files input/*.wav onisplit -create output_PC_files input/*.xml pause
SNDD for Mac
onisplit -create output_Mac_files input/*.aif onisplit -create output_Mac_files input/*.aiff onisplit -create output_Mac_files input/*.afc onisplit -create output_Mac_files input/*.xml pause
Via command line
For those who want to do it on their own.
onisplit
- -create output_directory_MAC input_directory/*.aif
- -create output_directory_PC input_directory/*.wav
- -create output_directory input_directory/*.xml
For fast XML text changes and naming, give them all yourfile as the name, if you have only one sound:
- SNDDyourfile.oni
- OSBDyourfile.grp.oni
- OSBDyourfile.amb.oni
OSBD information
OSBD files are stored globally (in level0_Final).
When to use what
- OSBD*.amb
- music (call OSBD from BSL)
- sound dialogs (call OSBD from BSL)
- BINA3RAP <AmbientSound> (action type)
- BINACJBOSound.xml (area-fixed sounds)
- ONCC sounds (e.g. taunt)
- TRIG <ActiveSound>
- TURR <ActiveSound>
- OSBD*.imp
Details on music
- OSBD_newmusic.amb.oni (The main file — links to the group, intro and ending files)
- OSBD_newmusic.grp.oni (Links to the music files)
- OSBD_newmusic_in.grp.oni (Links to intro part of the music — optional)
- OSBD_newmusic_out.grp.oni (Links to the ending of the music — optional)
- SNDD_newmusic1.oni (The individual music files; it's best to break up the music into segments of perhaps 30 secs to a minute each — Oni may crash or become sluggish if you use a single file for the music)
Breaking the main loop of the music into parts allows Oni to more smoothly transition to the ending part when necessary; the amount of time that a track will play cannot be predicted, after all, since players will take varying amounts of time to clear that segment of the level.
The parts of the music between intro and outro are played in a randomized order, probably to add more variety to the loop.
Note that .grp files have a <Weight> tag under <Permutation>. "Permutation" should have something to do how music parts get repeated. However, it's not clear what influence <Weight> has on the repetitions. Is it like TRAC's <Weight>, used for probability?
OSBDfile.imp.xml
What is an impulse? Looking at the XML, it has these special features: <Volume><Angle> / <Volume><MinAttenuation> / <ImpactVelocity> / <MinOcclusion>. This is because impulses are the preferred choice for moving sound sources. A few more facts:
- They cannot be stopped by BSL once triggered to play.
- AIs can hear them.
- The minimum and maximum volume angle seem to be always 360 degrees. These properties might be a development artifact, since sound should propagate through space in all directions, and the area of effect is mostly determined by their volume distance.
Tag | Type | Description |
<ImpulseSound> | - | |
<Group> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<Priority> | flag | When are these different flags used?
|
<Volume> | - | |
<Distance> | - | |
<Min> | float | From the sound's origin point out to Min radius (distance), the sound volume is equally strong. |
<Max> | float | Between Min and Max radius (distance) the sound volume decreases; a greater distance than Max makes the sound inaudible. |
<Angle> | - | Spatial angle? Does this work like the <Distance> tag? |
<Min> | - | |
<Max> | - | |
<AlternateImpulse> | - | |
<Treshold> | int32 | |
<Impulse> | char[32] | OSBDname.imp.oni, file prefix and suffix aren't used |
<ImpactVelocity> | float | |
<MinOcclusion> | float |
OSBDfile.amb.xml
In case you want to create a simple sound file, you can basically copy the examples below and change the portions marked in red.
- OSBDfile.grp.xml, OSBDfile.amb.xml, BINACJBOSound.xml are showing the markup from the Nyan Cat mod.
Tag | Type | Description |
<AmbientSound> | - | |
<Priority> | flag |
|
<Flags> | flag |
|
<DetailTrackProperties> | - | |
<SphereRadius> | float | |
<ElapsedTime> | - | |
<Min> | float | |
<Max> | float | |
<Volume> | - | |
<Distance> | - | |
<Min> | float | |
<Max> | float | |
<DetailTrack> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<BaseTrack1> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<BaseTrack2> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<InSound> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<OutSound> | char[32] | OSBDname.grp.oni, file prefix and suffix aren't used |
<Treshold> | int32 | |
<MinOcclusion> | float |
An example:
<?xml version="1.0" encoding="utf-8"?> <Oni> <AmbientSound> <Priority>Normal</Priority> <Flags>InterruptTracksOnStop</Flags> <DetailTrackProperties> <SphereRadius>10</SphereRadius> <ElapsedTime> <Min>0</Min> <Max>0</Max> </ElapsedTime> </DetailTrackProperties> <Volume> <Distance> <Min>10</Min> <Max>50</Max> </Distance> </Volume> <DetailTrack></DetailTrack> <BaseTrack1>nyan</BaseTrack1> <BaseTrack2></BaseTrack2> <InSound></InSound> <OutSound></OutSound> <Treshold>3</Treshold> <MinOcclusion>0</MinOcclusion> </AmbientSound> </Oni>
OSBDfile.grp.xml
Tag | Type | Description | ||||||||
<SoundGroup> | - | |||||||||
<Volume> | float | |||||||||
<Pitch> | float | |||||||||
<Flags> | flag | PreventRepeat - Oni will play different permutations of the sound, if there is more than one permutation | ||||||||
<NumberOfChannels> | int32 | Here you tell Oni if your sound file is mono or stereo. 44.1 kHz sounds in Windows are an exception.
| ||||||||
<Permutations> | - | int32 array for the <Permutation> tags | ||||||||
<Permutation> | - | |||||||||
<Weight> | int32 | |||||||||
<Volume> | - | |||||||||
<Min> | float | |||||||||
<Max> | float | |||||||||
<Pitch> | - | |||||||||
<Min> | float | |||||||||
<Max> | float | |||||||||
<Sound> | char[32] | SNDDname.oni, file prefix and suffix aren't used |
An example:
<?xml version="1.0" encoding="utf-8"?> <Oni> <SoundGroup> <Volume>1</Volume> <Pitch>1</Pitch> <Flags>PreventRepeat</Flags> <NumberOfChannels>2</NumberOfChannels> <Permutations> <Permutation> <Weight>10</Weight> <Volume> <Min>1</Min> <Max>1</Max> </Volume> <Pitch> <Min>1</Min> <Max>1</Max> </Pitch> <Sound>nyan</Sound> </Permutation> </Permutations> </SoundGroup> </Oni>
BINACJBOSound.xml
This is for sounds fixed to a certain area.
Tag | Type | Description |
<Objects> | - | This tag marks the file as BINACJBO. |
<SNDG Id="..."> | integer | This tag marks the file as a sound list. The ID doesn't matter at import time. |
<Header> | - | |
<Flags> | flag | You can ignore these flags, as they are defunct:
|
<Position> | float x3 | Here you tell Oni where you want the sound to be located. |
<Rotation> | float x3 | Not really important. |
<OSD> | - | |
<Class> | char[32] | SNDDname.amb.oni, file prefix and suffix aren't used |
<Sphere> | - | |
<MinRadius> | float | From the point of the sound's origin (<Position>) out to Min radius, the sound volume is equally strong. |
<MaxRadius> | float | Between Min and Max radius, the sound volume will decrease; greater distance than Max makes the sound inaudible. |
<Box> | - | You can use this alternative to <Sphere> if you want to limit a sound to a specific room. |
<Min> | float x3 | X1 Y1 Z1 |
<Max> | float x3 | X2 Y2 Z2 |
An example:
<SNDG Id="8805"> <Header> <Flags></Flags> <Position>125 10 2231</Position> <Rotation>0 0 0</Rotation> </Header> <OSD> <Class>nyan</Class> <Sphere> <MinRadius>7</MinRadius> <MaxRadius>21</MaxRadius> </Sphere> <Volume>0.75</Volume> <Pitch>1</Pitch> </OSD> </SNDG>
sound_music_stop soundtrack — can only be used if .amb file has the InterruptTracksOnStop flag
sound_music_stop soundtrack 1 — music drops to zero volume over 1 second
You need a custom function if you want to fade out a soundtrack over more than one second. It could look like this:
var float x = 1; var int y = 0; # Don't test this function with the console or the function might stop working after 4 cycles func fade_music { # An 'if' statement with float values doesn't seem to work, therefore the int y y = y + 1 x = x - .01 sound_music_volume (soundtrack, x) sleep 10 if (y eq 99) { # dmsg "stop music" sound_music_stop soundtrack } if (y < 99) { fork fade_music } }
OCF thread about making new music
See here.
How to register sounds to characters
...such as the sounds of heavy attacks and taunts.
Let's see how sounds become picked up:
Schemata:
- TRAM -> ONCC -> OSBD.amb -> OSBD.grp -> SNDD
Explanation:
- The character performs a move/attack where the TRAM file holds a sound ID (<Vocalization>).
- A link (OSBD.amb name) in the ONCC file will be looked up based on the sound ID. Note that the ONCC file has also a probability value that decides whether a sound will be played or not.
- The game engine looks into OSBD.amb and follows the link into OSBD.grp.
- OSBD.grp can hold multiple links to SNDD files. That's why Konoko can have multiple taunt sounds.
Step 1: Preparing the TRAM
Search for <Vocalization> in the TRAM file and give it an ID according to the following table.
TRAM <Vocalization> IDs refer to these ONCC SoundConstants tags | |
---|---|
ID | link to ... |
0 | <TauntProbability> — taunt(s) |
1 | <AlertProbability> — AI being surprised by a sound |
2 | <StartleProbability> — AI being surprised by an enemy |
3 | <CheckBodyProbability> — AI death taunt, played when enemy dies |
4 | <PursueProbability> — Play this sound when AI loses track of enemy |
5 | <CoverProbability> — Play this sounds when afraid (e.g. "Don't hurt me!") |
6 | <SuperPunchSound> — Sound of ######punch_heavy.oni, super punches don't have sound IDs |
7 | <SuperKickSound> — Sound of ######kick_heavy.oni, super kicks don't have sound IDs |
8 | <Super3Sound> — AI specialty, Mukade use it for his devil star attack (TRAMNINCOMfireball) |
9 | <Super4Sound> - unused |
Step 2: Preparing the ONCC
Search for <SoundConstants> and set a value between 0 and 100. 100 means "always play this sound".
Let's look at Konoko's settings, with a focus on her taunt sound. In ONCCkonoko_generic.xml, we see this:
<SoundConstants> <TauntProbability>100</TauntProbability> <AlertProbability>0</AlertProbability> <StartleProbability>0</StartleProbability> <CheckBodyProbability>0</CheckBodyProbability> <PursueProbability>0</PursueProbability> <CoverProbability>0</CoverProbability> <SuperPunchProbability>100</SuperPunchProbability> <SuperKickProbability>100</SuperKickProbability> <Super3Probability>0</Super3Probability> <Super4Probability>0</Super4Probability> <TauntSound>c17_99_28konoko</TauntSound> <AlertSound></AlertSound> <StartleSound></StartleSound> <CheckBodySound></CheckBodySound> <PursueSound></PursueSound> <CoverSound></CoverSound> <SuperPunchSound>c18_79_14konoko</SuperPunchSound> <SuperKickSound>c18_79_15konoko</SuperKickSound> <Super3Sound></Super3Sound> <Super4Sound></Super4Sound> </SoundConstants>
Step 3: Preparing the OSBD.amb
Do you see the <BaseTrack1> tag? In this case it holds the link OSBDc17_99_28konoko.grp.oni.
<?xml version="1.0" encoding="utf-8"?> <Oni> <AmbientSound> <Priority>Highest</Priority> <Flags>InterruptTracksOnStop PlayOnce</Flags> <DetailTrackProperties> <SphereRadius>10</SphereRadius> <ElapsedTime> <Min>0</Min> <Max>0</Max> </ElapsedTime> </DetailTrackProperties> <Volume> <Distance> <Min>10</Min> <Max>50</Max> </Distance> </Volume> <DetailTrack></DetailTrack> <BaseTrack1>c17_99_28konoko</BaseTrack1> <BaseTrack2></BaseTrack2> <InSound></InSound> <OutSound></OutSound> <Treshold>3</Treshold> <MinOcclusion>0</MinOcclusion> </AmbientSound> </Oni>
Step 4: Preparing the OSBD.grp
Since <NumberOfChannels> is only once presented all the SNDD files must have the same number of channels.
22.05 kHz, mono | 22.05 kHz, stereo | 44.1 kHz, mono (PC-only) | |
---|---|---|---|
NumberOfChannels | 1 | 2 | 2 |
(It's possible to speed up sounds with <Pitch>, e.g. the Fury's taunt is sped up by 1.14 to brighten the voice. But in most cases you probably want to keep it as "1".)
<?xml version="1.0" encoding="utf-8"?> <Oni> <SoundGroup> <Volume>1</Volume> <Pitch>1</Pitch> <Flags>PreventRepeat</Flags> <NumberOfChannels>1</NumberOfChannels> <Permutations> <Permutation> <Weight>10</Weight> <Volume> <Min>1</Min> <Max>1</Max> </Volume> <Pitch> <Min>1</Min> <Max>1</Max> </Pitch> <Sound>c17_99_28konoko.aif</Sound> </Permutation> <Permutation> <Weight>10</Weight> <Volume> <Min>1</Min> <Max>1</Max> </Volume> <Pitch> <Min>1</Min> <Max>1</Max> </Pitch> <Sound>c17_99_29konoko.aif</Sound> </Permutation> [...] </Permutations> </SoundGroup> </Oni>
As you can see, Konoko has multiple sounds to choose from.
- SNDDc17_99_28konoko.aif.oni ("You're gonna get beat by a girl!")
- SNDDc17_99_29konoko.aif.oni ("Ready to lose?") (You can play sounds in Simple OniSplit GUI (Windows only).
- [...]
"aif" is here part of the name, as explained in the "Source file creation" section above.
Permutations in .grp files are the reason why Konoko has multiple sounds that can play during the same taunt animation.
Step 5: Everything else that's left
- Create your SNDD if you haven't yet.
- Put your files into a mod package.
- Test your stuff in-game!