Re: Newbie: trying to log samples
Re: Newbie: trying to log samples
- Subject: Re: Newbie: trying to log samples
- From: Michael Hanna <email@hidden>
- Date: Thu, 3 Feb 2005 19:10:21 -0500
after fiddling with the mic input data, I'm just curious as to what the sample values actually are. Are the values amplitude information? If the value is between 1 and -1, what does the negative value connotate? If PCM is the direct result of the analog movement of the mic diaphragm, does all that mean is that the diaphragm moved in the opposite direction as the positive value? So taking the absolute value will always give me the amplitude?
regards,
Michael
<x-tad-smaller>
float</x-tad-smaller><x-tad-smaller> aSample[SOUND_PRINTOUT_SIZE];</x-tad-smaller>
<x-tad-smaller> NSLog(</x-tad-smaller>
<x-tad-smaller>@"aSample %d %f\n"</x-tad-smaller><x-tad-smaller>,i , aSample[i]); </x-tad-smaller>
2005-02-03 14:27:38.048 Recordotron[4830] aSample 65 -0.000275
2005-02-03 14:27:38.048 Recordotron[4830] aSample 66 -0.000275
2005-02-03 14:27:38.048 Recordotron[4830] aSample 67 0.000702
2005-02-03 14:27:38.048 Recordotron[4830] aSample 68 0.000702
On 3-Feb-05, at 1:47 PM, kelly jacklin wrote:
On Feb 3, 2005, at 10:24 AM, Michael Hanna wrote:
Or if I printout the first 256 samples, I get 64 significant numbers and the rest zeroes. Why are there missing samples and why this 4:1 ratio of significant data to none?
The problem is because of:
<x-tad-smaller>#define SOUND_PRINTOUT_SIZE (2 * 128)</x-tad-smaller><x-tad-smaller>
</x-tad-smaller>
and:
<x-tad-smaller> memcpy (aSample, buffer->mData, SOUND_PRINTOUT_SIZE); </x-tad-smaller><x-tad-smaller>// grab 128 frames, 256 words</x-tad-smaller><x-tad-smaller>
</x-tad-smaller>
Your memcpy is only copying SOUND_PRINTOUT_SIZE _bytes_, whereas you seem to be expecting the buffer to contain SOUND_PRINTOUT_SIZE samples of data after the memcpy (since you are looping over the samples for that number of times)...
Does that help?
kelly
_______________________________________________
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