Out-of-range samples
Out-of-range samples
- Subject: Out-of-range samples
- From: Erik Rose <email@hidden>
- Date: Fri, 27 Jan 2006 17:12:41 -0500
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.
Thanks!
Erik Rose
_______________________________________________
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