Importing Sound Effects

The Sound Pipeline converter tool, sndconv.exe, is a host-PC command line program that imports a collection of sound files into the SP data format.

A script file specifies each sound file to be converted. The script also defines the properties of each sound effect, such as sample rate, size, encoding scheme, and loop data.

Data flow for importing sound effects

The converter tool generates three files:

For more information about the format and use of these files, refer to the "The sndconv Program" section of the Sound Pipeline Tools reference.

The base-name of the output files is derived from the base-name of the script file. For example, if the script file is called "TEST_SFX.txt," then sndconv.exe will generate the following output files:

Functionality

Supported input formats

The sndconv.exe converter tool supports the following input formats:

Conversion functions

The sndconv.exe tool can perform the following operations on input sound data:

Using sndconv.exe

The command line

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

bash> sndconv <scriptfile> [-option]

The <scriptfile> argument in "sndconv command line syntax" 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 the "Data abstraction" section of the Sound Pipeline Tools page.

Option Description
-a Default output to ADPCM.
-w Default output to 16-bit PCM.
-b Default output to 8bit PCM.
-h This help text.

The -a, -w, and -b options specify the default output format. The sndconv.exe tool uses default 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.

The sndconv.exe tool is located in the Nintendo Cafe SDK, under either of the following paths:

NOTE:
sndconv.exe requires two DLLs, which are also located under the same path:
  • soundfile.dll
  • dsptool.dll
Or, for the 64-bit version:
  • soundfile64.dll
  • dsptool64.dll

Scripting

The sndconv.exe script file specifies which files to convert and how to convert them. The following is an example:

;
; 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

Command syntax

Script files have the following basic structure:

; 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
  2. INCLUDE <scriptfile>
    

    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).

  3. The PATH command
  4. 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.

  5. The sound effect clause
  6. 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.
  7. The COMMENT command in C header files and script files
  8. 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 "//").

    ; <comment text>
    

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

Attributes

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

  1. The FILE attribute
  2. 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):

    File Type Attributes
    Sample Rate Bits per sample Number Channels Loop Points
    WAV Yes Yes Yes No
    AIFF Yes Yes Yes Yes
    NOTE:
    WAV files do not support the encoding of loop-point information.

    The FILE attribute is required.

  3. The SAMPLERATE attribute
  4. 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.

  5. The LOOP points attribute
  6. 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 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:
    The automatic detection of loop points applies to AIFF files only, as WAV files do not have a standard method of encoding of loop point information.
  7. The MIX attribute
  8. MIX <mix operation>
    

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

    Mix Operation Description
    Combine The LEFT and RIGHT channel samples will be mixed together to generate a MONO channel.
    LEFT Only the LEFT channel data will be extracted from the sound file.
    RIGHT Only the RIGHT channel data will be extracted from the sound file.

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

  9. The OUTPUT attribute
  10. OUTPUT <conversion operation>
    

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

    Conversion Operation Description
    8BIT Sound data will be stored as 8-bit PCM.
    16BIT Sound data will be stored as 16-bit PCM.
    ADPCM Sound data will be stored as DSP-ADPCM.

    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.

General notes on scripting

Revision History

2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup Pass.
2011/02/21 Initial version.


CONFIDENTIAL