Re: UPDATE - Re: java coreaudio, missing methods
Re: UPDATE - Re: java coreaudio, missing methods
- Subject: Re: UPDATE - Re: java coreaudio, missing methods
- From: Wesley Miaw <email@hidden>
- Date: Wed, 3 Jul 2002 15:18:53 -0700
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.
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.
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.