enhanced aac+ to aac lc
Reply #11 – 2012-11-05 18:30:18
Thats' from the 3gpp code isn't it? I think the intention of spline_resampler.c is to allow handsets whose DACs don't support the rate of a received file to downsample to a supported rate. As you want to upsample, I'm not sure this code is directly applicable, but I haven't looked into it. With downsampling, you need to filter first to remove frequencies above the Nyquist limit, then interpolate to the new, lower sampling rate. With upsampling, you need to interpolate to the new higher sampling rate then filter afterwards to remove any frequencies that have been introduced above the Nyquist limit of the lower rate. In theory, which ever way you're going between the same pair of sampling rates (up or down), the cut-off frequency should be the same, assuming an ideal filter. The speex resampler code looks useful, seems to have a liberal license, works for arbitrary rates, and it implements upsampling intelligently, in that it recognises that the filter design for downsampling must ensure good attenuation at and above the Nyquist limit, but for upsampling , the content is already low on content very close to the Nyquist limit and zero above it until you introduce aliasing by your chosen method of interpolation, so they can be more relaxed about the attenuation close to the limit and preserve audio frequencies better by choosing a slightly higher cut-off frequency when upsampling than they do when downsampling. It also offers FIXED POINT or FLOATING POINT versions, which you can choose depending on your hardware, and I believe it has been tested when compiled for numerous popular platforms (certainly the Opus source code which includes the same resampler has been tested very widely prior to IETF standardization) The speex one calculates the sinc function on the fly, calculates the cut-off mathematically but has a number of Kaiser window functions pre-calculated in the source code, but it includes some values for adjusting the filter cut-off frequency for upsampling versus downsampling. It can essentially be treated as a black box that just does the job without having to understand how. (P.S. That's the right SoX project you linked to a few posts above, and their resampling code has been implemented in a fb2k plugin which you mentioned in the other link. Some people get very picky about inaudible differences that can show up on graphs, where SoX resampler performs very well. I doubt there's an audible difference from fb2k's PPHS resampler or speex's for normal sampling rates. I guess there's a modest chance of slight audibility when upsampling from very low sample rates such as 8kHz.)