# WaveformAudioBufferSink.WaveformBar

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/WaveformAudioBufferSink.java+class:androidx.media3.exoplayer.audio.WaveformAudioBufferSink.WaveformBar)

*** ** * ** ***


```
public class WaveformAudioBufferSink.WaveformBar
```

<br />

*** ** * ** ***

Aggregates a group of audio samples. The values exposed can be used to draw one vertical bar of an audio waveform.

## Summary

| ### Public fields |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#sampleCount()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#WaveformBar()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#addSample(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = "-1", to = 1) float sample)` Adds a new sample to the group. |
| `double` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getMaxSampleValue()()` Returns the maximum sample value in this group, normalized between -1 and +1. |
| `double` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getMinSampleValue()()` Returns the minimum sample value in this group, normalized between -1 and +1. |
| `double` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getRootMeanSquare()()` Returns the RMS (Root Mean Square) of the samples in this group, normalized between -1 and +1. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getSampleCount()()` Returns the number of samples `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#addSample(float)`. |

## Public fields

### sampleCount

```
public int sampleCount
```

## Public constructors

### WaveformBar

```
public WaveformBar()
```

## Public methods

### addSample

```
public void addSample(@FloatRange(from = "-1", to = 1) float sample)
```

Adds a new sample to the group.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = "-1", to = 1) float sample` | The sample value, between -1 and +1. |

### getMaxSampleValue

```
public double getMaxSampleValue()
```

Returns the maximum sample value in this group, normalized between -1 and +1.

### getMinSampleValue

```
public double getMinSampleValue()
```

Returns the minimum sample value in this group, normalized between -1 and +1.

### getRootMeanSquare

```
public double getRootMeanSquare()
```

Returns the RMS (Root Mean Square) of the samples in this group, normalized between -1 and +1.

This an estimate of the audio loudness level.

### getSampleCount

```
public int getSampleCount()
```

Returns the number of samples `https://developer.android.com/reference/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#addSample(float)`.