SNDCONVERT(1) — UNIX Programmer’s Manual
NAME
sndconvert − convert a soundfile to a different format
SYNOPSIS
sndconvert [ option ] ... file
DESCRIPTION
Sndconvert modifies the file according to various options. The various options allow conversion between formats, including non-soundfile formats.
OPTIONS
−o outfile
This option indicates that the output is to be written to the specified file. By default, soundfiles are modified in place, with the exception of a conversion that changes the file type (i.e. -d, -r, and -a options).
−i infostring
This option specifies that its argument is to be appended to the info string in the soundfile header. By default, the info string is null.
−f formatCode
This specifies the resulting data format of the sound. The value of the number represents the format code; format codes are defined in <sound/soundstruct.h>. The default format code is the the input file’s format code. The format conversions currently supported are SND_FORMAT_LINEAR_16 to SND_FORMAT_MULAW_8 SND_FORMAT_MULAW_8 to SND_FORMAT_LINEAR_16 SND_FORMAT_FLOAT to SND_FORMAT_LINEAR_16 SND_FORMAT_DOUBLE to SND_FORMAT_LINEAR_16
−g scaleExponent
This allows the user to determine the scaling on the float-to-integer or integer-to-float translations. The scale factor used in translating float-to-integer is (float) ∗ ((1 << scaleExponent)-1). The scale factor used in translating integer-to-float is (integer) / ((1 << scaleExponent)-1). The default scaleExponent is 15, which means that a float value of 1.0 is translated to the integer value of 32767. Using a scaleExponent of 23 translates a float value of 1.0 to a full-scale integer value used by the DSP56001.
−s sampleRate
This specifies the resulting sampling rate of the sound. It may be a floating point number. The default sampling rate is the input file’s sampling rate. If the source file is 44.1 kHz and the destination is a 22050 Hz file, then a sample rate conversion is performed. Sample rate conversion is also performed when converting 8 bit mulaw, 8012.821 Hz to 16 bit linear, 22050 Hz.
−c channelCount
This specifies the resulting number of channels of the sound. The default channel count is the input file’s channel count. If the input file is mono (1 channel) and the channel count is 2, then a mono-to-stereo conversion is performed, for linear 16 or 32 bit files. If the input file is stereo (2 channels) and the channel count is 1, then a stereo-to-mono conversion (an equal mix of the two channels) is performed, also for linear 16 or 32 bit files.
−r This specifies the input file to be a raw data file, to which a header is added. The resulting soundfile is of the same name as the input file with a .snd extension.
−a This option specifies the input file to be a raw data file, as with the -r option, but the data format is ascii, with each number separated by newlines. The output files that can be generated from ascii input files are SND_FORMAT_LINEAR_16, SND_FORMAT_MULAW_8, SND_FORMAT_FLOAT, and SND_FORMAT_DOUBLE. If the output format is SND_FORMAT_LINEAR_16, input values are scaled by the scaleExponent specified with the -g option (the default is 32767.0).
−d This option indicates that the file is a DSP absolute load image. The file must have a .lod extension, and the output file will be of the same name with a .snd extension.
FILES
The <sound/soundstruct.h> file contains the data format codes defined by the system.
SEE ALSO
sndplay(1), sndrecord(1), sndinfo(1), sndcompress(1)
BUGS
Only the following specific conversions are supported:
DSP load image (.lod) to soundfile (.snd)
Raw data to any format
ASCII data to double, float, 8 or 16 bit linear, or 8 bit mulaw
8 bit mulaw, mono, 8012.821 Hz to 16 bit linear, 22050 Hz, stereo
16 bit linear, 44.1 kHz to 16 bit linear, 22050 Hz
16 or 32 bit linear mono to stereo and stereo to mono
8 bit mulaw to 16 bit linear
16 bit linear to 8 bit mulaw
16 bit linear to float or double
Float or double to 16 bit linear
The following conversions do not support the -i option, and require the -o option to be present:
8 bit mulaw, mono, 8012.821 Hz to 16 bit linear, 22050 Hz, stereo
16 bit linear, 44.1 kHz to 16 bit linear, 22050 Hz
Sndconvert will fail silently when converting 8 bit mulaw, 8012.821 Hz to 16 bit linear, 22050 Hz unless you specify "-c 2". It will also fail silently if you specify a sampling rate other than 22050.
NeXT Computer, Inc. — October 16, 1990