# Audio meter

> Sample-peak meters in dBFS with a scale, peak hold and held peak read-outs, a clip indicator in words, stereo and 5.1 in channel order, and the 2px meter that lives in a track header.

Source: https://kwark.space/designSystem/components/audio-meter

## Usage

### What it is
How loud each channel is right now, in dBFS (0 is the ceiling of digital audio). It is for levels and clipping; programme loudness is the [Loudness meter](https://kwark.space/designSystem/components/loudness-meter.md).

### Zones
| Zone | Range | Colour |
|---|---|---|
| Normal | below −10 dBFS | `--k-ok` |
| Hot | −10 to −1 dBFS | `--k-warn` |
| Over | above −1 dBFS | `--k-danger` |

Red is only for the top: where a true-peak limit or clipping is at stake.

### Peak hold and clip
- A 2px line holds the highest recent peak for 2 seconds, then falls.
- The held peak is written above each channel; over 0 it turns red.
- **Clip** lights in words, with the channel (*Clip L*), and stays lit until clicked.

### Channel order
Show the order the file uses and label every channel. The common SMPTE/ITU order for 5.1 is L, R, C, LFE, Ls, Rs; some software uses film order (L, C, R, Ls, Rs, LFE). Never assume.

**Do:** *Clip L* lit with *+0.4* above the left channel of the FX bus.

**Don't:** A meter with no scale and a red zone that starts at −20.

## Style

### Anatomy

1. **Clip indicator**: 18px, the word *Clip* (and channel); lit = `--k-danger` fill.
2. **Peak read-outs**: 11px, one per channel.
3. **Scale**: 0, −6, −12, −18, −24, −30, −40, −50, −60 at 11px.
4. **Channel**: 6px wide on `--k-pro-lane`; three zones; unlit part is the well.
5. **Peak hold**: 2px across the channel.
6. **Labels**: L, R, C, LFE, Ls, Rs under each channel.
7. **Header meter**: 2px (or 4px horizontal) with a peak tick.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-ok` | #2c6e49 | #6cc08a |
| `--k-warn` | #8a5a00 | #d8a44a |
| `--k-danger` | #b4382c | #e0685c |
| `--k-pro-lane` | #fcfcfd | #141416 |
| `--k-pro-control` | #ffffff | #2a2a2e |
| `--k-pro-line` | #d3d9e0 | rgba(255, 255, 255, .09) |
| `--k-text-2` | #5b6779 | #9ca3af |

### Numbers
| Part | Value |
|---|---|
| Height | 180px in a meter bridge; 176px in a channel strip |
| Channel width | 6px, 2px apart |
| Ballistics | sample peak, 0 ms attack, 20 dB/s fall; hold 2 s |
| Scale mapping | 0 at the top, −60 at the bottom; −12 at 76%, −24 at 52% |

## Code

### React

Use the HTML below with `kwark.css`. The example shows the markup and styling. Supply any application behavior described on this page.

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<div class="kw-pro kw-pro-meters"><div class="kw-pro-mgroup" role="group" aria-label="Master meters">
    <span class="kw-pro-clipind">Clip</span>
    <div class="kw-pro-mgroup__peaks"><span>−6.1</span><span>−6.4</span></div>
    <div class="kw-pro-mgroup__body"><span class="kw-pro-mscale" aria-hidden="true"><i style="bottom:100%">0</i><i style="bottom:88%">−6</i><i style="bottom:76%">−12</i><i style="bottom:64%">−18</i><i style="bottom:52%">−24</i><i style="bottom:42%">−30</i><i style="bottom:28%">−40</i><i style="bottom:14%">−50</i><i style="bottom:0%">−60</i></span><span class="kw-pro-mgroup__ch"><span class="kw-pro-mch" role="meter" aria-label="Master L" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-12" aria-valuetext="−12.0 dBFS, peak −6.1" style="--l:76%;--p:87.8%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master R" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-12.6" aria-valuetext="−12.6 dBFS, peak −6.4" style="--l:74.8%;--p:87.2%"><i></i><i></i><i></i><b></b><s></s></span></span></div>
    <div class="kw-pro-mgroup__labels"><span>L</span><span>R</span></div>
    <span class="kw-pro-mgroup__name"><b>Master</b>Stereo · dBFS</span>
  </div><div class="kw-pro-mgroup" role="group" aria-label="FX bus meters">
    <span class="kw-pro-clipind" data-on>Clip L</span>
    <div class="kw-pro-mgroup__peaks"><span class="kw-pro-over">+0.4</span><span>−1.8</span></div>
    <div class="kw-pro-mgroup__body"><span class="kw-pro-mscale" aria-hidden="true"><i style="bottom:100%">0</i><i style="bottom:88%">−6</i><i style="bottom:76%">−12</i><i style="bottom:64%">−18</i><i style="bottom:52%">−24</i><i style="bottom:42%">−30</i><i style="bottom:28%">−40</i><i style="bottom:14%">−50</i><i style="bottom:0%">−60</i></span><span class="kw-pro-mgroup__ch"><span class="kw-pro-mch" data-clip role="meter" aria-label="FX bus L" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="0" aria-valuetext="0.0 dBFS, peak +0.4, clipped" style="--l:100%;--p:100%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="FX bus R" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-4" aria-valuetext="−4.0 dBFS, peak −1.8" style="--l:92%;--p:96.4%"><i></i><i></i><i></i><b></b><s></s></span></span></div>
    <div class="kw-pro-mgroup__labels"><span>L</span><span>R</span></div>
    <span class="kw-pro-mgroup__name"><b>FX bus</b>Stereo · over</span>
  </div><div class="kw-pro-mgroup" role="group" aria-label="Master 5.1 meters">
    <span class="kw-pro-clipind">Clip</span>
    <div class="kw-pro-mgroup__peaks"><span>−11</span><span>−12</span><span>−8.2</span><span>−31</span><span>−22</span><span>−23</span></div>
    <div class="kw-pro-mgroup__body"><span class="kw-pro-mscale" aria-hidden="true"><i style="bottom:100%">0</i><i style="bottom:88%">−6</i><i style="bottom:76%">−12</i><i style="bottom:64%">−18</i><i style="bottom:52%">−24</i><i style="bottom:42%">−30</i><i style="bottom:28%">−40</i><i style="bottom:14%">−50</i><i style="bottom:0%">−60</i></span><span class="kw-pro-mgroup__ch"><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 L" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-18" aria-valuetext="−18.0 dBFS, peak −11.0" style="--l:64%;--p:78%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 R" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-19" aria-valuetext="−19.0 dBFS, peak −12.0" style="--l:62%;--p:76%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 C" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-14" aria-valuetext="−14.0 dBFS, peak −8.2" style="--l:72%;--p:83.6%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 LFE" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-40" aria-valuetext="−40.0 dBFS, peak −31.0" style="--l:28%;--p:40.6%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 Ls" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-30" aria-valuetext="−30.0 dBFS, peak −22.0" style="--l:42%;--p:56%"><i></i><i></i><i></i><b></b><s></s></span><span class="kw-pro-mch" role="meter" aria-label="Master 5.1 Rs" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-31" aria-valuetext="−31.0 dBFS, peak −23.0" style="--l:40.6%;--p:54%"><i></i><i></i><i></i><b></b><s></s></span></span></div>
    <div class="kw-pro-mgroup__labels"><span>L</span><span>R</span><span>C</span><span>LFE</span><span>Ls</span><span>Rs</span></div>
    <span class="kw-pro-mgroup__name"><b>Master 5.1</b>L R C LFE Ls Rs</span>
  </div>
  <div class="kw-pro-hm" role="group" aria-label="Track header meters"><span class="kw-pro-dim">In a track header</span><div class="kw-pro-hm__row"><span>A1 DX Mira</span><span class="kw-pro-hm__bar" role="meter" aria-label="A1 DX Mira" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-16" aria-valuetext="−16.0 dBFS"><b style="width:68%"></b><s style="left:81.2%"></s></span></div><div class="kw-pro-hm__row"><span>A2 DX Selvi</span><span class="kw-pro-hm__bar" role="meter" aria-label="A2 DX Selvi" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-60" aria-valuetext="silent"><b style="width:0%"></b><s style="left:0%"></s></span></div><div class="kw-pro-hm__row"><span>A3 ADR Mira</span><span class="kw-pro-hm__bar" role="meter" aria-label="A3 ADR Mira" aria-valuemin="-60" aria-valuemax="0" aria-valuenow="-20" aria-valuetext="−20.0 dBFS"><b style="width:60%"></b><s style="left:72.4%"></s></span></div></div></div>
```

## Accessibility

### Keyboard
| Key | Does |
|---|---|
| Tab to Clip, then Enter | Clear the clip indicator |

### ARIA
- Each channel is `role="meter"` with min −60, max 0 and value text *−12.0 dBFS, peak −6.1*.
- Clipping is announced in words once per event, never by colour alone.

## For agents

### Rules

- **Must** state units (dBFS) and show a scale.
- **Must** reserve red for the top zone and clipping.
- **Always** label channels and show the channel order the file uses.
- **Always** write Clip in words, with the channel, until it is cleared.

### AI readiness test

**Task:** Add a 5.1 meter bridge to a mix stage view.

**Give the agent:** Audio meter, Loudness meter, Sound kit.

**Constraint:** The deliverable uses SMPTE order.

**A reliable answer:**
- Six channels labelled L R C LFE Ls Rs
- dBFS scale
- Peak hold and read-outs
- Clip in words with channel
- Red only above −1 dBFS
