Re: Fast factor 2 resampling



   Hi!

On Tue, Apr 18, 2006 at 05:39:30PM +0200, Tim Janik wrote:
> >/* --- resampling datahandles with the factor 2 --- */
> >GslDataHandle* bse_data_handle_new_upsample2 (GslDataHandle *src_handle, 
> >int precision_bits);
> >
> >instead of the old API
> >
> >GslDataHandle* bse_data_handle_new_upsample2 (GslDataHandle *src_handle);
> >
> >
> >But actually there is a case that is not covered very well (and can not
> >be covered with the code designed as it is right now), and thats
> >resampling files with small sample rate. When it comes to that, the
> >aliasing area that I've designed into the inaudible area (22050-26100 Hz
> >if we're resampling 44100 Hz recordings) moves down into the audible
> >area (for instance 11025-13050 Hz upsampling a 22050Hz recording with
> >factor 2).
> 
> sorry, i don't understand. can you elaborate o nwhat you mean with
> "aliasing area" here?

Suppose this is your original spectrum:


    # #
    ###
    #### #
    ######
    ######
--------------------> frequency
    |    |
    0    nyquist

Zero padding introduces a spectrum copy

    # #      # #
    ###      ###
    #### ## ####
    ############
    ############
--------------------> frequency
    |    |
    |    old nyquist
    0          | new nyquist

We now need to filter this, and using a half band filter for the task
means that we'll have an attenuation of -6dB (0.5 on a linear scale) at
the old nyquist frequency. Thus, there is an area which starts slightly
below the old nyquist frequency and ends slightly above the old nyquist
frequency which is not the same as the original signal.

Filter

    #### 
    ##### 
    ###### 
    ####### 
    ######## 
--------------------> frequency
    |   \---/
    |    aliasing area
    0          | new nyquist

Filtered signal:

    # # 
    ###  
    ####  
    ######
    #######
--------------------> frequency
    |   \---/  
    |    aliasing area
    0          | new nyquist

As you can see, some frequencies have been introduced which were not
present in the original signal, and some were reduced which were present
in the original signal. As long as the original sample rate is high,
this is not a problem, because you can not hear them. But if the
original sample rate is low, this is a problem.

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan



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