D-I(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’… d-i β€” the manual, but make it make sense

okay bestie, so this is d-i from the BRL-CAD fam (manual section 1, she's official ✨). Think of her as the little converter that takes your fancy double-precision floats and squishes them down into cute lil' 16-bit short integers. It's giving "glow-down but on purpose" πŸ’–


✨ NAME ✨

d-i β€” converts doubles into 16-bit short integers. that's it, that's the whole job πŸŽ€


🌸 SYNOPSIS 🌸

d-i [-n | scale] < doubles > shorts

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: d-i reads a stream of native, machine-format, double-precision floating point numbers from standard input, multiplies every single value by a scale factor, and writes the results out to standard output as native 16-bit signed short integers. no cap, that's the entire pipeline πŸ’«

The optional single argument is what picks your scaling, and you've got choices:

If you pass a numeric scale, every input value gets multiplied by it. If you pass -n, the scale is set to 32767.0, so input data sitting in the range -1.0 to +1.0 maps all the way onto the full short integer range. And if you pass no argument at all, the scale just defaults to 1.0. easy πŸ’…

Now for the spicy part: values that exceed the representable short range get clipped to 32767 or -32768, and a count of the clipped high and low samples gets reported on standard error. so you'll know if your data got a little too extra 😭

⚠️ okay important: this command is deprecated and scheduled for removal β€” she literally prints a deprecation warning on startup. so appreciate her while she's here 🫢

She's the exact inverse of i-d(1), and she typically shows up in pipelines alongside other BRL-CAD signal-processing tools like dmod(1) and dconv(1). iconic teamwork honestly πŸ‘‘


✨ 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, so pick one bestie, not both πŸ™ˆ
  • scale β€” A floating point multiplier applied to every input sample before conversion. A scale of 0.0 is rejected as an error. sorry, zero, you're not invited πŸ’€

πŸ“ EXAMPLES πŸ“

Example 1. Normalize unit-range doubles to full-scale audio samples 🎧

d-i -n < signal.d > signal.pcm

This 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. literally her main character moment 🌟

Example 2. Apply an explicit gain in a processing pipeline πŸ”₯

dmod -m 0.5 < input.d | d-i 100 > scaled.shorts

This 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 get clipped and a clip count is printed to standard error. pipeline queen behavior fr fr πŸ’œ


🌈 SEE ALSO 🌈

brlcad(1), i-d(1), d-a(1), d-u(1), dconv(1), dmod(1)

go read those too, they're all part of the squad 🫢


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team πŸ’–


This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory. yes the government owns this one, slay πŸ›οΈβœ¨


πŸ’Œ BUG REPORTS πŸ’Œ

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. tell them everything, they wanna know πŸ›πŸ’…


and that's the whole page, bestie β€” brought to you by BRL-CAD, the D-I(1) manual page, no notes, periodt πŸŒΈπŸ’–

πŸ“¦ where this page comes from