amplitude wrap around

Tobias Kunze t@ulysses.Stanford.EDU
Mon, 24 Nov 1997 14:29:42 -0800


 | I don't think this would make anyone happy -- the sophisticated user
 | will grumble about complicated changes behind his back, the

guess im not a sophisticated user then.  my problem is that if you do the
statistics thing and then run another pass rescaled to 1/maxamp according
to statistics, you still run the risk of having to trash your output
because it wrapped.  The floating point statistics output is just not
accurate enough.  I understand the point about wanting to notice clips,
but I want to decide myself whether it bothers me or not.  I hate it
if the machine decides for me by making the soundfile unusable.

In my humble opinion, the csound approach is near-optimal:

  1) clip whenever a sample can't be represented (< -32768 or
     > 32767 in 16 bit linear) but treat amplitude values as balanced,
     (which translates easily into logical amplitudes by scaling)
  2) let the signal overflow by one in the negative before clipping
  3) give a summary of the number of samples clipped per channel,
     along with the maximum amplitude clipped, which gives you a
     reasonable idea.  Of course, a histogram wouldn't be bad either. :)

To me, wrapping around is always the worst choice.