Meter also Level meter, VU meter, Peak meter
An audio level meter (a mixer's channel strip): peak and RMS in dB, green, yellow and red zones, a peak hold line and a clip mark, one bar per channel; setLevels() on every animation frame costs no render.
API
For AI agents: this API as Markdown, or every component in llms-full.txt.
<ray-meter> · RayMeter
Levels are dB (20 * log10 of the amplitude; -Infinity for silence). A peak goes up at once and falls at falloff dB/s, so call setLevels() on every frame; the hold line keeps the highest peak for hold ms. The bars are role=meter, its value (the loudest channel) updated a few times a second. Colors: --ray-meter-low, --ray-meter-mid, --ray-meter-high; length: the host's height (--ray-meter-length, 12rem), or its width when horizontal. Beside a fader (ray-slider orientation="vertical"), give both the same height and the meter --ray-meter-inset: half the slider's thumb length (0.4375rem for thumb="cap", 0.5625rem for the round one): and the same taper: its bars then line up with the slider's marks, which carry the numbers; leave the meter's own scale off.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
min | min | number | -60 | The dB at the bottom: lower levels show nothing. |
max | max | number | 6 | The dB at the top. |
warn | warn | number | -12 | Where the yellow zone starts (dB). |
danger | danger | number | -3 | Where the red zone starts (dB). |
clip | clip | number | 0 | A peak at or over it (dB) marks the channel as clipped (a red band at the top of its bar) until resetClip(), reset() or a click on the bar. |
channels | channels | number | 1 | The bars: 1 (mono), 2 (stereo)… |
orientation | orientation reflects | vertical | horizontal | vertical | vertical: bars that rise, the scale before them (on the left, aligned against them); horizontal: bars that grow towards the inline end. |
size | size reflects | xs | sm | md | lg | sm | The thickness of each bar. |
hold | hold | number | 1500 | How long the peak hold line stays (ms); 0: no line. |
falloff | falloff | number | 24 | How fast a lower level falls (dB per second); 0: at once. |
scale | scale reflects | boolean | Shows the dB scale on the left of the bars (6, 0, -6, -12, -24, -36, -48, -60 within min and max). Part of the meter, and optional: beside a fader, put the numbers on the fader (its marks) instead. | |
taper | taper reflects | linear | fader | linear | How the dB spread along the bar: linear, or fader (a mixing desk's curve, as ray-slider taper="fader"): beside a fader with that taper, give both the same one and the bars line up with its marks. The zones (warn, danger) and the scale follow it. |
marks | — | array | Your own scale, in dB (replaces the one of scale). | |
label | label | string | Level (text meter.label) | The accessible name. |
| Event | Description |
|---|---|
ray-clip | A channel's peak reached clip (once until its mark is cleared). |
| Part | Description |
|---|---|
channels | The bars (role=meter). |
channel | One channel (data-clipped when clipped). |
track | A bar's track. |
peak | The peak level (translucent). |
rms | The RMS level (solid). |
hold | The peak hold line. |
scale | The dB scale. |
tick | A label of the scale. |
Texts
What it writes itself, in English; setStrings() translates them (Getting started: Languages).
| Key | English |
|---|---|
meter.label | Level |
meter.value | {value} dB |
meter.silent | Silence |