Kitty Corp Meow Mix Forums

Help & Tutorials => Help => Topic started by: videogamer555 on January 24, 2016, 09:49:23 PM



Title: I need some help with sndconv.exe
Post by: videogamer555 on January 24, 2016, 09:49:23 PM
I managed to find a copy of the official WiiSDK, which had a ton of stuff, most of which was VERY complicated, or required external development hardware (basically a custom build Wii that can run homebrew without any modding, and can have files directly uploaded to it from your PC), but there were also a few tools/utilities that looked like they could be useful for modding games. One of these potentially useful tools is sndconv.exe. Unfortunately I don't know how to use it. When you run it with no parameters, it displays the following information:
Quote
Usage:

SNDCONV <inputfile> [-option]
Where:
   <scriptfile>.......Script file (required)

Options are:
   -a.................Default output to ADPCM
   -w.................Default output to 16bit PCM
   -b.................Default output to 8bit PCM
   -h.................This help text.

Unfortunately, I don't know what format the script files are in. I assume they must contain info about the source audio data that is to be converted to the Wii sound file format. Anybody here on these forums who's an actual Nintendo developer or Nintendo licensed 3rd party developer, and who therefore would have actual knowledge on how to use this particular program? I hope so, because I don't have any knowledge of the script file format.


Title: Re: I need some help with sndconv.exe
Post by: Ebola16 on January 25, 2016, 04:59:21 AM
Super Sawndz! Exists because of that file.
It's a GUI interface that replaces audio files in Brawl's smashbros_sound.brsar
http://smashboards.com/threads/super-sawndz.325410/ (http://smashboards.com/threads/super-sawndz.325410/)


Title: Re: I need some help with sndconv.exe
Post by: videogamer555 on January 25, 2016, 07:40:19 AM
Super Sawndz! Exists because of that file.
It's a GUI interface that replaces audio files in Brawl's smashbros_sound.brsar
[url]http://smashboards.com/threads/super-sawndz.325410/[/url] ([url]http://smashboards.com/threads/super-sawndz.325410/[/url])


I don't want to replace sounds in Brawl's smashbros_sound.brsar file. I want to generate standalone sound files, for the purpose of using them in Project M. I do NOT want to have to use a brsar file as an intermediate step. However until I point super-sawndz to a copy of the smashbros_sound.brsar file, it won't let me do ANYTHING. And I can't bypass this obstacle. So I've decided to go directly to the OFFICIAL sound converter software, Nintendo's own sndconv.exe sound converter. I just need somebody to tell me how to use it, because I don't have even a CLUE as to what format the script files are in. Are they based on XML files? I really don't know at all. Any help here would REALLY be a big benefit to me.


Title: Re: I need some help with sndconv.exe
Post by: Ebola16 on January 25, 2016, 08:46:33 AM
Gotcha. I'd suggest messaging agoaj and Jaklub, the creators of Super Sawndz!, since I have a feeling not many people have looked into sndconv.


Title: Re: I need some help with sndconv.exe
Post by: videogamer555 on January 25, 2016, 11:38:45 AM
Ok, I FINALLY found the PDF file in the Wii SDK that had the documentation needed for correct operation of sndconv.exe

Below are quotes from the documentation needed to know how to completely operate sndconv.exe. Within these quote boxes, for any sections that include sample code, I've used code boxes, and if a graphic/table is used, I've uploaded uploaded a screencap to imgur, and embedded it here. The full PDF file is much longer, and has info on a lot more things than just sndconv.exe, so I've only included quotes from the sections involving the use of sndconv.exe.


Quote
2.2 Using sndconv.exe

2.2.1 The Command Line

From the command line, you can invoke the sndconv.exe program like so:

Code 2–1 sndconv Command Line Syntax
Code:
bash> sndconv <scriptfile> [-option]

Where:
<scriptfile>script file (required)

Options are:
-a Default output to ADPCM.
-w Default output to 16bit PCM.
-b Default output to 8bit PCM.
-h This help text.

The <scriptfile> argument in Code 2–1 is required and specifies a text file that contains commands for
sndconv.exe. These commands specify which sound files to convert and pack. These commands also
describe the various attributes of each file, and how they should be converted. For further details, see
“Data Abstraction and File Formats” on page 32.

The –a, –w, and –b options specify the default output format. The sndconv.exe tool uses these defaults
if the script file does not specify a desired output format for a given sound file.
If no option is specified, then sndconv.exe will use ADPCM as a default output format

Note that I have NOT quoted page 32 in this post, despite it being referenced in the above quote. That is because it just provides more technical information about how sound data is stored. This information would really only useful if you are writing your own program for processing sound data in the Wii audio file format. As with the above quote, all the quotes below are also specifically about sndconv.exe and the format of its script files.


Quote
2.2.2 Scripting

The sndconv.exe script file specifies which files to convert and how to convert them. An example is
shown in Code 2–2:

Code 2–2 Script File Example
Code:
;
; Text after a semicolon is ignored as commentary.
;

COMMENT
COMMENT This is a COMMENT field. Any text following a COMMENT
COMMENT command will be generated as a comment in the corresponding
COMMENT ‘C’ header file output. This is useful for annotating the
COMMENT header file from the script
COMMENT

;
; Set source path for sound files
;
PATH C:\sounds

INCLUDE other_script.txt

COMMENT *****************************************
COMMENT Explosion sounds!
COMMENT *****************************************

BEGIN BIG_EXPLOSION ; Identifier for sound effect
FILE big_exp_pcm16mono.wav ; Source filename – it’s a WAV file!
SAMPLERATE 22050 ; Source sample rate, in Hz
OUTPUT ADPCM ; Will be converted to ADPCM
END

BEGIN LITTLE_EXPLOSION ; Identifier for sound effect
FILE lil_exp_pcm16stereo.aif ; Source filename – it’s an AIFF file!
SAMPLERATE 22050 ; Source sample rate, in Hz
OUTPUT ADPCM ; Will be converted to ADPCM
END

COMMENT *****************************************
COMMENT Helicopter sounds!
COMMENT *****************************************

BEGIN CHOPPER ; Identifier for sound effect
FILE apache_pcm16mono.wav ; Source filename – it’s a WAV file!
SAMPLERATE 32000 ; Source sample rate, in Hz
OUTPUT 16BIT ; Output will be in 16bit PCM
LOOP 117 254 ; loop point start and end!
END

COMMENT *****************************************
COMMENT Whoosh sound
COMMENT *****************************************

BEGIN BIG_WHOOSH ; Identifier for sound effect
FILE bigwhoosh_pcm16stereo.aif ; Source filename – it’s an AIFF file
SAMPLERATE 32000 ; Source sample rate, in Hz
OUTPUT 16BIT ; Output will be 16bit also
LOOP 312 423 ; loop start and end points
MIX COMBINE ; Source sample is stereo, downmix to MONO
END

BEGIN LEFT_WHOOSH ; Identifier for sound effect
FILE bigwhoosh_pcm16stereo.aif ; Source filename – it’s an AIFF file
SAMPLERATE 32000 ; Source sample rate, in Hz
OUTPUT 16BIT ; Output will be 16bit also
LOOP 312 423 ; Loop start and end points
MIX LEFT ; Extract left channel only
END

BEGIN RIGHT_WHOOSH ; Identifier for sound effect
FILE bigwhoosh_pcm16stereo.aif ; Source filename – it’s an AIFF file
SAMPLERATE 32000 ; Source sample rate, in Hz
OUTPUT 16BIT ; Output will be 16bit also
LOOP 312 423 ; Loop start and end points
MIX RIGHT ; Extract left channel only
END

COMMENT *****************************************
COMMENT Beep sound
COMMENT *****************************************

BEGIN WARNING_BEEP ; Identifier for sound effect
FILE beep_pcm8stereo.aif ; Source filename – it’s an AIFF file
SAMPLERATE 11025 ; Source sample rate, in Hz
OUTPUT 16BIT ; Will be converter to 16bit
MIX COMBINE ; Source sample is stereo, downmix to MONO
END



Quote
2.2.2.1 Command syntax

Script files have the following basic structure:

Code 2–3 Basic Script Structure and Syntax
Code:
; Script comments!
;
;

PATH <path specification>
INCLUDE <other script file>
COMMENT <optional comment field>
BEGIN <sound effect name>
attribute1 <parameter>
attribute2 <parameter>

END
COMMENT <optional comment field>
BEGIN <another sound effect name>
attribute1 <parameter>
attribute2 <parameter>

END


(1) The INCLUDE Command

Code 2–4 The INCLUDE Command
Code:
INCLUDE <script file>

The INCLUDE command specifies the path of another script file to be included for processing. The path
can be relative to the directory established by the last PATH command, if any, or it can be absolute.

This command is optional and can be issued at any point in the script (outside of BEGIN-END clauses).


(2) The PATH Command

Code 2–5 The PATH Command
Code:
PATH <path specification>

The PATH command specifies an absolute or relative path to the directory from which subsequent sound
files will be processed. You can issue multiple PATH commands in a script to change directories as
needed. PATH commands must exist outside of BEGIN…END clauses. The path must not contain spaces.

This command is optional. If omitted, sndconv.exe will use the directory from which the tool was invoked
as the current path.


(3) The Sound Effect Clause

Code 2–6 The Sound Effect Clause
Code:
BEGIN <sound effect name>

END

The BEGIN and END commands delimit a clause within which you define the attributes of a sound effect.

The field <sound effect name> must be a C-compatible symbol that uniquely identifies the sound
effect. When generating the header file, sndconv.exe will collect all sound effect names and automatically
enumerate them.

Note: Each sound effect name MUST be unique, otherwise the C header file will fail to compile. Also,
BEGIN-END clauses cannot be nested.


(4) The COMMENT Command in C Header Files and Script Files

Code 2–7 The Header File COMMENT Command
Code:
COMMENT <commentary text for C-header file>

The COMMENT command specifies text that must appear as a comment in the C header file. Everything on
the line after a COMMENT command will be preserved as text in the C header file (preceded by “//”).


Code 2–8 Script Comment
Code:
; <comment text>

Everything after a semicolon (“;”) is ignored as script commentary.



Quote
2.2.2.2 Attributes

This section describes the keywords reserved for defining the attributes of a particular sound effect.

(1) The FILE attribute

Code 2–9 The FILE Attribute
Code:
FILE <filename>

Where <filename> specifies a file (in the current PATH) to be processed. The filename must not contain
any spaces.

The sndconv.exe tool will automatically determine the file type by examining the file itself. If the file is
neither WAV- nor AIFF-encoded data, the tool will generate an error message and ignore the sound file.

If sndconv.exe cannot find the file, it will issue a warning and continue processing the script.

By default, sndconv.exe will extract the following information from each sound file (depending on type):

Table 2–1 Intrinsic Attributes of Supported Sound File Formats
([url]http://i.imgur.com/1cMq9Kj.png[/url])

Note: WAV files do not support the encoding of loop-point information.

The FILE attribute is required.


(2) The SAMPLERATE Attribute

Code 2–10 The SAMPLERATE Attribute
Code:
SAMPLERATE <source sample rate>

Where <source sample rate> is an integer specifying the base sample rate of the sound effect, in
Hertz.

This attribute is optional. If omitted, sndconv.exe will use the sample rate encoded in the sound file.


(3) The LOOP Points Attribute

Code 2–11 The LOOP Points Attribute
Code:
LOOP <loop start> <loop end>

The LOOP attribute specifies the loop start and loop end points of a sample. The <loop start> parameter
specifies the first sample played within the loop. The <loop end> parameter specifies the very last
sample played within the loop.

Note: For these parameters, samples are counted starting from zero. For example, if a loop starts on the
14th sample in the file, then the <loop start> parameter must be set to 13.

The LOOP attribute is optional. If omitted, loop point information encoded within the sound file (if any) will
be used by default. Otherwise, the specified loop points will override the encoded data.

Note: This applies to AIFF files only, as WAV files do not support the encoding of loop point information.


(4) The MIX Attribute

Code 2–12 The MIX attribute
Code:
MIX <mix operation>

The MIX attribute specifies how to handle STEREO sound files. The following operations are supported:

Table 2–2 MIX Operations
([url]http://i.imgur.com/y8nqESO.png[/url])

This attribute is optional. If omitted, the tool will COMBINE stereo files by default.


(5) The OUTPUT Attribute

Code 2–13 The OUTPUT Attribute
Code:
OUTPUT <conversion operation>

The OUTPUT attribute specifies the output format of the sound data. The following conversions are supported:

Table 2–3 OUTPUT Arguments
([url]http://i.imgur.com/MYQuExU.png[/url])

This attribute is optional. If omitted, sndconv.exe will use the default output format specified by the -a,
-w, or -b command line options. If no command line option is specified, the default output format will be
ADPCM.

Note: Sound effects in an SPD file can have different output formats.



Quote
2.2.2.3 General Notes on Scripting

• White space is ignored. For example, “BEGIN BLAMMO_32KHZ” is the same as
“BEGIN BLAMMO_32KHZ”.

• Sound effect names are case-sensitive. Thus, “BEGIN BLAMMO_32KHZ” is unique from
“BEGIN Blammo_32KHz”.

• Text is parsed line-by-line and must end with a newline. Each line must be less than 255 characters in
length.

• Script comments begin with a semicolon and continue to the end of the line.