Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

@dioramajs/audio/beat

Exports of @dioramajs/audio/beat.

View as Markdown
On this page
import { BASS, default, Detector } from '@dioramajs/audio/beat'

Functions

energyMean linear amplitude of the bins between `lo` and `hi` Hz, from decibels.
findPlayerThe player: `for`, else the first audio or video of the closest container that holds one.
loudnessRoot mean square of analyser bytes around 128.

Classes

DetectorBeats from the energy of each frame: a rise above the running average by a margin, and near the loudest recent energy (so a hi-hat between kicks is not one), no sooner than GAP after the last beat. The sensitivity lowers both bars. Returns the strength 0..1 of a beat on this frame, 0 for none. Deterministic: the same frames give the same beats.

Constants

BASSThe kick and the bass line, Hz.
defaultAn element that pulses with a page's music: it scales, shakes and glows, or sends out rings, on the beats, the bass or the loudness of an <audio> or <video>. It never starts the sound; frames only while the player plays and a pulse fades. The element stays live DOM.
GAPShortest time between two beats, s: at most three pulses a second, under the flash threshold of WCAG 2.3.1 whatever the tempo; faster music pulses on every other beat.