Skip to content

Configuration

Note: all configuration is done by means of a VoiceRecorder.Config.Builder.

Configuration parameters

  • Format of audio data (RAW: as an array of Double's, normalized between [-1,1], or WAV: array of UInt8 with a complete representation of a standard wav format).
  • Frequency of sampling: 8 or 16 KHz.
  • Recording limit: the maximum duration of the recording, to protect RAM out of memory errors. NOTE: all durations must be passed in milliseconds.
  • Minimum voice duration: the required duration of voice-signal ready to capture.
  • Minimum SNR (signal-to-noise ratio): the required SNR of the voice signal to be valid.
  • Auto audio info: if true, the SDK will send the info with the progress of the recording to the UI automatically. It will happen with every recorded frame, i.e., every 150 ms.
  • Auto voice capture: if true, the SDK will send automatically all the recorded audio and also the trimmed portion of voice to the UI, when it reaches the quality requirements (voice duration & snr).
  • Auto stop on capture: if true, the SDK stops recording when the voice has been captured. Note: it only works if autoVoiceCapture is true.

An example of possible configuration is as follows:

private func configureVoiceRecorder() {
    let config = VoiceRecorder.Config.Builder()
        .setFormat(VoiceRecorder.Config.WAV_FORMAT)
        .setFs(8000)
        .setAutoAudioInfo(true)
        .setAutoVoiceCapture(true)
        .setStopOnCapture(true)
        .build()
    voiceRecorder.setConfig(config)
}

Default values

  • WAV format.
  • fs = 8 KHz.
  • Recording limit: 30 sec.
  • Min. voice duration: 5 secs.
  • Min. SNR: 5 dB.
  • Auto audio info: false.
  • Auto voice capture: true.
  • Auto stop on capture: true.

With the default values, the UI can start the recording, and then the SDK will capture 5 seconds of voice from the microphone, with enough quality (5 dB SNR), and it will send both the voice and all the signal back to the UI automatically, encoded with WAV format.