SMOD(1)
π SMOD(1) β the glow-up page
okay so bestie, welcome to smod from BRL-CAD, section 1 of the manual. she's a little filter that modifies intensities in a stream of 16-bit signed short integers and honestly? she ate. let's get into it π
β¨ NAME β¨
smod β modify intensities in a stream of 16-bit signed short integers π
π¦ SYNOPSIS π¦
smod [-a add] [-s sub] [-m mult] [-d div] [-A] [-e exp] [-r root] [file.s] > output.s
πΈ DESCRIPTION πΈ
so smod reads a stream of 16-bit signed short integers, applies a sequence of arithmetic operations to each value, and writes the modified stream to standard output. that's the whole vibe. she's typically used to scale or bias signal data β like the stuff produced by d-i(1) or consumed by the other sig utilities. icon behavior π
any number of operations may be given, and they're applied in the exact order in which they appear on the command line. no reordering, no "let me just optimize that for you" β the order you typed is the order she runs. and because she's efficient like that, smod precomputes a lookup table covering every possible input value (from -32768 to 32767) before processing the stream. main character energy fr π
π¨ real talk: if an operation produces a result outside the representable range of a 16-bit signed short, the value is clamped to32767or-32768. and then β because she keeps receipts β the count of values clipped high and clipped low is reported on standard error when processing finishes. so if your numbers look squished, check stderr, bestie π
if file.s is not given, smod reads from standard input. both input and output must be redirected β smod refuses to read from or write to a terminal. no cap. she's not doing that today π
β OPTIONS β
-a addβ addaddto each value π-s subβ subtractsubfrom each value π-m multβ multiply each value bymultβ¨-d divβ divide each value bydiv. a divisor of zero is an error π« (don't do it, she will not recover)-Aβ replace each value with its absolute value π-e expβ raise each value to the powerexpπ₯-r rootβ take the rootrootof each value (equivalent to raising to the power1/root). a root of zero is an error π-h,-?β print a usage message and exit. tiny little helpline, love that for us π«Ά
π§ EXAMPLES π§
Example 1. Bias and scale a signal
smod -a 100 -m 2 data.s > scaled.s
reads short integers from data.s, adds 100 to each value, then doubles the result, writing the modified stream to scaled.s. operations are applied left to right, so the bias is added before the scaling. order matters, bestie, always π
Example 2. Compute signal magnitude in a pipeline
d-i < samples.d | smod -A -m 0.5 > half_magnitude.s
converts double-precision samples to shorts with d-i(1), takes the absolute value of each sample, and halves it before writing the result. any value that would exceed the short range is clipped and counted on standard error. pipeline slay π«
π SEE ALSO π
brlcad(1), d-i(1), dmod(1), imod(1), umod(1), istats(1) β the whole friend group π«Ά
π 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 β yes, actual email, vintage of her but it works π
okay that's the whole page!! SMOD(1) straight out of the BRL-CAD manual set β go forth and modify those intensities, bestie π
β¨
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms