Menu

#293 stats effect returns -inf if window is set to 0.36 seconds

open
nobody
None
5
2025-12-20
2017-05-11
No

The "stats" effect returns -inf for the "RMS Pk dB" value, only on e one particularl audio file, and only if the window parameter is set to .36 seconds.

If I set the window (-w) parameter to any other value (e.g. .359, .361, or leave it out so that it defaults to .1) then the output works perfectly.

I have hundreds of similar audio files, and this is the only file that exhibits this behavior. The stats effect works correctly wiht allthe other files.

This is 100% replicable on my machine.

The offending audio fiel is attached,

Here is the output:
kimsilverman$ sox -V -V 19-76.aiff -n stats -w .36
sox INFO sox: using SOX_OPTS=--buffer 4068
sox: SoX v14.4.2
time: Feb 22 2015 14:58:07
uname: Darwin il0103f-dhcp158.apple.com 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:34 PST 2017; root:xnu-3789.51.2~3/DEVELOPMENT_X86_64 x86_64
compiler: gcc 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)
arch: 1288 48 88 L
sox INFO formats: detected file format type `aiff'
sox DBUG aiff: Comment: "Processed by SoX"
sox INFO aiff: Unity MIDI Note: 0
sox INFO aiff: Low MIDI Note: 0
sox INFO aiff: High MIDI Note: 0

Input File : '19-76.aiff'
Channels : 1
Sample Rate : 16000
Precision : 16-bit
Duration : 00:00:01.80 = 28800 samples ~ 135 CDDA sectors
File Size : 57.7k
Bit Rate : 256k
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : big
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'

Output File : '' (null)
Channels : 1
Sample Rate : 16000
Precision : 16-bit
Duration : 00:00:01.80 = 28800 samples ~ 135 CDDA sectors

sox INFO sox: effects chain: input 16000Hz 1 channels (multi) 16 bits 00:00:01.80
sox INFO sox: effects chain: stats 16000Hz 1 channels 16 bits 00:00:01.80
sox INFO sox: effects chain: output 16000Hz 1 channels (multi) 16 bits 00:00:01.80
sox DBUG sox: start-up time = 0.000769
DC offset -0.000017
Min level -0.309479
Max level 0.330505
Pk lev dB -9.62
RMS lev dB -24.33
RMS Pk dB -inf
RMS Tr dB 3.01
Crest factor 5.44
Flat factor 0.00
Pk count 2
Bit-depth 15/16
Num samples 28.8k
Length s 1.800
Scale max 1.000000
Window s 0.360

1 Attachments

Discussion

  • Kim Silverman

    Kim Silverman - 2017-05-11

    Sorry for all the typos. Let me know if anything is unclear,

     
  • Martin Guy

    Martin Guy - 2025-12-20

    Found and fixed an out-by-one error when the window size in samples
    is exactly the same as the file length.
    https://codeberg.org/sox_ng/sox_ng/issues/561
    Thanks for reporting this

     

Log in to post a comment.

MongoDB Logo MongoDB