Bugs item #3590093, was opened at 2012-11-26 07:02
Message generated for change (Comment added) made by uklauer
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3590093&group_id=10706

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Guido Aulisi (tartina)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bad clipping using mcompand

Initial Comment:
When summing bands in mcompand I got some bad unnoticed clipping,
and the samples wrapped from positive to negative and viceversa.
With many bands sox_sample_t intergers get wrapped before being cast
to double.

I have a patch for this, I'll attach it.

----------------------------------------------------------------------

>Comment By: Ulrich Klauer (uklauer)
Date: 2013-02-17 09:00

Message:
Thank you for providing the patch, which I have now applied.

----------------------------------------------------------------------

Comment By: Guido Aulisi (tartina)
Date: 2012-12-10 02:56

Message:
I created a test file for this bug (sox-test.flac). If sox is unpatched I
get a bad clipping at sample 36298 (circa 0.823s) of the right channel
using mcompand; the sample is wrapped from negative to positive and sox
doesn't report the clipping. With the patch the sample remains at its most
negative number and sox reports the clipping. These are the 2 commands:

$ sox -V sox-test.flac out.wav mcompand ".08,.2 6:-90,-90,-20,-20,0,-10 4
-90" 200 ".04,.1 6:-90,-90,-20,-20,0,-10 4 -90"
sox:      SoX v14.4.0
sox INFO formats: detected file format type `flac'

Input File     : 'sox-test.flac'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:01.73 = 76149 samples = 129.505 CDDA sectors
File Size      : 194k
Bit Rate       : 899k
Sample Encoding: 16-bit FLAC
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox INFO sox: Overwriting `out.wav'

Output File    : 'out.wav'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:01.73 = 76149 samples = 129.505 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox INFO sox: effects chain: input        44100Hz  2 channels
sox INFO sox: effects chain: mcompand     44100Hz  2 channels
sox INFO sox: effects chain: dither       44100Hz  2 channels
sox INFO sox: effects chain: output       44100Hz  2 channels

--------------------------------------------------------------------------------

$ patched_sox -V sox-test.flac out_patched.wav mcompand ".08,.2
6:-90,-90,-20,-20,0,-10 4 -90" 200 ".04,.1 6:-90,-90,-20,-20,0,-10 4 -90"
sox:      SoX v14.4.0
sox INFO formats: detected file format type `flac'

Input File     : 'sox-test.flac'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:01.73 = 76149 samples = 129.505 CDDA sectors
File Size      : 194k
Bit Rate       : 899k
Sample Encoding: 16-bit FLAC
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no


Output File    : 'out_patched.wav'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:01.73 = 76149 samples = 129.505 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox INFO sox: effects chain: input        44100Hz  2 channels
sox INFO sox: effects chain: mcompand     44100Hz  2 channels
sox INFO sox: effects chain: dither       44100Hz  2 channels
sox INFO sox: effects chain: output       44100Hz  2 channels
sox WARN mcompand: mcompand clipped 1 samples; decrease volume?
sox WARN dither: dither clipped 1 samples; decrease volume?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3590093&group_id=10706

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to