d-i [-n | scale] < doubles > shorts
D-I(1)
NAME
d-i - convert doubles to 16-bit short integers
On this page
SYNOPSIS
DESCRIPTION
d-i reads a stream of native, machine-format, double-precision floating point numbers from standard input, multiplies each value by a scale factor, and writes the results to standard output as native 16-bit signed short integers.
The optional single argument selects the scaling:
If a numeric scale is given, each input value is multiplied by it. If -n is given, the scale is set to 32767.0, so that input data in the range -1.0 to +1.0 maps onto the full short integer range. With no argument the scale defaults to 1.0.
Values that exceed the representable short range are clipped to 32767 or -32768, and a count of clipped high and low samples is reported on standard error.
This command is deprecated and scheduled for removal; it prints a deprecation warning on startup. It is the inverse of i-d(1), and is typically used in pipelines with other BRL-CAD signal-processing tools such as dmod(1) and dconv(1).
OPTIONS
- -n
-
Normalize: use a scale of 32767.0 so that input in the range -1.0 to +1.0 fills the full 16-bit signed range. Mutually exclusive with a numeric scale argument.
- scale
-
A floating point multiplier applied to every input sample before conversion. A scale of 0.0 is rejected as an error.
EXAMPLES
d-i -n < signal.d > signal.pcm
Treats the values in signal.d as samples in the range -1.0 to +1.0
and rescales them to fill the 16-bit signed integer range, producing
raw PCM-style short data in signal.pcm.
dmod -m 0.5 < input.d | d-i 100 > scaled.shorts
Multiplies the double-precision stream by 0.5 using dmod(1), then scales by 100 and converts to 16-bit shorts. Any samples that exceed the short range are clipped and a clip count is printed to standard error.
SEE ALSO
brlcad(1), i-d(1), d-a(1), d-u(1), dconv(1), dmod(1)
AUTHOR
BRL-CAD Team
COPYRIGHT
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
BUG REPORTS
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org