Constructor
new(?version:Int, channels:Int, sampleRate:Int, samplesPerPoint:Int, bits:Int, length:Int, data:Array<Int>)
Variables
read onlydata:Array<Int> = []
Array of Int16 values representing the waveform.
TODO: Use an openfl.Vector for performance.
read onlysamplesPerPoint:Int = 256
Number of input audio samples per output waveform data point. At base zoom level this is number of samples per pixel. Lower values can more accurately represent the waveform when zoomed in, but take more data.
Methods
clone(?newData:Array<Int>):WaveformData
Create a new WaveformData whose parameters match the current object.
indexToPercent(index:Int):Float
Given a waveform data point index, return the percentage progress through the waveform.
maxSampleValue():Int
Maximum possible value for a waveform data point. The minimum possible value is (-1 * maxSampleValue)
merge(that:WaveformData):WaveformData
Create a new WaveformData whose data represents the two waveforms overlayed.
percentToIndex(percent:Float):Int
Given the percentage progress through the waveform, return the waveform data point index.
inlinepointsPerSecond():Float
The number of data points this waveform data provides per second of audio.
resample(newSamplesPerPoint:Int):WaveformData
Resample the waveform data to create a new WaveformData object matching the desired samplesPerPoint value.
This is useful for zooming in/out of the waveform in a performant manner.
Parameters:
newSamplesPerPoint | The new value for |
|---|