| 155 | |
| 156 | Next, for analysis of the voice, make instance of class AudioSignalAnalyzer and FSKRecognizer. AudioSignalAnalyzer parses the input waveform from the microphone to detect the falling and rising edge of the waveform. FSKRecognizer restores the data bits based on the results of the analysis of AudioSignalAnalyzer. |
| 157 | |
| 158 | {{{ |
| 159 | #!C |
| 160 | recognizer = [[FSKRecognizer alloc] init]; |
| 161 | analyzer = [[AudioSignalAnalyzer alloc] init]; |
| 162 | [Analyzer addRecognizer: recognizer]; // set recognizer to analyzer |
| 163 | [analyzer record]; // start analyzing |
| 164 | }}} |
| 165 | |
| 166 | Then create an instance of a class FSKSerialGenerator for sound output. FSKSerialGenerator converts the data bits to audio signal and output. |
| 167 | |
| 168 | {{{ |
| 169 | #!C |
| 170 | generator = [[FSKSerialGenerator alloc] init]; |
| 171 | [Generator play]; // audio output starts |
| 172 | }}} |