WaveformAudioBufferSink.WaveformBar


public class WaveformAudioBufferSink.WaveformBar


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

Public constructors

Public methods

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

Adds a new sample to the group.

double

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

double

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

double

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

int

Returns the number of samples added.

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
@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 added.