• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: AudioConverterFillBuffer - resampling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: AudioConverterFillBuffer - resampling


  • Subject: Fwd: AudioConverterFillBuffer - resampling
  • From: Chris Rogers <email@hidden>
  • Date: Wed, 3 Jul 2002 16:17:24 -0700

There *is* audible aliasing when doing extreme sample-rate conversion
(like from 44.1KHz down to 8KHz) when using the medium quality conversion
algorithm which is the default algorithm. In order to use the high-quality
one you need to set a property on the converter. Have a look in
AudioConverter.h at the kAudioConverterSampleRateConverterAlgorithm
property. Defined in AudioUnitProperties.h is the
kAudioUnitSRCAlgorithm_Polyphase constant for the higher-quality
algorithm. This should sound much better for your purposes. We *are*
interested in your impressions and opinions about the quality of
these algorithms as this is one area we may want to focus our
attention to improve quality and performance.

Chris Rogers
Core Audio
Apple Computer





Well, I couldn't use AudioConverterConvertBuffer because it returned -50 as an error code. I didn't know what this meant until someone else on the list mentioned that AudioConverterConvertBuffer expects integral decimation or interpolation factors. Which makes sense, since you pass in a fixed-size buffer and get out a fixed-size buffer.

So I tried calling AudioConverterFillBuffer whenever I needed the next block of 8kHz samples. I registered an AudioDeviceIOProc with the default input device and just dumped the raw data into a ring buffer (a trick someone else mentioned on here to avoid synchronization problems). Then the AudioConverterFillBuffer source callback would read out of that ring buffer. I saw that AudioConverterFillBuffer was calling the source callback a couple of times each time I needed another block of 8kHz samples. But the resulting audio sounded like it had aliasing problems.

Maybe it's because the filter used is not aggressive enough? I had to make my lowpass FIR filter have 1.5dB of passband ripple (0-3.7kHz) and 60dB of stopband attenuation (4.3kHz-...) with an input frequency of 44100 * 80 Hz. I was previously trying 2.5dB of passband ripple and 30dB of stopband attenuation but the aliasing was still bad.

Out of curiousity, how are the filters used by the resampling procedures decided upon? Is there a set of pre-defined filter coefficients used for common resampling choices? Or does one get dynamically generated the first time a specific sample rate conversion is attempted?

Also, what do you mean by high and medium quality resampling algorithms? I didn't find any reference to different quality resampling algorithms in the AudioConverter headers.


Date: Tue, 2 Jul 2002 16:48:15 -0700
From: Chris Rogers <email@hidden>

Actually, both of our resampling algorithms (high and medium quality)
perform filtering operations. I'm interested to learn more details
about the kind of problem you encountered.
I just ran into this problem. The AudioConverterConvertBuffer and
AudioConverterFillBuffer functions didn't work for me. (The former
because it only does integral resampling, the latter because it
doesn't pass the data through a filter before resampling. (I suppose
I could put the filter in the input callback, but it was easier for
me to just grab the library I mention in the next paragraph.)

So, to convert 44.1kHz down to 8kHz, I used a combination of the
open-source dspGuru resampling algorithms (http://www.dspguru.com/)
and Matlab to create a lowpass FIR filter. If you want to see my
efforts, along with the Matlab instructions, checkout Open Mash
(http://www.openmash.org/) from CVS and look in the
mash/audio/audio-macosx.[h|cc] and mash/audio/decim_3528kHz_8kHz.inc
files.

--
Wesley Miaw, Berkeley Multimedia Research Center
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: UPDATE - Re: java coreaudio, missing methods
  • Next by Date: Re: UPDATE - Re: java coreaudio, missing methods
  • Previous by thread: Re: Loginwindow crash on usb audio device plug/unplug
  • Next by thread: Re: Fwd: AudioConverterFillBuffer - resampling
  • Index(es):
    • Date
    • Thread