Part of the
@remotion/media-utils package of helper functions.
Takes bulky waveform data (for example fetched by
getAudioData()) and returns a trimmed and simplified version of it, for simpler visualization. This function is suitable if you only need volume data, if you need more detailed data about each frequency range, use
An object with the following arguments:
AudioData- information about the audio. Use
getAudioData()to fetch it.
number- trim the waveform to exclude all data before
number- trim the waveform to exclude all data after
startTimeInSeconds + durationInSeconds.
number- how big you want the result array to be. The function will compress the waveform to fit in
Bar - An array of objects with the following properties:
number- the index of the datapoint, starting at 0. Useful for specifying as React
keyattribute without getting a warning.
number- a value describing the amplitude / volume / loudness of the audio.
visualizeAudio() function is more suitable for visualizing audio based on frequency properties of the audio (bass, mids, highs, etc).