# TeeAudioProcessor.WavFileAudioBufferSink

# TeeAudioProcessor.WavFileAudioBufferSink

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/audio/TeeAudioProcessor.java+class:androidx.media3.exoplayer.audio.TeeAudioProcessor.WavFileAudioBufferSink)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink "View this page in Java")


```
class TeeAudioProcessor.WavFileAudioBufferSink : TeeAudioProcessor.AudioBufferSink
```

<br />

*** ** * ** ***

A sink for audio buffers that writes output audio as .wav files with a given path prefix. When new audio data is handled after flushing the audio processor, a counter is incremented and its value is appended to the output file name.

Note: if writing to external storage it's necessary to grant the `
WRITE_EXTERNAL_STORAGE` permission.

## Summary

|                                                                                                                                                                                  ### Public constructors                                                                                                                                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WavFileAudioBufferSink](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#WavFileAudioBufferSink(java.lang.String))`(outputFileNamePrefix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Creates a new audio buffer sink that writes to .wav files with the given prefix. |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [flush](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#flush(int,int,int))`(sampleRateHz: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, channelCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, @`[C.PcmEncoding](https://developer.android.com/reference/kotlin/androidx/media3/common/C.PcmEncoding)` encoding: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the audio processor is flushed with a format of subsequent input. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [handleBuffer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#handleBuffer(java.nio.ByteBuffer))`(buffer: `[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html)`!)` Called when data is written to the audio processor.                                                                                                                                                                                                                                                                                                     |

## Public constructors

### WavFileAudioBufferSink

```
WavFileAudioBufferSink(outputFileNamePrefix: String!)
```

Creates a new audio buffer sink that writes to .wav files with the given prefix.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|------------------------------|
| `outputFileNamePrefix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The prefix for output files. |

## Public functions

### flush

```
fun flush(sampleRateHz: Int, channelCount: Int, @C.PcmEncoding encoding: Int): Unit
```

Called when the audio processor is flushed with a format of subsequent input.  

### handleBuffer

```
fun handleBuffer(buffer: ByteBuffer!): Unit
```

Called when data is written to the audio processor.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| `buffer: `[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html)`!` | A read-only buffer containing input which the audio processor will handle. |