octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63440] [octave forge] (signal) sosfilt - NaN


From: Renato
Subject: [Octave-bug-tracker] [bug #63440] [octave forge] (signal) sosfilt - NaN
Date: Tue, 3 Jan 2023 04:34:13 -0500 (EST)

Follow-up Comment #4, bug #63440 (project octave):

Hi Charles,

Sorry for my late reply. I was on holiday.

I replaced the files zp2sos and sos2tf with your suggested ones and I noticed
the histogram of the audiofile generated is very different between the
original and the proposed changes.

Please test with this code:


sampling_rate = 44100;
length = 30;
hpf = 40;
lpf = 400;
crest_factor = 6;
filter_order = 4;
rounding = 4;

typenoise = noise((length/2)*sampling_rate, 1, 'pink');
[z, p, k] = butter(filter_order, [hpf/(sampling_rate/2),
lpf/(sampling_rate/2)]);
sos = zp2sos (z, p, k);
filtered = sosfilt(sos, typenoise);
normalized = filtered / (rms(filtered) / 10^(-crest_factor/20));

while crestfactor(normalized) > crest_factor
normalized(normalized > 0) = ((normalized(normalized > 0).^rounding) ./
((normalized(normalized > 0).^rounding) + 1)).^(1/rounding);
normalized(normalized < 0) = (((normalized(normalized < 0).^rounding) ./
((normalized(normalized < 0).^rounding) + 1)).^(1/rounding)) *-1;
rounding = rounding^2;
  if rounding > 100
    rounding = 100;
  endif
  normalized = normalized / (rms(normalized) / 10^(-crest_factor/20));
endwhile;

second_half = normalized * -1;
normalized = [[normalized]; [second_half]];

hist(normalized, 61);
xlabel('Amplitude');
ylabel('Samples');
grid on;


(file #54180, file #54181)

    _______________________________________________________

Additional Item Attachment:

File name: Histogram_original.png         Size:23 KB
    <https://file.savannah.gnu.org/file/Histogram_original.png?file_id=54180>

File name: Histogram_proposed_change.png  Size:23 KB
   
<https://file.savannah.gnu.org/file/Histogram_proposed_change.png?file_id=54181>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63440>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]