Re: usb mic problem
Re: usb mic problem
- Subject: Re: usb mic problem
- From: Michael Thornburgh <email@hidden>
- Date: Thu, 10 May 2007 22:22:28 -0700
i suspect two things are happening:
thing #1: your code is making assumptions about the sampling rate
and/or number of channels of the input and output devices, rather
than interrogating them just-in-time and doing sample rate conversion
and channel filling/truncation, if necessary;
thing #2: the USB audio device has no serial number, so its UID is
formed from its USB address (which will change depending on which
port it's plugged into), and the system has different saved
configurations for the different UIDs, which are being set when the
device is attached. use "/Applications/Utilities/Audio MIDI
Setup.app" to examine the device when it's attached to the different
ports -- i bet you'll see different sampling rates or numbers of
channels.
your app shouldn't attempt to set the sampling rate of the device.
under normal circumstances, only the user should do that, and then
typically only from Audio MIDI Setup. instead, you should adapt to
the sampling rate of the device and do sample rate conversion to the
rate(s) you need. plus, not all devices' sampling rates can be
changed (either at all, or to the specific rate you might want). in
previous mail to you and the list, i recommended using
MTConversionBuffers (since you're already using MTCoreAudio), which
can be found in the AudioMonitor sample app. here's a link to an
earlier message on this list where we were talking about this stuff,
and i included a link to universal binary and sources for my under-
development version of MTCoreAudio, which has betterness over the
last "official" version:
http://lists.apple.com/archives/coreaudio-api/2007/Feb/msg00118.html
-mike
On May 10, 2007, at 9:41 PM, Paul Fredlein wrote:
Hi,
I'm using MTCoreAudio.
I have assigned a buffer of fixed length (so that it automatically
stops recording when the buffer is full) to record a set duration
from a mic (MTC's defaultInputDevice). If a USB mic is plugged in
on the keyboard's right port all works well. But if it is plugged
in on the keyboard's left port the audio replays at what seems like
4x speed.
I guess I need to set some sample rates or something as it also
messes up on some Macs using the inbuilt mic. (On WinXP I was able
to set the sample rate to 22050, 16bit which is what I prefer -
small buffer but good quality for speech. Tried it under MTC but
didn't seem to do anything [inputDevice setNominalSampleRate:
22050]; .)
The programme is designed for student use at school so I really
want the app to set the defaults by itself without user
interaction. Once the school kids start playing with settings then
the teacher can easily lose control of the class.
Any help appreciated.
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden