• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Where is the latest sox documentation

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
296
Likes
344
I have seen various references on the web to sox parameters that I cannot see on the sox home page's pdf/html documentation.

To prove I wasnt seeing things I downloaded the sox code and had a look around.

I saw this snippet indicating that some of the referenced parameters not in the doco (say -R) were in theory accepted from the command line:

while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
GETOPT_NUMERIC(optstate, 'i', coef_interp, -1, 2)
GETOPT_NUMERIC(optstate, 'c', max_coefs_size, 100, INT_MAX)
GETOPT_NUMERIC(optstate, 'p', phase, 0, 100)
GETOPT_NUMERIC(optstate, 'B', bw_0dB_pc, 53, 99.5)
GETOPT_NUMERIC(optstate, 'A', anti_aliasing_pc, 85, 100)
GETOPT_NUMERIC(optstate, 'd', bit_depth, 15, 33)
GETOPT_LOCAL_NUMERIC(optstate, 'b', bw_3dB_pc, 74, 99.7)
GETOPT_LOCAL_NUMERIC(optstate, 'R', rej, 90, 200)
GETOPT_LOCAL_NUMERIC(optstate, 'Q', quality, 0, 7)
case 'M': p->phase = 0; break;
case 'I': p->phase = 25; break;
case 'L': p->phase = 50; break;
case 'a': allow_aliasing = sox_true; break;
case 'f': p->rolloff = rolloff_none; break;
case 'n': p->noIOpt = sox_true; break;
case 's': bw_3dB_pc = 99; break;
case 't': p->use_hi_prec_clock = sox_true; break;
default:
if ((found_at = strchr(qopts, c)))
quality = found_at - qopts;
else {
lsx_fail("unknown option `-%c'", optstate.opt);
return lsx_usage(effp);
}
}


After compiling and running with an undocumented value that was out of scope (-R), it shows that this parameter is part of sox BUT neither the help inherent in the sox exe or the website make any reference to -R and other values I see referenced on the web.

So where is the latest version of the sox doco?

/usr/local/bin/sox -D -t wav bob.wav -t flac -C 0 -b 24 --buffer 131072 bob.flac gain -h -n -4 rate -v -R 80 -b 95.4 -p 45 -a 96000
/usr/local/bin/sox FAIL rate: parameter `rej' must be between 90 and 200
/usr/local/bin/sox FAIL rate: usage: [-q|-l|-m|-h|-v] [override-options] RATE[k]
BAND-
QUALITY WIDTH REJ dB TYPICAL USE

-q quick n/a ~30 @ Fs/4 playback on ancient hardware
-l low 80% 100 playback on old hardware
-m medium 95% 100 audio playback
-h high (default) 95% 125 16-bit mastering (use with dither)
-v very high 95% 175 24-bit mastering
OVERRIDE OPTIONS (only with -m, -h, -v)

-M/-I/-L Phase response = minimum/intermediate/linear(default)
-s Steep filter (band-width = 99%)
-a Allow aliasing above the pass-band
-b 74-99.7 Any band-width %
-p 0-100 Any phase response (0 = minimum, 25 = intermediate,
50 = linear, 100 = maximum)


Thanks,

Peter
 
OP
F

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
296
Likes
344
Found this reference buried in this post from 2020-07-16 which seems to cover whats not documented.



rate [<quality-level>] [<override-options>] <rate>

The higher the quality level, the more compute power is required.

The quality-level options are as follows. If none is chosen, the default is "-h" (high):

-q = quick
-l = low
-m = medium
-g = medium-high
-h = high
-e = extra
-v = very high
-u = ultra

These quality levels set the resampler parameters to:

filter phase = linear (50%)
anti-aliasing bandwidth percentage = 100 (no aliasing above the audio passband)

bandwidth, noise rejection, bit depth, and allowed passband rolloff are set according to this table:


quality
level
0 dB
bandwidth
-3 dB
bandwidth
noise
rejection
bit
depth
rolloff
allowed
-qn/an/a~30 dB160.35 dB
-l68%80%96 dB160.35 dB
-m91%95%96 dB160.35 dB
-g91%95%96 dB160.01 dB
-h91%95%120 dB200.01 dB
-e91%95%144 dB240.01 dB
-v91%95%168 dB280.01 dB
-u91%95%192 dB320.01 dB

The override-options parameters, if provided, will override the values in the above table. In the following list of override options, the options in each group are mutually exclusive. For example, you can use -s, or -b <n>, or -B <n>, or none of those three, but you cannot use any combination of -s, -b, and -B.

Quality:

  • -Q <0 .. 7> = optional numeric method of specifying quality; numerals correspond to q|l|m|g|h|e|v|u
Filter Phase:
  • -M = minimum (0%)
  • -I = intermediate (25%)
  • -L = linear (50%)
  • -p <0 .. 100> = specified percentage (values between 50 and 100 are unlikely to be useful)
Allow Aliasing:
  • -a = above the -3 dB audio passband
  • -A <85 .. 100> = above a specified bandwidth percentage
Bandwidth (Audio Passband Percentage):
  • -s = -3 dB 99% (steep filter)
  • -b <74 .. 99.7> = -3 dB percentage
  • -B <53 .. 99.5> = 0 dB percentage
Noise Rejection / Bit Depth:
  • -R <90 .. 200> = noise rejection dB
  • -d <15 .. 33> = bit depth
Passband Rolloff:
  • -f = 0 dB (no passband rolloff allowed)

The following override-options parameters are also supported, but they merely change the internal implementation of certain aspects of the resampler. They are for software testing and development, and are not intended to have any effect on the sound:

-t = use high-precision clock (i.e., use a double-precision floating-point number, rather than a fixed-point Q32.32 number, to express the ratio between output and input sample rates). Apparently intended for testing weird resampler use-cases like continuously variable sampling rates. Has no effect on C-3PO's sampling-rate conversions.

-i <-1 .. 2> = force a particular coefficient interpolator

-c <100 .. INT_MAX> = for certain values of the -i parameter, set maximum amount (in approximately kilobytes) of memory used for coefficients

-n: no small integer optimization
 
Top Bottom