2

i input to the audioJack a square wave in the frequency of 2-3 khZ for about 5 seconds. the square wave is 1 and 0 - no negative values.

i get some periodic signal that going between -32000 to 32000 (but my signal is positive!? )

i have check how many times my values are crossing the zero- i get 500 in 5 seconds, which means 100 per second .

what am i missing here ? 3khz is 3000 per second.

my sampling code is in my previous post : error in audio Unit code -remoteIO for iphone

any explanation on the frequency domain here? am i missing samples ? how can i improve it? should i do :

float bufferLength = 0.005;
     AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(bufferLength), &bufferLength);
    status = AudioOutputUnitStart(audioUnit);

thanks alot!

Community
  • 1
  • 1
Curnelious
  • 1
  • 16
  • 76
  • 150
  • Are you talking about *analogue* audio input ? If so then there is probably a DC blocking capacitor which means that the DC offset in your input signal will be removed, giving you a signal range which settles to +/-0.5 quite quickly. – Paul R Jan 03 '12 at 15:31
  • How many samples are you getting in 5 seconds? Are you sure you are not missing any samples? Also, you are likely overdriving the mic input by a very large amount. – hotpaw2 Jan 03 '12 at 19:23
  • @paul -i am talking about square wave as i said. you can call it analog or digital. just a squre wave 3khz. and-hitpaw2 as i wrote i get 500 in 5 seconds. if i am missing sample? that was my question!! thats why i posted my code here so someone can help me. – Curnelious Jan 04 '12 at 08:27
  • anyone else can direct me with this samples that i am missing in my code ??? – Curnelious Jan 04 '12 at 08:29
  • @Rant: try using a signal with no DC offset, e.g. a square wave that varies between +1 and -1 – Paul R Jan 04 '12 at 09:23
  • @paul why should i do that ? can i input square wave anyway? it has so many frequencies which are probably blocked. what are they use when they do FSK modulation ? maybe i have to input a pure sinus ? the iphone blocks dc, so can he see the square wave picks? they are like a dc before they goes to zero .. – Curnelious Jan 04 '12 at 09:53
  • @Rant: I already explained in my previous comments - you need an input signal with no DC component - it doesn't matter what the waveform is particularly but it needs to be symmetric about 0. – Paul R Jan 04 '12 at 10:11
  • thats wrong.its math. an audio input IS NOT always symmetric about 0, in many point of it. and FFT on any positive signal will give f, which the iphone can see. as a proof , it does not matter if i dont input anything, just noise, and i get same result, and again, not too many samples as i need. thanks anyway. – Curnelious Jan 04 '12 at 11:01
  • @Rant: you're missing the point - since you say you want to count zero crossings then then you need to remove any DC offset. However from looking at your code in some of your other questions it seems you have much bigger problems than this that you need to fix first. – Paul R Jan 04 '12 at 11:38

0 Answers0