[linux-audio-dev] Re: Bandlimited interpolation suitable for realtime audio

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Re: Bandlimited interpolation suitable for realtime audio
From: Julius Smith (jos_AT_w3k.org)
Date: ke syys   01 1999 - 19:29:29 EDT


Hi again,

>We want to create a free, flexible high- perf. audio engine for Linux
>see: http://www.angelfire.com/or/audiality/audiality.html ...

Excellent! This is really needed. I have a Linux system at home and it's my first choice for all my research related work.

>and it will provide a sample-playback engine with flexible modulation
>possibilities, that means we must allow dynamic pitch change during
>playback, therefore we can't use conversion filters.

I assume you mean _fixed_ conversion filters.

>Just for curiousity: Is the transposition range of the Emu samplers limited (downwards),
>since bandlimited interpolation CPU usage is determined by the resampling
>rate ? ( -2, -3 octaves ?)

I don't know. I don't own any Emu hardware myself at the moment, so I can't check it. However, I think I heard a demo taking a middling pitch all the way down to deep bass. What I would do if I were them is simply truncate the filter at some maximum length. The way the filter gets longer when going down is very simple: it merely "dilates" by the conversion ratio. This is implemented by scaling the step-size through the filter table by the inverse of this ratio. When the table starts stretching outrageously, one can simply end the table traversal when a prescribed number of samples has been returned. In the limit of driving the pitch all the way down to dc, the step-size goes to zero, and the returned filter becomes a simple "boxcar" moving-average filter at some maximum length set by the system --- not a great filter, but reasonable, and what else can you do that's better and less expensive? The ideal lowpass filter really is a constant impulse response, only infinitely long.

>... my concern is that if we oversample by 2,
>since we allow to sample-playback modules to be routed through various
>modules like FX-processors , filters etc, we have to run the entire engine
>at twice the samplefrequency, and this means twice the CPU load,
>Is there no other way to allow flexible voicerouting AND avoiding
>to run the entire engine at twice the samplefrequency ?

The oversampling need only affect the wavetables themselves. It just means doubling the memory over what you would have had. Consider, for example, how it would work if you somehow encoded the wavetables as exact continuous functions. In principle, they would be oversampled by infinity. However, the playback oscillator just asks for them at intervals of the current sampling period (which can change to any value at any time, without regard for the "phase alignment" of the sampling points).

>I think the overhead between linear and higher order polinomial
>interpolation is not very big compared to using bandlimited interpolation,
>(5-6 mulitiplications per sample is not very much)

Ok, but if you compare, I think you'll find that quadratic interpolation is not nearly as big of an improvement over linear as linear interpolation is over no interpolation. The reason is that if the wavetable is very "smooth" (which can always be provided by densely sampling the original bandlimited audio), then the exact "Taylor series expansion" (infinite-order polynomial interpolation, if you will), has coefficients which rapidly decrease with order. In other words, linear interpolation will nail it to the last LSB if your table is oversampled enough, so that there's no reason to waste multiply-adds on higher-order interpolation. (You may need a few guard bits below.) The main appendix in my "theory of operation" paper gives a precise derivation of what I'm saying for the case in which the wavetable contains a sinc function. In that case, linear interpolation is "exact" to working provision provided there are a few hundred samples per zero-crossing of the sinc function stored in the wavetable. In
 a general wavetable synthesizer, this spec could translate to some number of samples per zero-crossing of the _highest harmonic_ present in the wavetable. Of course, when the highest harmonic is very weak (as it normally is), requirements are really less stringent than this.

Another point is that if you're willing to spend 5-6 mulitiplications per sample on interpolation, I don't believe polynomial interpolation is superior to bandlimited interpolation at that complexity level. To compare them, we have to view polynomial interpolation in terms of its frequency response as a "bandlimited interpolation filter". (After all, both methods simply implement time-varying linear filters on the original samples, so on that level they are equivalent --- they only differ fundamentally in the coefficients used.) The classic paper on this topic is the one by Schafer and Rabiner cited in my tutorial:

@ARTICLE{SchaferAndRabiner,
        AUTHOR = "R. W. Schafer and L. R. Rabiner",
        TITLE = "A Digital Signal Processing Approach to Interpolation",
        JOURNAL = ieee_proc,
        VOLUME = 61,
        PAGES = {692--702},
        MONTH = "June",
        YEAR = 1973
}

>Has the Spline approach ( 4th order) some signal quality advantages
>(worst/best in terms of dB) over let's say quatratic/cubic interpolation ?
>(assuming a max transposition range of -2 octaves / +1 octave).

Well, it's order is one higher than cubic so it should be that much better than cubic. I consider all of these cases to fall under the topic of "Lagrange interpolation". An excellent reference, available online, is

@PHDTHESIS{VesaT,
        AUTHOR = "Vesa {V\"alim\"aki}",
        TITLE = "Discrete-Time Modeling of Acoustic Tubes Using
                Fractional Delay Filters",
        SCHOOL = "Report no. 37, Helsinki University of Technology, Faculty of \Elec\ \Eng,
                 \Lab\ of Acoustic and Audio Signal Processing, Espoo, Finland",
        MONTH = "Dec.",
        YEAR = 1995
}

It can be found online at

        http://www.acoustics.hut.fi/~vpv/publications/vesa_phd.html

In general, polynomial interpolation gives filters with a rapid roll-off (in gain versus frequency), but they exhibit a lot of "droop" at the edge of the passband. This means the highest harmonics will come out attenuated.

Ultimately, the question is how do you want to design the lowpass filter that guards against aliasing. The bandlimited interpolation formulation allows you to address that issue explicitly rather than just "getting what you get" with polynomial interpolation.

Julius


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:25:53 EST