npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@waveform-playlist/core

v12.6.1

Published

Core types, interfaces and utilities for waveform-playlist

Readme

@waveform-playlist/core

Core types, interfaces and utilities for waveform-playlist — pure functions and TypeScript types with zero runtime dependencies.

Used by nearly every @waveform-playlist/* and @dawcore/* package (engine, playout, media-element-playout, browser, ui-components, recording, annotations, spectrogram, midi, transport, dawcore, dawcore-spectrogram, dawcore-midi, webaudio-peaks, loaders, and more). Most consumers get it transitively — install it directly only if you're building on the clip model, timeline math, or fade curves yourself.

Features

  • Clip & track typesAudioClip, ClipTrack, Timeline, Fade/FadeType, Peaks/Bits/PeakData, WaveformDataObject
  • Sample-based timeline mathcreateClip/createClipFromSeconds/createClipFromTicks, clip queries (getClipsInRange, clipsOverlap, findGaps), and second-conversion helpers (clipStartTime, clipEndTime, clipPixelWidth)
  • Fade curves — linear, exponential, logarithmic, and S-curve generators for native Web Audio AudioParam (no Tone.js dependency)
  • Decibel utilities — gain ↔ dB ↔ normalized-0-1 conversions for meters and volume controls
  • Peaks generation — real-time min/max peak extraction during recording
  • Musical time — PPQN tick math, bar/beat conversion, time-signature meter detection, grid snapping
  • Keyboard shortcuts — a framework-agnostic shortcut matcher shared by the React and Web Components layers
  • Spectrogram canvas-ID contract — canonical build/parse helpers for the ${clipId}-ch${n}-chunk${m} canvas ID format shared by the worker pool and rendering layers
  • HTTP range support probing — detect whether an audio host supports byte-range seeking

Installation

npm install @waveform-playlist/core

Zero dependencies — safe to install anywhere without pulling in Web Audio, React, or Tone.js.

Usage

import { createClipFromSeconds, clipStartTime, clipEndTime, gainToDb } from '@waveform-playlist/core';

// Build a clip from a decoded AudioBuffer, positioned at 2.5s on the timeline
const clip = createClipFromSeconds({
  audioBuffer,
  startTime: 2.5,
  offset: 0,
  fadeIn: { duration: 0.5, type: 'linear' },
});

clipStartTime(clip); // 2.5
clipEndTime(clip); // 2.5 + audioBuffer.duration

// Convert a linear gain value to dB for a Tone.js Volume node
gainToDb(0.5); // ≈ -6.02
import { buildSpectrogramCanvasId, parseSpectrogramCanvasId } from '@waveform-playlist/core';

const id = buildSpectrogramCanvasId({ clipId: 'clip-1', channelIndex: 0, chunkIndex: 3 });
// "clip-1-ch0-chunk3"

parseSpectrogramCanvasId(id);
// { clipId: 'clip-1', channelIndex: 0, chunkIndex: 3 }

API

| Module | Key exports | |---|---| | types/ | AudioClip, ClipTrack, Timeline, Track, Fade, FadeType, Peaks, Bits, PeakData, WaveformDataObject, SpectrogramConfig, RenderMode, ColorMapValue | | clipTimeHelpers | clipStartTime, clipEndTime, clipOffsetTime, clipDurationTime, clipPixelWidth, trackChannelCount | | clip constructors (types/clip) | createClip, createClipFromSeconds, createClipFromTicks, createTrack, createTimeline, getClipsInRange, getClipsAtSample, clipsOverlap, sortClipsByTime, findGaps | | fades | applyFadeIn, applyFadeOut, generateCurve, linearCurve, exponentialCurve, logarithmicCurve, sCurveCurve | | utils/dBUtils | gainToDb, dBToNormalized, normalizedToDb, gainToNormalized | | utils/conversions | samplesToSeconds, secondsToSamples, samplesToPixels, pixelsToSamples, pixelsToSeconds, secondsToPixels | | utils/beatsAndBars | PPQN, ticksPerBeat, ticksPerBar, ticksToSamples, samplesToTicks, snapToGrid | | utils/musicalTicks | computeMusicalTicks, snapToTicks, snapTickToGrid, SnapTo, MusicalTick | | utils/meterDetection | MeterEntry, detectMeterChanges | | utils/peaksGenerator | generatePeaks, appendPeaks | | utils/audioBufferUtils | concatenateAudioData, createAudioBuffer, appendToAudioBuffer, calculateDuration | | utils/latency | resolveRecordingOffsetSamples — override-vs-auto recording latency compensation (shared by React + dawcore) | | utils/carveClipRange | carveClipRange — punch-in replace: carve a sample range out of a clip list (trim/remove/split) | | keyboard | KeyboardShortcut, handleKeyboardEvent, getShortcutLabel | | spectrogramCanvasId | buildSpectrogramCanvasId, parseSpectrogramCanvasId, SpectrogramCanvasIdParts | | probeRangeSupport | probeRangeSupport, RangeSupport | | enumerateMicrophones | enumerateMicrophones, watchMicrophoneDevices, MicrophoneEnumeration — permission-free device listing with supported/hasLabels flags (labels are browser-redacted pre-permission) | | constants | MAX_CANVAS_WIDTH |

Examples & Documentation

License

MIT