Re: Out-of-range samples
Re: Out-of-range samples
- Subject: Re: Out-of-range samples
- From: Herbie Robinson <email@hidden>
- Date: Sat, 28 Jan 2006 18:28:28 -0500
Just as a practical matter, blowing into a good microphones is a good
way to ruin it; although, the one built into a Powerbook is probably
safe. Blowing into a microphone (and wind) will produce unusually
high output.
In general, the range of signal values that can come out of a
microphone is way too extreme to run directly into a recording
process of any sort (including a LAME converter). At a minimum, you
need some sort of gain control and signal metering to see what the
levels actually are. Things like compression, limiting and/or AGC
are often useful (depending on what you are trying to do).
It is odd that the driver for the built-in mic is producing such high
sample values. The driver must have a built-in gain control that is
set very high. You should be able to access the gain control in AMS.
So, after much thrashing around, I finally found Jeff Moore's post
(http://lists.apple.com/archives/Coreaudio-api/2002/Mar/msg00136.html)
specifying the range for CoreAudio's samples: [-1, 1]. However, my
PowerBook's built-in mic blatantly defies that, giving me something
more like [-6.9532, 6.8934] when I blow hard into it. I thought I
was messing up my pointer math, but then, as a last resort, I switch
to a Logitech USB mic, and suddenly everything behaved. What's going
on here? Please help!
I used some longish min/max code with mutexes and such to get the
above numbers, but the same can be had (though with more junk to
sort through) by inserting an NSLog call into the well-known
Recordotron example (http://borkware.com/rants/sound/):
- (OSStatus) readCycleForDevice: (MTCoreAudioDevice *) theDevice
timeStamp: (const AudioTimeStamp *) now
inputData: (const AudioBufferList *) inputData
inputTime: (const AudioTimeStamp *) inputTime
outputData: (AudioBufferList *) outputData
outputTime: (const AudioTimeStamp *) outputTime
clientData: (void *) clientData
{
const AudioBuffer *buffer;
buffer = &inputData->mBuffers[0];
NSLog(@"first sample: %f", *(Float32 *)(buffer->mData));
Yes, I admit to using the MTCoreAudio framework, but, reading its
source, I don't see it doing anything naughty to my incoming
samples. Another thing: Recordotron, which just records and then
plays back what it heard, plays back fine, despite the out-of-range
values.
Can one of you CoreAudio gurus shed some light on this? I need to
know the range of my incoming samples so I can scale them properly
before running them through LAME. Please tell me I'm doing something
silly.
--
-*****************************************
** http://www.curbside-recording.com/ **
******************************************
_______________________________________________
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