 hartsteins
|
it seems that pocketsphinxAudioDeviceMeteringLevel gives a different result if compiled with a Xcode scheme debug vs release. Though this was discovered in my own app, I went back and compiled the sample project for both schemes and the problem exists there as well.
Tracing it back to the ContinuousAudioUnit class …. audioDriver->pocketsphinxDecibelLevel seems to return a float of 50.75 in release mode vs proper decibel readout in debug.
Any ideas?
thanks
|
 Halle
|
Can you let me know the Xcode version, iOS version target and device you’re seeing the behavior on? It would also be helpful if you’d turn on OPENEARSLOGGING and look and see if there are errors or warnings when it doesn’t work.
|
 hartsteins
|
I am testing on iPad 2 & iphone 4S both running 5.0.1
There is no error reported in OPENEARSLOGGING since there is error checking before the fact in the ContinuousAudioUnit code. Below is the method…. (I added the OpenEarsLog to see what was happening). Since in release the audio driver returns 50+ this method sends 0 and no errors appear. In debug (even in untouched sample code) this returns proper values.
Float32 pocketsphinxAudioDeviceMeteringLevel(pocketsphinxAudioDevice * audioDriver) { // Function which returns the metering level of the AudioUnit input.
OpenEarsLog(@”audioDriver->pocketsphinxDecibelLevel %f”,audioDriver->pocketsphinxDecibelLevel );
if(audioDriver != NULL && audioDriver->pocketsphinxDecibelLevel && audioDriver->pocketsphinxDecibelLevel > -161 && audioDriver->pocketsphinxDecibelLevel pocketsphinxDecibelLevel;
}
return 0.0;
}
|
 hartsteins
|
Also targeting 5.0 btw
thanks for your help
|
 hartsteins
|
Xcode 4.2.1 on Lion if that helps at all
continued thanks
|
 Halle
|
Hi,
OK, I have replicated this and tracked it down. I don’t actually know the underlying cause that relates to the scheme selection yet because Xcode 4.2 makes it pretty non-obvious how to make a direct comparison of all of the build settings between configurations, however the actual bug is on my part since it’s due to relying on undefined behavior. Thanks for letting me know about it. You can fix it immediately by changing this line in the function getDecibels in the class ContinuousAudioUnit.mm:
Float32 currentFilteredValueOfSampleAmplitude, previousFilteredValueOfSampleAmplitude; // We'll need these in the low-pass filter
to this:
Float32 currentFilteredValueOfSampleAmplitude; // We'll need these in the low-pass filter
Float32 previousFilteredValueOfSampleAmplitude = 0.0;
|
 hartsteins
|
Yay it works!
Glad I could help out in any way.
Thank you for all your work on this fantastic library.
|