I-F(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’… NAME

i-f β€” bestie, this is the little tool that takes your 16-bit short integers and turns them into floats ✨ it's giving "glow-up for numbers" honestly 🫢


✨ SYNOPSIS ✨

i-f [-n | scale] < shorts > floats

Like, shorts go in, floats come out, and you can't explain that πŸ¦‹


🌸 DESCRIPTION 🌸

Okay so here's the whole vibe πŸ’–: i-f reads a stream of native, machine-format 16-bit signed short integers from standard input, multiplies each and every value by a scale factor, and writes the results out to standard output as native single-precision floating point numbers. That's the whole main character plot, no cap.

The optional single argument is what picks your scaling, and it's lowkey the only decision you have to make πŸ‘‘

If a numeric scale is given, each input value gets multiplied by it. Periodt. If -n is given instead, the scale gets set to 1/32768, so that the full short integer range maps onto data in the range -1.0 to +1.0 β€” the way that math just works out is so satisfying ngl 🌈

With no argument at all, the scale defaults to 1.0 and each short is simply widened to a float. Chill, minimal effort, still slays πŸ’…

🚨 Heads up bestie: a scale of 0.0 is rejected as an error, and so is reading from an interactive terminal. Neither of those is the move, fr fr πŸ’€
πŸ’€ Also, real talk: this command is deprecated and scheduled for removal β€” it prints a deprecation warning on startup, so don't get too attached 😭 It is the inverse of f-i(1), and it's typically used in pipelines with other BRL-CAD signal-processing tools such as dmod(1) and dconv(1). iykyk 🧚

πŸŽ€ OPTIONS πŸŽ€

  • -n β€” Normalize, bestie! Uses a scale of 1/32768 so that full-range 16-bit signed input gets mapped onto the range -1.0 to +1.0. Mutually exclusive with a numeric scale argument β€” you literally cannot have both, pick a lane πŸ’…
  • scale β€” A floating point multiplier applied to every input sample during conversion. And just to say it again because it matters: a scale of 0.0 is rejected as an error. Do not pass zero, I am begging πŸ™ˆ

⭐ EXAMPLES ⭐

Example 1. Normalize full-scale audio samples to unit-range floats 🌸

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

Treats the values in signal.pcm as full-range 16-bit signed samples and rescales them to the range -1.0 to +1.0, producing a stream of floats in signal.f suitable for further floating point processing. Chef's kiss, honestly πŸ‘‘ This one ate πŸ”₯

Example 2. Apply an explicit gain in a processing pipeline πŸ¦‹

i-f 0.01 < input.shorts | dconv > output.f

Scales each short sample by 0.01 while converting to float, then feeds the resulting float stream into dconv(1) for further signal processing. Pipeline queen behavior, we love to see it πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

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

Go read the whole friend group, they're all iconic in their own way 🫢


🌟 AUTHOR 🌟

The BRL-CAD Team β€” absolute legends, we stan πŸ’–


This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory. Fancy fancy, legally speaking πŸŽ€


πŸ› BUG REPORTS πŸ›

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. Found a problem? Tell them!! They want to know!! Not me sitting in silence with a broken pipeline, that's not the vibe 😭


✨ and that's the page, bestie ✨ β€” this was I-F(1) from the BRL-CAD manual, brought to you by the one and only source/version BRL-CAD, dated I-F(1) πŸ¦‹ mwah πŸ’‹

πŸ“¦ where this page comes from