## audacity-nyquist

 Re: [Audacity-nyquist] Clipping with inversed polarity - From: Arnoud Onnink - 2008-12-25 06:12:07 ```Dear Dr. Nelson, Thank you for your reply. It is good to know the underlying cause of such artifacts. I have a basic understanding of digital systems and base-2, and I also have a cheap mixer which probably just doesn't properly correct for natural glitches such as this. But most importantly: do you think it is possible to use the relation you described in your reply as an alternative way for the Clipfix Nyquist plugin to restore or approximate the original signal? I'm not sure Nyquist supports direct binary operations on individual samples. I wish one could just buy programming experience instead of having to invest time... :-) Regards, Arnoud Dr. Gary Nelson, 24-12-2008 23:33:51: > >The largest positive number is 0111 1111 1111 1111 or 32767 in integer >format. If you add ONE to that number you get 32768 > >or > >1000 0000 0000 0000 which is a negative number. > >So it is totally normal to get this rather awful result that clipping >creates negative numbers. > > > >To finish the story, we convert a positive binary number to negative by >inverting all bits and adding one. > >0000 0000 0000 0111 is +7 in integer format. To create -7 we invert > >1111 1111 1111 1000 and add >+ 1 >1111 1111 1111 1001 is -7 in 2's complement > >It is necessary that +7 +(-7) = 0 >0000 0000 0000 0111 >1111 1111 1111 1001 >----------------------- >0000 0000 0000 0000 >so 2's complement works > >The max negative number is >0111 1111 1111 1111 ,inverted becomes >1000 0000 0000 0000 +1 > 1 >1000 0000 0000 0001 is negative max > >As an exercise, you can add positive max to negative max and get zero. > > > > > >Gary Nelson >Port Townsend, WA > ```