matchStream

abstract fun matchStream(audioData: ByteArray, meaningfulLengthInBytes: Int, timestampInMs: Long)

Flow audio buffers for matching into the session. Audio will be converted to signatures and matched against the store. Results are communicated through recognitionResults. All provided audioData objects must encode audio in the same format declared when the session is created. Note: The audio format must be

  • PCM 16bit

  • MONO

in one of the following sample rates:

  • 48000, 44100, 32000, 16000 Hz

It is required to pass a timestamp with the audio data. The audio provided must be contiguous, gaps in the audio will have adverse effects on the ability to match the audio. The time variable might be validated by the session to ensure that the audio is contiguous and mitigate the effect of interrupted audio.

Parameters

audioData

An array containing a chunk of audio to be used for matching.

meaningfulLengthInBytes

: How much of audioData has been filled with meaningful audio. This comes handy when recording using Android's AudioRecord that might not completely fill the requested buffer with meaningful audio.

timestampInMs

The timestamp expressed in milliseconds where in the stream the audio occurs.