Skip to main content

Migrating from v3

v3v4
computeAmplitude(path, 100) returned an array synchronouslyresample(await analyzeAudio(path), 100), or useWaveform. Values are RMS instead of the mean absolute level, which is very close visually.
Changing the sample count decoded the file againresample the same Peaks
Returned [] for unreadable filesRejects with a descriptive error
load(url) cached by file name and sizeCaches by full URL; supports headers; rejects non-2xx responses. Files cached by v3 are never read again: clearCache() removes them, getCacheSize() counts them
react-native-nitro-modules ^0.27^0.37.1

The helpers from the v3 example app map to:

v3 helperv4
sample(values, n) (picked every n-th value, could skip peaks)resample(peaks, n)
scale(values)normalize(values) — keeps silence at 0
robustScale / trimmedScalenormalize(values, { reference: peaksLevel(peaks, { percentile: 0.99 }) })

The full list of changes is in the changelog.