# 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)

*** ** * ** ***


```
public final class TeeAudioProcessor.WavFileAudioBufferSink implements 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 |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#WavFileAudioBufferSink(java.lang.String)(https://developer.android.com/reference/java/lang/String.html outputFileNamePrefix)` Creates a new audio buffer sink that writes to .wav files with the given prefix. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#flush(int,int,int)(int sampleRateHz, int channelCount, @https://developer.android.com/reference/androidx/media3/common/C.PcmEncoding int encoding)` Called when the audio processor is flushed with a format of subsequent input. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/TeeAudioProcessor.WavFileAudioBufferSink#handleBuffer(java.nio.ByteBuffer)(https://developer.android.com/reference/java/nio/ByteBuffer.html buffer)` Called when data is written to the audio processor. |

## Public constructors

### WavFileAudioBufferSink

```
public WavFileAudioBufferSink(String outputFileNamePrefix)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html outputFileNamePrefix` | The prefix for output files. |

## Public methods

### flush

```
public void flush(int sampleRateHz, int channelCount, @C.PcmEncoding int encoding)
```

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

### handleBuffer

```
public void handleBuffer(ByteBuffer buffer)
```

Called when data is written to the audio processor.

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