Matlab get amount of clipping -


hi trying measure amount of clipped samples in audio files matlab. means want number of samples @ fullscale value (at min , max). should count them when there @ least 2 following samples @ value.

my code far:

for = 1 :20      filename = ['elektro',num2str(i) '.wav'];     unclipped = audioread(filename);     summemax = sum(1 ==unclipped);      summemin = sum(-1==unclipped);       summe = summemin +summemax;     str=sprintf('%d ',summe);     disp(str); end 

as see counting every sample , need loop , if statements detect if there more 1 sample @ fullscale value.

i tried loop j = 1 : length(unclipped) takes long method.

anyone have suggestions how this?

as @daniel pointed out in his answer previous question of yours, can find samples @ maximum reached by

maxreached = max(unclipped(:))==unclipped; 

to remove places maximum reached 1 sample, can use morphological opening structuring element [1,1]:

clippedsamples = imopen(maxreached, [1 1]); 

the number of clipped samples now

sum(clippedsamples); 

of course you'll have same samples minimum reached.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -