Microphone

From Acacia Support Wiki
Jump to navigation Jump to search

Audio data from the Microphone is processed by Morsenger in real-time by tapping into the iPhone/iPad's sound engine.

It is difficult to reliably detect and decode Morse Code signal due to:

  • Ambient noise
  • Variations in tone, volume and timing

Morsenger uses a multi-pronged approach when receiving audio data. The data is extracted from the audio pipeline and processed using multiple concurrent threads:

  • A Fast Fourier Transform (FFT) that allows tones and volumes to be precisely detected out of noisy signals. It is tuned to accurately detect the presence/absence of clear tones in the range 400 Hz to 1.2 kHz.
  • A volume sampling process for higher resolution Dot/Dash detection.
  • A raw data sampling process for even higher resolution signal processing.

The sampled data is further processed using:

  • Automatic gain adjustments.
  • Low pass filtering.
  • Schmitt trigger level detection.

Morsenger would uses FFT exclusively except that it is not possible to receive data fast enough to get the require frequency resolution and time resolution to detect anything but the slowest of morse transmissions. The current logic extracts 64 floating point samples every 11 milliseconds, allowing detection of morse speed as high as 25 words per minute.

In order to avoid missing any messages, the audio data is fed into a large circular buffer. The filtering and detection logic processes this data incrementally as it arrives and pushes it into another circular holding buffer. Once about 0.5 sec of silence is detected, silence is trimmed and the raw data is release into the [Input Pipeline]] for translation into messages.

In terms of FFT processing the constraints are:

  • Base audio sampling speed is 44100 samples per second.
  • We only process one of the available audio channels.
  • iOS processes data in a 4410 sample circular buffer.
  • For FFT with about a 68 Hz frequency resolution, we need at least 512 samples.
  • A tap into the iOS audio pipleine can provide blocks of 64 floating point samples (512 byte samples) every 11 milliseconds.
  • At a morse transmission speed of 25 words per minute, a dot is 48 milliseconds, meaning we can get 4 samples in this time.