0
votes

im trying to find out how much samples of an audio track are at the Fullscale Value (max and min Value). The Problem is, im new to matlab and dont know exactly the way to get my results.

The Problem is in the second line of my code. Is there a way to get the y value of a signal for every sample ? Or a method to get all the minimum and maximum values ? (findpeaks() dont't work because my signal is an audio file with two channels)

        unclipped = audioread(fileName);

        total= 0;
        values = YV(unclipped);
        for k = 1 : lenght(values)
            if values(k)== max(unclipped)
                total = total + 1;
            end    
                if values(k)== min(unclipped)
                total = total + 1;
            end    
        end 
        display (total);
1
Not sure what you want. unclipped already contains the amplitude, not sure what YV should do. There is a difference between maximum and peak, which do you want? - Daniel
I want to get the total number of samples at the min and max value.So I want to compare every sample with min and max - Benny Müller
Okay, then findpeaks is definitely not what you want. Do you want to use one maximum across both channels or use a separate maximum for each channel? What is the expected maximum count for unclipped=[0 .1;1 .1;1 .1;1 .1;1 .1;1 .1;]? - Daniel
One Maximum should do it. Expecting max sample counts from 0 to like 100.000 cause im doing this with 4*20 music files which are getting clipped. The files are normalized so max should be 0dB. - Benny Müller

1 Answers

0
votes
sum(max(unclipped(:))==unclipped))

Get the maximum and count how often your data is equal to the maximum.