[beast/devel: 4/5] BSE: Make gslwaveosc work for 96k samples (fixes bug #612281).



commit 26ea7b5b00856d653ce54872f56aa97bf80037af
Author: Stefan Westerfeld <stefan space twc de>
Date:   Wed Jun 2 10:24:38 2010 +0200

    BSE: Make gslwaveosc work for 96k samples (fixes bug #612281).
    
    For a 96k sample, using a filter transition from 18kHz to 24kHz is not optimal
    because this transition band is quite steep, and thus the stopband ripple will
    be quite high. However, for a 96kHz sample we can set the start of the stopband
    to 48kHz, which results in a less steep filter, and better stopband rejection.
    This change improves stopband settings for any wave file with a sample rate >
    48 hHz.

 bse/gslwaveosc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/bse/gslwaveosc.c b/bse/gslwaveosc.c
index ffa907d..448f744 100644
--- a/bse/gslwaveosc.c
+++ b/bse/gslwaveosc.c
@@ -257,7 +257,7 @@ gsl_wave_osc_set_filter (GslWaveOscData *wosc,
 
   if (istep != wosc->istep)
     {
-      gfloat nyquist_fact = 2.0 * PI / wosc->mix_freq, cutoff_freq = 18000, stop_freq = 24000;
+      gfloat nyquist_fact = 2.0 * PI / wosc->mix_freq, cutoff_freq = 18000, stop_freq = MAX (wosc->wchunk->mix_freq / 2, 24000);
       gfloat empiric_filter_stability_limit = 6.;
       gfloat filt_fact = CLAMP (1. / step,
 				1. / (empiric_filter_stability_limit * zero_padding),
@@ -270,6 +270,7 @@ gsl_wave_osc_set_filter (GslWaveOscData *wosc,
 
       wosc->istep = istep;
       gsl_filter_tscheb2_lp (GSL_WAVE_OSC_FILTER_ORDER, freq_c, freq_r / freq_c, 0.18, wosc->a, wosc->b);
+
       /* Scale to compensate for zero-padding.
        * Adjust volume of the chunk according to its volume adjustment.
        */



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