Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to prevent iPhone 3GS from filtering low frequencies ( < 150Hz )
    primarykey
    data
    text
    <p>I'm developing a bass guitar pitch detection app on iphone 3GS. I found I can't get sound data lower than 150Hz with RemoteIO. However bass guitar may generate tones lower than 50hz. According to the report "iPhone 4 Headset Input Frequency Response", <a href="http://blog.faberacoustical.com/2010/iphone/iphone-4-audio-and-frequency-response-limitations/" rel="nofollow noreferrer">http://blog.faberacoustical.com/2010/iphone/iphone-4-audio-and-frequency-response-limitations/</a> There is a sharp drop-off below 150 Hz.</p> <p>Here shows how I setup the AudioUnit.</p> <pre><code>// set audio unit { // create AudioUnit { AudioComponentDescription desc; desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_RemoteIO; desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; AudioComponent comp = AudioComponentFindNext(NULL, &amp;desc); OSAssert(AudioComponentInstanceNew(comp, &amp;m_AudioUnit)); } //enable input on the remote I/O unit (output is default enabled, but input is not) { UInt32 one = 1; OSAssert(AudioUnitSetProperty(m_AudioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &amp;one, sizeof(one))); } //set render callback function { AURenderCallbackStruct callbackInfo; callbackInfo.inputProc=staticPerformThru; callbackInfo.inputProcRefCon=this; OSAssert(AudioUnitSetProperty(m_AudioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &amp;callbackInfo, sizeof(callbackInfo))); } //set in/output format { CAStreamBasicDescription outFormat; outFormat.SetAUCanonical(channels, false); outFormat.mSampleRate = sampleRate; OSAssert(AudioUnitSetProperty(m_AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &amp;outFormat, sizeof(outFormat))); OSAssert(AudioUnitSetProperty(m_AudioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &amp;outFormat, sizeof(outFormat))); } //Initialize remote I/O unit OSStatus r=AudioUnitInitialize(m_AudioUnit); OSAssert(r); } //start audio output OSAssert(AudioOutputUnitStart(m_AudioUnit)); </code></pre> <p>This is the callback function.</p> <pre><code>OSStatus AudioThruWorker::staticPerformThru( void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { AudioUnitRender(((AudioThruWorker*)inRefCon)-&gt;m_AudioUnit, ioActionFlags, inTimeStamp, 1, inNumberFrames, ioData); //Detect pitch here... return 0; } </code></pre> <p>To identify the root cause,</p> <ol> <li>I modified my callback function to just bypass input data to output.</li> <li>Use Mac to generate white noise</li> <li>Use iRig to redirect the signal from Mac's headset to iPhone3Gs which is running my program.</li> <li>Use iRig to redirect output of iPhone back to Mac.</li> <li>Record data on Mac. <img src="https://i.stack.imgur.com/PU3Ej.png" alt="enter image description here"> The output data spectrum shows in below figure. <img src="https://i.stack.imgur.com/2icS3.png" alt="enter image description here"></li> </ol> <p>You can see the sharp drop at 150Hz. </p> <p>To identify whether the problem is at input side or output side, I changed the callback function to ignore input data and output a white noise. Here is the result. <img src="https://i.stack.imgur.com/NtcxR.png" alt="enter image description here"> Very clear that there is NO drop at 150 Hz. Therefore the problem should at the input side.</p> <p>I thought this is a hardware limitation. HOWEVER I tried the app "Amplitube" on the same device, turn off all effects ,input white noise and analyze output. It has NO drop at 150Hz. Here is the result.<img src="https://i.stack.imgur.com/ZXCmI.png" alt="Amplitube frequency response on iPhone 3gs"> This means the drop-off problem is NOT a hardware limitation. There must be some way software can do to avoid the problem.</p> <p>Does anyone know the secret?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload