Something went wrong. Try again.
A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
Something went wrong. Try again.
12345678910111213import { expect, test } from "bun:test";import { waveformLevels } from "./waveformLevels";
test("isolated transients do not make whole bars full-height", () => { const levels = waveformLevels([255, 0, 0, 0, 255, 255, 255, 255], 2); expect(levels).toEqual([127.5, 255]);});test("preserves silence, constant levels, and quiet-to-loud sections", () => { expect(waveformLevels(null, 4)).toEqual([0, 0, 0, 0]); expect(waveformLevels([0, 0, 32, 32, 128, 128, 255, 255], 4)).toEqual([0, 32, 128, 255]); expect(waveformLevels([32], 4)).toEqual([32, 32, 32, 32]);});