From 0950baa180d86de3ef0583846d163dbd1a5a3959 Mon Sep 17 00:00:00 2001 From: derselbst Date: Fri, 8 Nov 2024 23:16:59 +0100 Subject: [PATCH 01/12] add debug logging for iir filter --- src/rvoice/fluid_iir_filter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rvoice/fluid_iir_filter.c b/src/rvoice/fluid_iir_filter.c index b7e21a725..89f7020e9 100644 --- a/src/rvoice/fluid_iir_filter.c +++ b/src/rvoice/fluid_iir_filter.c @@ -140,6 +140,8 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_fres) iir_filter->fres = fres; iir_filter->last_fres = -1.; + + FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_fres: fres= %f [Hz]",fres); } static fluid_real_t fluid_iir_filter_q_from_dB(fluid_real_t q_dB) @@ -178,6 +180,8 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_q) fluid_iir_filter_t *iir_filter = obj; fluid_real_t q = param[0].real; int flags = iir_filter->flags; + + FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_q: Q= %f [dB]",q); if(flags & FLUID_IIR_Q_ZERO_OFF && q <= 0.0) { @@ -196,6 +200,7 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_q) q = fluid_iir_filter_q_from_dB(q); } + FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_q: Q= %f [linear]",q); iir_filter->q_lin = q; iir_filter->filter_gain = 1.0; @@ -324,7 +329,7 @@ void fluid_iir_filter_calc(fluid_iir_filter_t *iir_filter, fres = 5.f; } - // FLUID_LOG(FLUID_INFO, "%f + %f cents = %f cents = %f Hz | Q: %f", iir_filter->fres, fres_mod, iir_filter->fres + fres_mod, fres, iir_filter->q_lin); + FLUID_LOG(FLUID_DBG, "%f + %f cents = %f cents = %f Hz | Q: %f", iir_filter->fres, fres_mod, iir_filter->fres + fres_mod, fres, iir_filter->q_lin); /* if filter enabled and there is a significant frequency change.. */ if(iir_filter->type != FLUID_IIR_DISABLED && FLUID_FABS(fres - iir_filter->last_fres) > 0.01f) { From 32f69a4a412051249593bff758d59daee2ef0752 Mon Sep 17 00:00:00 2001 From: derselbst Date: Fri, 8 Nov 2024 23:17:25 +0100 Subject: [PATCH 02/12] Update comment --- src/rvoice/fluid_iir_filter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rvoice/fluid_iir_filter.h b/src/rvoice/fluid_iir_filter.h index 09e11f0b3..03d15d79d 100644 --- a/src/rvoice/fluid_iir_filter.h +++ b/src/rvoice/fluid_iir_filter.h @@ -58,7 +58,7 @@ struct _fluid_iir_filter_t Else it changes smoothly. */ fluid_real_t fres; /* the resonance frequency, in cents (not absolute cents) */ - fluid_real_t last_fres; /* Current resonance frequency of the IIR filter */ + fluid_real_t last_fres; /* Current resonance frequency of the IIR filter in Hz */ /* Serves as a flag: A deviation between fres and last_fres */ /* indicates, that the filter has to be recalculated. */ fluid_real_t q_lin; /* the q-factor on a linear scale */ From 39d4103a9cdc941a1cf2f0b55aa9c39dc136adaa Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 9 Nov 2024 00:35:07 +0100 Subject: [PATCH 03/12] Add a manual test suite with test files from 1417 and 1415 --- test/CMakeLists.txt | 43 ++++++++++++++++++ .../The Nervous Filter trimmed.mid | Bin 0 -> 3018 bytes .../The Nervous Filter.mid | Bin 0 -> 24450 bytes .../filter-envelope-noise.mid | Bin 0 -> 662 bytes 4 files changed, 43 insertions(+) create mode 100644 test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.mid create mode 100644 test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter.mid create mode 100755 test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise.mid diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a1b1b80e2..195725045 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -43,3 +43,46 @@ if ( LIBSNDFILE_HASVORBIS ) ADD_FLUID_TEST(test_sf3_sfont_loading) ADD_FLUID_SF_DUMP_TEST(VintageDreamsWaves-v2.sf3) endif ( LIBSNDFILE_HASVORBIS ) + + +# Prepare the manual test suite down here +if(NOT DEFINED GENERAL_USER_GS2) + add_custom_target(check_manual + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "In order to run the manual test suite, you need to set variable GENERAL_USER_GS2 to the path of the soundfont.") +else() + + set(IIR_FILTER_RENDER_DIR "${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/") + + if(LIBSNDFILE_SUPPORT) + set(FEXT "wav") + else() + set(FEXT "raw") + endif() + + # Add an empty pseudo target + add_custom_target(check_manual) + + add_custom_target(create_iir_dir + COMMAND ${CMAKE_COMMAND} -E make_directory ${IIR_FILTER_RENDER_DIR}) + + add_custom_target(render1415 + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/1415_the-nervous-filter.${FEXT} "The Nervous Filter trimmed.mid" ${GENERAL_USER_GS2} + COMMENT "Rendering testfile of issue 1415" + DEPENDS fluidsynth create_iir_dir + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1415_the-nervous-filter/ + VERBATIM + ) + + add_custom_target(render1417 + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/1417_filter-envelope-noise.${FEXT} filter-envelope-noise.mid ${GENERAL_USER_GS2} + COMMENT "Rendering testfile of issue 1417" + DEPENDS fluidsynth create_iir_dir + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1417_filter-envelope-noise/ + VERBATIM + ) + + # Add a dependency so that rendering targets depends on check_manual + add_dependencies(check_manual render1415) + add_dependencies(check_manual render1417) + +endif() diff --git a/test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.mid b/test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed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A{nCSI@KOV7n6#|{#%m9X_Ig$VzP#nskrVIywS8)i^8A7u~H(pi+n z>Ng^-mXo^?%Dm|>o0=%dwbSr^zj#{+RdPRPG`$qYMP(qgyv zw+@V+iZl;B#B2~|Gg@BA$i(i1=8p=pU*{n6WSYs>jLcG<5=DDb0ZM3moCU_8NJ@5g zVh8eH>T4v1++*J44&)o#$4NjE&21si>+h2U@^#8LN*w8pZ$ZA=*!a?99)>5SXb|R{ zd3sIv6%*JU$e&ZbUXny^A>kWKVz;>gozn$lX8nI+y|jd`=pM+c_3OzH|FCyP9|F*oNxou9T!H~Kxd8lr#@hozb1=Xx6Gb@=EA8cpm=p2*FV7

QTrE0AZ6dkhI!2!iJ0i%P@ci(GS0gB3jss=+73q^579_sj zjSaa#?uRSPf{pv|6njDv;otX`Zk|klP`4_+>*p)2;B^EwI8CS~_RM*o>LNk^(b*M*hks%nBBP Z+*GeBEH6DJG!Y0CkozxDLGfWk{0}uV+J*oC literal 0 HcmV?d00001 diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise.mid b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise.mid new file mode 100755 index 0000000000000000000000000000000000000000..f23e0af9af1c3c184f674e9788e04d6abe687cc5 GIT binary patch literal 662 zcmXX^O;6iE5Zxp|5tm+wS~!$QpsHvq0}9q6%eCZM3O+Q4wy2~u4oQfUIR3;mxp3%? z6ZO#3{DuC5{sjJ6I-79v^Lz8&?CfmwYCK?!ZLtz7SDuBvt?^zqx^cCEk9RY{H?L&30r&0pV&XP&7R&qfBsaFcZ#~?1Gq-rD|VzF z6A~jrBAqvpcM0+M5%o6Aq@Kb)ihjYQNMI9&KC}VeR z)R4!;2g$=@Y6Q`9RttJkM4+M3EsmuT&-YODiV`{JhiJ9oT3R6-q3uzwJ)&IajyNYK z&bnEv8rnTdu?KWErw`wxlfVf!y5wl&aDnb*VM*7gvD{!$m+rWzqMI$=D0GgED8tKF zuqiKxRoTekC6e8dP6|D=lLe#PqK$SikEGo$T(tAWuC#v?J80cfoi%|&G<`zmgd8+~ zQ_X*bVyGrd!9i0^VTKtR9%v+fMLvQH$&)&YTVh1wq0v&(a2I(WKCbRabSP6y4$x>* zu@N6250w Date: Sat, 9 Nov 2024 00:41:35 +0100 Subject: [PATCH 04/12] opt --- test/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 195725045..eb3227ae0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,7 +51,7 @@ if(NOT DEFINED GENERAL_USER_GS2) COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "In order to run the manual test suite, you need to set variable GENERAL_USER_GS2 to the path of the soundfont.") else() - set(IIR_FILTER_RENDER_DIR "${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/") + set(IIR_FILTER_RENDER_DIR "${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter") if(LIBSNDFILE_SUPPORT) set(FEXT "wav") @@ -66,7 +66,7 @@ else() COMMAND ${CMAKE_COMMAND} -E make_directory ${IIR_FILTER_RENDER_DIR}) add_custom_target(render1415 - COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/1415_the-nervous-filter.${FEXT} "The Nervous Filter trimmed.mid" ${GENERAL_USER_GS2} + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${IIR_FILTER_RENDER_DIR}/1415_the-nervous-filter.${FEXT} "The Nervous Filter trimmed.mid" ${GENERAL_USER_GS2} COMMENT "Rendering testfile of issue 1415" DEPENDS fluidsynth create_iir_dir WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1415_the-nervous-filter/ @@ -74,7 +74,7 @@ else() ) add_custom_target(render1417 - COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${CMAKE_CURRENT_BINARY_DIR}/manual/iir_filter/1417_filter-envelope-noise.${FEXT} filter-envelope-noise.mid ${GENERAL_USER_GS2} + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${IIR_FILTER_RENDER_DIR}/1417_filter-envelope-noise.${FEXT} filter-envelope-noise.mid ${GENERAL_USER_GS2} COMMENT "Rendering testfile of issue 1417" DEPENDS fluidsynth create_iir_dir WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1417_filter-envelope-noise/ From b1a7910e822952092b822b7be5fae7d4978b3d93 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 9 Nov 2024 00:48:11 +0100 Subject: [PATCH 05/12] Add an interactive Bode plot matlab script --- .../iir_filter/interactive_biquad_lowpass.m | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 test/manual/iir_filter/interactive_biquad_lowpass.m diff --git a/test/manual/iir_filter/interactive_biquad_lowpass.m b/test/manual/iir_filter/interactive_biquad_lowpass.m new file mode 100644 index 000000000..0c53abec7 --- /dev/null +++ b/test/manual/iir_filter/interactive_biquad_lowpass.m @@ -0,0 +1,86 @@ +# +# This Matlab script implements an interactive Bode plot of fluidsynth's IIR filter. +# To run it, just call interactive_biquad_lowpass() and a window will open up, allowing +# you to adjust the cutoff frequency and Q. +# Note that Q is in linear range here! +# +function interactive_biquad_lowpass() + % Initial values + f_c = 1000; % Initial cutoff frequency in Hz + Q = 0.707; % Initial quality factor + f_s = 48000; % Sampling frequency in Hz + + % Create the figure + hFig = figure('Name', 'Interactive Biquad Lowpass Filter', 'NumberTitle', 'off'); + + % Create axes for the magnitude and phase plots + hAxesMag = subplot(2, 1, 1, 'Parent', hFig); + hAxesPhase = subplot(2, 1, 2, 'Parent', hFig); + + % Plot the initial response + plot_response(hAxesMag, hAxesPhase, f_c, Q, f_s); + + % Create slider for cutoff frequency + uicontrol('Style', 'text', 'Position', [20 20 150 20], 'String', 'Cutoff Frequency (Hz)'); + hSliderFc = uicontrol('Style', 'slider', 'Min', 100, 'Max', 20000, 'Value', f_c, ... + 'Position', [20 40 300 20]); + hTextFc = uicontrol('Style', 'text', 'Position', [330 40 50 20], 'String', num2str(f_c)); + + % Create slider for quality factor + uicontrol('Style', 'text', 'Position', [20 80 150 20], 'String', 'Quality Factor (Q)'); + hSliderQ = uicontrol('Style', 'slider', 'Min', 0.1, 'Max', 100, 'Value', Q, ... + 'Position', [20 100 300 20]); + hTextQ = uicontrol('Style', 'text', 'Position', [330 100 50 20], 'String', num2str(Q)); + + % Add listeners for both sliders + addlistener(hSliderFc, 'Value', 'PreSet', @(src, event) update_plot(hAxesMag, hAxesPhase, hSliderFc, hSliderQ, f_s, hTextFc, hTextQ)); + addlistener(hSliderQ, 'Value', 'PreSet', @(src, event) update_plot(hAxesMag, hAxesPhase, hSliderFc, hSliderQ, f_s, hTextFc, hTextQ)); +end + +function update_plot(hAxesMag, hAxesPhase, hSliderFc, hSliderQ, f_s, hTextFc, hTextQ) + % Get the current values from the sliders + f_c = get(hSliderFc, 'Value'); + Q = get(hSliderQ, 'Value'); + + % Update the text displays + set(hTextFc, 'String', num2str(f_c, '%.1f')); % Display cutoff frequency + set(hTextQ, 'String', num2str(Q, '%.2f')); % Display quality factor + + % Update the plot with the new values + plot_response(hAxesMag, hAxesPhase, f_c, Q, f_s); +end + +function plot_response(hAxesMag, hAxesPhase, f_c, Q, f_s) + % Design the biquad lowpass filter + w0 = 2 * pi * f_c / f_s; + alpha = sin(w0) / (2 * Q); + + b0 = (1 - cos(w0)) / 2; + b1 = 1 - cos(w0); + b2 = (1 - cos(w0)) / 2; + a0 = 1 + alpha; + a1 = -2 * cos(w0); + a2 = 1 - alpha; + + % Normalize coefficients + b = [b0 / a0, b1 / a0, b2 / a0]; + a = [1, a1 / a0, a2 / a0]; + + % Compute the frequency response + [h, w] = freqz(b, a, 1024, f_s); + + % Clear the axes and plot the new response + cla(hAxesMag); + plot(hAxesMag, w, 20*log10(abs(h))); + title(hAxesMag, 'Magnitude Response'); + xlabel(hAxesMag, 'Frequency (Hz)'); + ylabel(hAxesMag, 'Magnitude (dB)'); + grid(hAxesMag, 'on'); + + cla(hAxesPhase); + plot(hAxesPhase, w, angle(h) * (180/pi)); + title(hAxesPhase, 'Phase Response'); + xlabel(hAxesPhase, 'Frequency (Hz)'); + ylabel(hAxesPhase, 'Phase (degrees)'); + grid(hAxesPhase, 'on'); +end From 261fb3144e4f608adee68de120932210ac2d8fed Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 9 Nov 2024 12:08:05 +0100 Subject: [PATCH 06/12] Add a test for issue 1424 --- test/CMakeLists.txt | 9 +++++++++ .../1424_clicks-on-ModEnv-FilterFc-change/1424.mid | Bin 0 -> 69 bytes 2 files changed, 9 insertions(+) create mode 100644 test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/1424.mid diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb3227ae0..6aef91a2e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -81,8 +81,17 @@ else() VERBATIM ) + add_custom_target(render1424 + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${IIR_FILTER_RENDER_DIR}/1424_clicks-on-ModEnv-FilterFc-change.${FEXT} 1424.mid echo_drops.sf2 + COMMENT "Rendering testfile of issue 1424" + DEPENDS fluidsynth create_iir_dir + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/ + VERBATIM + ) + # Add a dependency so that rendering targets depends on check_manual add_dependencies(check_manual render1415) add_dependencies(check_manual render1417) + add_dependencies(check_manual render1424) endif() diff --git a/test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/1424.mid b/test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/1424.mid new file mode 100644 index 0000000000000000000000000000000000000000..a65a2ef36a70249b1190d193fefeb3aea094ef9e GIT binary patch literal 69 zcmeYb$w*;fU|<7cM#cu;kfLlLOP}FCGkZu;Vsf^EA;W<*hW~-g>z literal 0 HcmV?d00001 From 810be2aaf60a817f826157d92fa142c4be53aca4 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 9 Nov 2024 16:03:00 +0100 Subject: [PATCH 07/12] add binary files to git lfs --- .../The Nervous Filter trimmed.ogg | 3 +++ .../filter envelope-noise-Roland SC8820.flac | 3 +++ .../filter-envelope-noise-1345 reverted.flac | 3 +++ .../filter-envelope-noise-FluidSynth 2.4.flac | 3 +++ .../filter-envelope-noise.mid | Bin 662 -> 128 bytes .../echo_drops.sf2 | 3 +++ 6 files changed, 15 insertions(+) create mode 100644 test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.ogg create mode 100755 test/manual/iir_filter/1417_filter-envelope-noise/filter envelope-noise-Roland SC8820.flac create mode 100755 test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-1345 reverted.flac create mode 100755 test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-FluidSynth 2.4.flac create mode 100644 test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/echo_drops.sf2 diff --git a/test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.ogg b/test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.ogg new file mode 100644 index 000000000..d834a7118 --- /dev/null +++ b/test/manual/iir_filter/1415_the-nervous-filter/The Nervous Filter trimmed.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f76d1efe07305045b1c2add718b2bf682f76043bae5bca743372e560cb21974 +size 89539 diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/filter envelope-noise-Roland SC8820.flac b/test/manual/iir_filter/1417_filter-envelope-noise/filter envelope-noise-Roland SC8820.flac new file mode 100755 index 000000000..08322a487 --- /dev/null +++ b/test/manual/iir_filter/1417_filter-envelope-noise/filter envelope-noise-Roland SC8820.flac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bea148b158f8932b8ca74d4e1246492115d01361c2192156c41820388cee6b9e +size 406106 diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-1345 reverted.flac b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-1345 reverted.flac new file mode 100755 index 000000000..3abd442cf --- /dev/null +++ b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-1345 reverted.flac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62579bbbaab0ae97b873e666102741a72e05bd6322c4c8fb64dbc8062def73f1 +size 415449 diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-FluidSynth 2.4.flac b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-FluidSynth 2.4.flac new file mode 100755 index 000000000..79dd125fb --- /dev/null +++ b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise-FluidSynth 2.4.flac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:415e71eff4668d1d6261a652cacee2ead5202637b40bd87f2a2cd3cf488c8a11 +size 472080 diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise.mid b/test/manual/iir_filter/1417_filter-envelope-noise/filter-envelope-noise.mid index f23e0af9af1c3c184f674e9788e04d6abe687cc5..d0cae2d09b8a2271ef451a15ae951dfed665edfd 100755 GIT binary patch literal 128 zcmWN?K@!3s3;@78uiyg~650U$4bULWsB{eW;OliSd+}TPcd literal 662 zcmXX^O;6iE5Zxp|5tm+wS~!$QpsHvq0}9q6%eCZM3O+Q4wy2~u4oQfUIR3;mxp3%? z6ZO#3{DuC5{sjJ6I-79v^Lz8&?CfmwYCK?!ZLtz7SDuBvt?^zqx^cCEk9RY{H?L&30r&0pV&XP&7R&qfBsaFcZ#~?1Gq-rD|VzF z6A~jrBAqvpcM0+M5%o6Aq@Kb)ihjYQNMI9&KC}VeR z)R4!;2g$=@Y6Q`9RttJkM4+M3EsmuT&-YODiV`{JhiJ9oT3R6-q3uzwJ)&IajyNYK z&bnEv8rnTdu?KWErw`wxlfVf!y5wl&aDnb*VM*7gvD{!$m+rWzqMI$=D0GgED8tKF zuqiKxRoTekC6e8dP6|D=lLe#PqK$SikEGo$T(tAWuC#v?J80cfoi%|&G<`zmgd8+~ zQ_X*bVyGrd!9i0^VTKtR9%v+fMLvQH$&)&YTVh1wq0v&(a2I(WKCbRabSP6y4$x>* zu@N6250w Date: Sat, 16 Nov 2024 15:38:11 +0100 Subject: [PATCH 08/12] Add testfiles for 1427 --- test/CMakeLists.txt | 8 ++++++++ .../iir_filter/1427_high-Q-note-cutoff/.gitattributes | 3 +++ .../1427_high-Q-note-cutoff/fluidsynth_iir-tests.flac | 3 +++ .../1427_high-Q-note-cutoff/high_Q_note_cutoff_test.mid | 3 +++ .../1427_high-Q-note-cutoff/high_Q_note_cutoff_test.sf2 | 3 +++ 5 files changed, 20 insertions(+) create mode 100644 test/manual/iir_filter/1427_high-Q-note-cutoff/.gitattributes create mode 100755 test/manual/iir_filter/1427_high-Q-note-cutoff/fluidsynth_iir-tests.flac create mode 100755 test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.mid create mode 100755 test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.sf2 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6aef91a2e..66aa5cce0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -89,6 +89,14 @@ else() VERBATIM ) + add_custom_target(render1427 + COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${IIR_FILTER_RENDER_DIR}/1427_high-Q-note-cutoff.${FEXT} high_Q_note_cutoff_test.mid high_Q_note_cutoff_test.sf2 + COMMENT "Rendering testfile of issue 1427" + DEPENDS fluidsynth create_iir_dir + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1427_high-Q-note-cutoff/ + VERBATIM + ) + # Add a dependency so that rendering targets depends on check_manual add_dependencies(check_manual render1415) add_dependencies(check_manual render1417) diff --git a/test/manual/iir_filter/1427_high-Q-note-cutoff/.gitattributes b/test/manual/iir_filter/1427_high-Q-note-cutoff/.gitattributes new file mode 100644 index 000000000..26fae88dd --- /dev/null +++ b/test/manual/iir_filter/1427_high-Q-note-cutoff/.gitattributes @@ -0,0 +1,3 @@ +high_Q_note_cutoff_test.sf2 filter=lfs diff=lfs merge=lfs -text +fluidsynth_iir-tests.flac filter=lfs diff=lfs merge=lfs -text +high_Q_note_cutoff_test.mid filter=lfs diff=lfs merge=lfs -text diff --git a/test/manual/iir_filter/1427_high-Q-note-cutoff/fluidsynth_iir-tests.flac b/test/manual/iir_filter/1427_high-Q-note-cutoff/fluidsynth_iir-tests.flac new file mode 100755 index 000000000..c74958755 --- /dev/null +++ b/test/manual/iir_filter/1427_high-Q-note-cutoff/fluidsynth_iir-tests.flac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c198b5b32c3a8516f049c4e7e6cfee764b0855595fdda46750f92c614808d940 +size 224675 diff --git a/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.mid b/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.mid new file mode 100755 index 000000000..a882f2b7e --- /dev/null +++ b/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.mid @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d17f36961affa6f913a40398800b58872bc4a4d57019a8467dce72715950d8c8 +size 100 diff --git a/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.sf2 b/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.sf2 new file mode 100755 index 000000000..669d6d257 --- /dev/null +++ b/test/manual/iir_filter/1427_high-Q-note-cutoff/high_Q_note_cutoff_test.sf2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6636a4c9344de49c7b040017f1e0381c95150a2cf5d0f6a3b1178a154bbc7064 +size 235772 From f11ef8f865c5f2dedf4953c22e2a9ea1cf672bd2 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 16 Nov 2024 15:38:58 +0100 Subject: [PATCH 09/12] Add missing git attr files --- .../manual/iir_filter/1415_the-nervous-filter/.gitattributes | 4 ++++ .../iir_filter/1417_filter-envelope-noise/.gitattributes | 5 +++++ .../1424_clicks-on-ModEnv-FilterFc-change/.gitattributes | 1 + 3 files changed, 10 insertions(+) create mode 100644 test/manual/iir_filter/1415_the-nervous-filter/.gitattributes create mode 100644 test/manual/iir_filter/1417_filter-envelope-noise/.gitattributes create mode 100644 test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/.gitattributes diff --git a/test/manual/iir_filter/1415_the-nervous-filter/.gitattributes b/test/manual/iir_filter/1415_the-nervous-filter/.gitattributes new file mode 100644 index 000000000..6f4a0fef5 --- /dev/null +++ b/test/manual/iir_filter/1415_the-nervous-filter/.gitattributes @@ -0,0 +1,4 @@ +*.ogg filter=lfs diff=lfs merge=lfs -text +*.flac filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +*.sf2 filter=lfs diff=lfs merge=lfs -text diff --git a/test/manual/iir_filter/1417_filter-envelope-noise/.gitattributes b/test/manual/iir_filter/1417_filter-envelope-noise/.gitattributes new file mode 100644 index 000000000..6a0d372f1 --- /dev/null +++ b/test/manual/iir_filter/1417_filter-envelope-noise/.gitattributes @@ -0,0 +1,5 @@ +filter-envelope-noise-1345[[:space:]]reverted.flac filter=lfs diff=lfs merge=lfs -text +filter-envelope-noise-FluidSynth[[:space:]]2.4.flac filter=lfs diff=lfs merge=lfs -text +filter-envelope-noise.mid filter=lfs diff=lfs merge=lfs -text +*.flac filter=lfs diff=lfs merge=lfs -text +*.sf2 filter=lfs diff=lfs merge=lfs -text diff --git a/test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/.gitattributes b/test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/.gitattributes new file mode 100644 index 000000000..4be35afce --- /dev/null +++ b/test/manual/iir_filter/1424_clicks-on-ModEnv-FilterFc-change/.gitattributes @@ -0,0 +1 @@ +echo_drops.sf2 filter=lfs diff=lfs merge=lfs -text From 67c104e1e2883974e54ea52079cec41e9a616cb3 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 16 Nov 2024 15:48:22 +0100 Subject: [PATCH 10/12] Adjust gain --- test/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 66aa5cce0..3ce90a3b2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -90,7 +90,7 @@ else() ) add_custom_target(render1427 - COMMAND fluidsynth -R 0 -C 0 -g 1 -F ${IIR_FILTER_RENDER_DIR}/1427_high-Q-note-cutoff.${FEXT} high_Q_note_cutoff_test.mid high_Q_note_cutoff_test.sf2 + COMMAND fluidsynth -R 0 -C 0 -g 5 -F ${IIR_FILTER_RENDER_DIR}/1427_high-Q-note-cutoff.${FEXT} high_Q_note_cutoff_test.mid high_Q_note_cutoff_test.sf2 COMMENT "Rendering testfile of issue 1427" DEPENDS fluidsynth create_iir_dir WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/manual/iir_filter/1427_high-Q-note-cutoff/ @@ -101,5 +101,6 @@ else() add_dependencies(check_manual render1415) add_dependencies(check_manual render1417) add_dependencies(check_manual render1424) + add_dependencies(check_manual render1427) endif() From 9e9c51c04b20bafa697db23153557fa923c0d2fe Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 16 Nov 2024 15:51:08 +0100 Subject: [PATCH 11/12] Revert "add debug logging for iir filter" This reverts commit 0950baa180d86de3ef0583846d163dbd1a5a3959. --- src/rvoice/fluid_iir_filter.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/rvoice/fluid_iir_filter.c b/src/rvoice/fluid_iir_filter.c index 89f7020e9..b7e21a725 100644 --- a/src/rvoice/fluid_iir_filter.c +++ b/src/rvoice/fluid_iir_filter.c @@ -140,8 +140,6 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_fres) iir_filter->fres = fres; iir_filter->last_fres = -1.; - - FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_fres: fres= %f [Hz]",fres); } static fluid_real_t fluid_iir_filter_q_from_dB(fluid_real_t q_dB) @@ -180,8 +178,6 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_q) fluid_iir_filter_t *iir_filter = obj; fluid_real_t q = param[0].real; int flags = iir_filter->flags; - - FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_q: Q= %f [dB]",q); if(flags & FLUID_IIR_Q_ZERO_OFF && q <= 0.0) { @@ -200,7 +196,6 @@ DECLARE_FLUID_RVOICE_FUNCTION(fluid_iir_filter_set_q) q = fluid_iir_filter_q_from_dB(q); } - FLUID_LOG(FLUID_DBG, "fluid_iir_filter_set_q: Q= %f [linear]",q); iir_filter->q_lin = q; iir_filter->filter_gain = 1.0; @@ -329,7 +324,7 @@ void fluid_iir_filter_calc(fluid_iir_filter_t *iir_filter, fres = 5.f; } - FLUID_LOG(FLUID_DBG, "%f + %f cents = %f cents = %f Hz | Q: %f", iir_filter->fres, fres_mod, iir_filter->fres + fres_mod, fres, iir_filter->q_lin); + // FLUID_LOG(FLUID_INFO, "%f + %f cents = %f cents = %f Hz | Q: %f", iir_filter->fres, fres_mod, iir_filter->fres + fres_mod, fres, iir_filter->q_lin); /* if filter enabled and there is a significant frequency change.. */ if(iir_filter->type != FLUID_IIR_DISABLED && FLUID_FABS(fres - iir_filter->last_fres) > 0.01f) { From 9b480674c11e8863608e1512c56223c06d1906b5 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 16 Nov 2024 15:51:52 +0100 Subject: [PATCH 12/12] Revert "Update comment" This reverts commit 32f69a4a412051249593bff758d59daee2ef0752. --- src/rvoice/fluid_iir_filter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rvoice/fluid_iir_filter.h b/src/rvoice/fluid_iir_filter.h index 03d15d79d..09e11f0b3 100644 --- a/src/rvoice/fluid_iir_filter.h +++ b/src/rvoice/fluid_iir_filter.h @@ -58,7 +58,7 @@ struct _fluid_iir_filter_t Else it changes smoothly. */ fluid_real_t fres; /* the resonance frequency, in cents (not absolute cents) */ - fluid_real_t last_fres; /* Current resonance frequency of the IIR filter in Hz */ + fluid_real_t last_fres; /* Current resonance frequency of the IIR filter */ /* Serves as a flag: A deviation between fres and last_fres */ /* indicates, that the filter has to be recalculated. */ fluid_real_t q_lin; /* the q-factor on a linear scale */