# onAudioFrame

abstract fun onAudioFrame(record: AudioRecordInfo, bytesRead: Int, byteBuffer: ByteBuffer): Boolean

Called for every 10 ms audio buffer captured from the microphone, before it is handed to the WebRTC engine.

The byteBuffer may be modified in-place to transform the audio before it reaches WebRTC (e.g. gain adjustment, filtering, ring modulation).

The buffer contains interleaved PCM samples in the format and sample rate described by record. For android.media.AudioFormat.ENCODING_PCM_16BIT, each sample is a little-endian Short; use `byteBuffer.order(ByteOrder.nativeOrder()).asShortBuffer()` to iterate samples conveniently.

#### Return

`true` to pass the buffer contents (as-is or modified) to WebRTC; `false` to discard the buffer and send silence for this frame instead.

#### Parameters

record

Recording configuration in use.

bytesRead

Number of bytes populated in byteBuffer.

byteBuffer

Buffer containing the raw PCM samples. Safe to read and modify in-place.