78 4. ANALOG-TO-DIGITAL SIGNAL CONVERSION
Navigate to the GlobalVariable.m file in the Xcode project used above.
e function printTime has the code that offloads the GUI update code to the main thread.
void printTime(double duration) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
textView = (__bridge UITextView *)(view);
NSString *status = [NSString stringWithFormat:@"Average
Frame Processing Time : %f milliseconds ",
(double)duration*1e3];
textView.text = [textView.text
stringByAppendingString:status];
[textView scrollRangeToVisible:NSMakeRange([[textView text]
length], 0)];
});
}
In this code, the dispatch_async function runs the code inside it on the main thread. is
allows the audio processing code to run while the GUI is updated at the same time.
L4.6 MULTI-RATE SIGNAL PROCESSING
Similar to Android smarpthones, iPhones also suffer from audio latency. e latency can be
minimized by running at a sampling rate of 48 kHz similar to Android smartphones. e op-
timum frame size for all iOS devices is 64 samples and the round-trip latency ranges from
9–11 ms. e same multi-rate signal processing approach in Section L3.8 can be used here to
synchronize the audio i/o and processing modules while generating a low-latency outcome.
L4.7 LAB EXERCISES
1 How much memory is required to buffer a 1-s length recording of audio signal samples?
2 Experiment with various frame sizes and computation delays to find the maximum al-
lowable computation delay for a given frame size. Explain the situations when real-time
processing breaks down.
Hints—Here are the steps that need to be taken for running the prebuilt app code on your
iOS smartphone target.
Select your device in the scheme window of the Xcode.
Run the project. is will install the app.
L4. LAB 4: IPHONE AUDIO SIGNAL SAMPLIN 79
You should then be able to run the app. You can record your own audio samples by select-
ing a sampling rate from the app Settings menu. Test the case when recording audio and the
processing takes too long, and then the case when reading from a file and the processing takes
too long.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.169.50