Re: [ecasound] ecasound-2.5.2 wrongly displayes clipping info ?

From: Kai Vehmanen <kvehmanen@email-addr-hidden>
Date: Mon Sep 01 2008 - 22:32:21 EEST


On Mon, 1 Sep 2008, Sergei Steshenko wrote:

> It reports amplitude more or less in the place of a chain where
> -ev -evp can be found. This is probably by itself is not bad, though
> we are interested in possible clipping at the output, aren't we ?

that's correct (reports status at a specific position in the chain).
Originally I've used "-ev" to tune the input gain of live recording
sources, so that's what "-ev"'s clipping is most useful.

> I also think there is a bug:
> (audiofx) Peak amplitude, period: pos=0.99997 neg=0.99997.
> (audiofx) Peak amplitude, all : pos=0.99997 neg=0.99997.
> (audiofx) Clipped samples, period: pos=152 neg=59.
> (audiofx) Clipped samples, all : pos=152 neg=59.
> I think it's a bug because:
> 1) the amplitudes are OK, they are 32766 in terms of 16 bits audio,
> maximum is 32787;

Agreed, that's definitely misleading. This follows from my original use of
"-ev". With a ADC outputting fixed integer samples, it's impossible it's
to identify actual clipping from max-amplitude valid values. So "-ev" will
report values that are close to maximum as clipped (chainops process float
buffers, so it's values within 0.006% of max amplitude).

This was developed in 2000, when basicly all Linux sound drivers were
limited to 16bit fixed samples. The code still works today, but the
constants chosen of course are based on dated assumptions.

Nowadays, many soundcards (and their Linux drivers) can report clipping
via separate channels, making clipping detection much more reliable.

So one option would be to remove the "clipping detection" code altogether
from ecasound (as it's not as useful anymore, and potentially misleading).
An alternative implementation would be to relocate the code to
input/output stages (where samples are converted from/to to the internal
float sample format).

> 2) no conversion is made on sound yet, so there is no source of clipping
> in the chain yet;
> 3) there can be no higher than allowed amplitude from FLAC decoder
> because its output is short signed integer, not floating point.

Yes, this is true. When you have a source that cannot produce clipped
samples (like the flac decoder), "-ev" will report clipped samples
although the signal is fine. This is actually very likely for streams that
have normalized amplitude.

This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Ecasound-list mailing list
Received on Tue Sep 2 00:15:02 2008

This archive was generated by hypermail 2.1.8 : Tue Sep 02 2008 - 00:15:02 EEST