IPB

Welcome Guest ( Log In | Register )

SoX -1 produces clipped samples?
Morality124
post Oct 7 2012, 02:33
Post #1





Group: Members
Posts: 12
Joined: 27-November 11
Member No.: 95436



I was trying to invert the absolute phase of some audio files using SoX, and for one of those files SoX reports that 2 peaks have been clipped. This occurs with both the -v switch and the -vol effect. both set at exactly -1. When I set the amount to 0.9, clipping does not occur.

Why is this one file clipping at -1? Thanks.
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Dynamic
post Oct 7 2012, 03:18
Post #2





Group: Members
Posts: 793
Joined: 17-September 06
Member No.: 35307



QUOTE (Morality124 @ Oct 7 2012, 02:33) *
I was trying to invert the absolute phase of some audio files using SoX, and for one of those files SoX reports that 2 peaks have been clipped. This occurs with both the -v switch and the -vol effect. both set at exactly -1. When I set the amount to 0.9, clipping does not occur.

Why is this one file clipping at -1? Thanks.


This would be a pure inversion of normalised values, where the normalised range -1 to 0 to +1 is inverted to +1 to 0 to -1. (If you have waves more complicated than a continuous sinusoid in mind, forget phase, think polarity inversion, that's what's actually being done)

In non-floating point, e.g. 16-bit, signed value 0 is defined as zero - no audio, no DC component, so the range of allowed signed integer values goes from -32768 to +32767. Regardless of whether you define -1 to be -32768 or -32767, it's impossible to invert the -32768 to +32768 because the latter value is not permitted in 16-bit signed representation so it must be clipped to +32767. Setting volume scaling to 0.99996948 (=32767/32768) would be enough to prevent clipping (requires dither to decorrelate quantization noise). If you want mathematical perfection, the best way is to convert to floating point output, e.g. 32-bit float. Such minor clipping is almost certainly inaudible, however, if you just do what you already did.
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st April 2014 - 01:10