# WaveformAudioBufferSink.WaveformBar

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

*** ** * ** ***

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

<br />

```
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 constructors                                                               |
|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| [WaveformBar](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#WaveformBar())`()` |

|                               ### Public functions                                |
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)     | [addSample](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#addSample(float))`(sample: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = "-1", to = 1) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Adds a new sample to the group. |
| [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) | [getMaxSampleValue](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getMaxSampleValue())`()` Returns the maximum sample value in this group, normalized between -1 and +1.                                                                                                                                                     |
| [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) | [getMinSampleValue](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getMinSampleValue())`()` Returns the minimum sample value in this group, normalized between -1 and +1.                                                                                                                                                     |
| [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) | [getRootMeanSquare](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#getRootMeanSquare())`()` Returns the RMS (Root Mean Square) of the samples in this group, normalized between -1 and +1.                                                                                                                                    |

|                            ### Public properties                            |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [sampleCount](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/WaveformAudioBufferSink.WaveformBar#sampleCount()) |

## Public constructors

### WaveformBar

```
WaveformBar()
```  

## Public functions

### addSample

```
fun addSample(sample: @FloatRange(from = "-1", to = 1) Float): Unit
```

Adds a new sample to the group.  

|                                                                                                  Parameters                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|
| `sample: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = "-1", to = 1) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The sample value, between -1 and +1. |

### getMaxSampleValue

```
fun getMaxSampleValue(): Double
```

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

### getMinSampleValue

```
fun getMinSampleValue(): Double
```

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

### getRootMeanSquare

```
fun getRootMeanSquare(): Double
```

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.  

## Public properties

### sampleCount

```
val sampleCount: Int
```