Re: Acquiring input Data
Re: Acquiring input Data
- Subject: Re: Acquiring input Data
- From: Heath Raftery <email@hidden>
- Date: Fri, 24 Jun 2005 09:36:32 +1000
On 24/06/2005, at 3:05 AM, Paul Barbot wrote:
On 6/23/05, Heath Raftery <email@hidden> wrote:
On 23/06/2005, at 3:41 AM, Paul Barbot wrote:
On 6/22/05, Heath Raftery <email@hidden> wrote:
Well that's progress :)
Keep an eye on your InputUnit in the debugger. It should start to
fill with values as you go through the functions to set it up.
Follow
the technote you were reading, and make sure you have included the
functions we've mentioned in this thread. You'll get there!
I hope so ...
hey, it seems I have data now in my buffer !!!!
do you know a simple way to verify if it's really good audio Data from
the input ? (eg read it ) ?
Congratulations! Verifying the data is another tip that should really
be in the technote - of course, I had the same question. I now have a
few solutions!
Firstly, the data is linear, 32-bit float values. So after the
AudioUnitRender you can just view the memory as 32-bit floats to see
what it contains. Easiest way I find to do this is in the console of
the debugger. Type this at the prompt:
x /100fw 0x1bc00000
(type help x for information on the command)
where 0x1bc00000 is the address that appears in the variable view
section of the debugger for theBufferListPtr->mBuffers[0].mData.
The values printed out should be small, fairly close together
decimals, in the order of +/-0.001 or so. That should confirm that
the data is reasonable.
Secondly, to confirm it's actually coming from the microphone, you
first need to get your AudioUnitRender-based function looping - this
will happen automatically once AudioUnitStart is called, so for now I
wouldn't worry that you're writing over theBufferList everytime. Then
use something like this after your AudioUnitRender call:
float max = 0;
for(i=0; i<inNumberFrames; i++)
{
float value = ((float*)fInputBufferList->mBuffers[0].mData)[i];
if(value < 0)
value *= -1;
if(value > max)
max = value;
}
max = 20*log10(max); //convert to dB
[fIndicator setFloatValue:max];
where fIndicator is an IBOutlet to a NSSlider say, with minimum value
around -60.0, maximum value at 0.0. Your slider should go bananas
(it's being updated very often, thus will jump around) but should go
towards the 0.0 end in the presence of loud sound.
but I leave the previous print description that you give and its
always full of zero :(
client format2:
AudioStreamBasicDescription: 0 ch, 44100 Hz, ' ' (0x00000000) 0
bits/channel, 0 bytes
/packet, 0 frames/packet, 0 bytes/frame
Strange! Maybe it's printing out DesiredFormat, which only has the
rate filled out. In any case, it looks like the setup is going okay.
In that case, I'm not so sure the TechNote is wrong - maybe having
the other values as zero means "don't change these values" in the
SetProperty call. Perhaps I'll investigate that myself one day.
Anyway, let me know how you go from here - things are looking good!
Now two people have benefitted from me going to WWDC, you and me :D
Heath
_______________________________________________
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