Run It
Every instrument is mocked, so the example runs without hardware.
bash
git clone https://github.com/tofupilot/panelscd panelstofupilot run led-level-meterThe procedure
procedure.yaml
name: LED Level Meterversion: 1.0.0plugs: - key: audio_analyzer name: Audio analyzer python: plugs.audio_analyzer:AudioAnalyzermain: - key: level name: Output level python: phases.led_level_meter:level measurements: - key: level_left name: Left output level at nominal unit: "dBu" validators: - operator: ">=" expected_value: 3.5 - operator: "<=" expected_value: 4.5 - key: level_right name: Right output level at nominal unit: "dBu" validators: - operator: ">=" expected_value: 3.5 - operator: "<=" expected_value: 4.5 ui: panel: panels/meter.htmlThe panel
panels/meter.html
<div class="inst"><svg viewBox="0 0 320 210" role="img"><rect x="1" y="1" width="318" height="208" rx="10" fill="#1a1d21" stroke="#0a0b0d" stroke-width="2"/><circle cx="11" cy="11" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M9 11h4" stroke="#0a0b0d"/><circle cx="309" cy="11" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M307 11h4" stroke="#0a0b0d"/><circle cx="11" cy="199" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M9 199h4" stroke="#0a0b0d"/><circle cx="309" cy="199" r="3.2" fill="#2a2f35" stroke="#0a0b0d"/><path d="M307 199h4" stroke="#0a0b0d"/><rect x="18" y="18" width="284" height="174" rx="5" fill="#06080a" stroke="#0a0b0d" stroke-width="2"/><text x="30" y="66" text-anchor="start" style="font: 700 15px system-ui, sans-serif; letter-spacing: 0; fill: #c9cfd5">L</text><g class="lvl" data-bind="ui.l"><g class="pkh" data-bind="ui.lp"><rect x="52.6" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="52.6" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -40.000) * 99, 1), min(clamp(0, (var(--pk) - -40.862) * 99, 1), clamp(0, (-39.138 - var(--pk)) * 99, 1)))"/><rect x="60.7" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="60.7" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -38.276) * 99, 1), min(clamp(0, (var(--pk) - -39.138) * 99, 1), clamp(0, (-37.414 - var(--pk)) * 99, 1)))"/><rect x="68.9" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="68.9" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -36.552) * 99, 1), min(clamp(0, (var(--pk) - -37.414) * 99, 1), clamp(0, (-35.690 - var(--pk)) * 99, 1)))"/><rect x="77.0" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="77.0" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -34.828) * 99, 1), min(clamp(0, (var(--pk) - -35.690) * 99, 1), clamp(0, (-33.966 - var(--pk)) * 99, 1)))"/><rect x="85.1" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="85.1" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -33.103) * 99, 1), min(clamp(0, (var(--pk) - -33.966) * 99, 1), clamp(0, (-32.241 - var(--pk)) * 99, 1)))"/><rect x="93.3" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="93.3" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -31.379) * 99, 1), min(clamp(0, (var(--pk) - -32.241) * 99, 1), clamp(0, (-30.517 - var(--pk)) * 99, 1)))"/><rect x="101.4" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="101.4" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -29.655) * 99, 1), min(clamp(0, (var(--pk) - -30.517) * 99, 1), clamp(0, (-28.793 - var(--pk)) * 99, 1)))"/><rect x="109.5" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="109.5" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -27.931) * 99, 1), min(clamp(0, (var(--pk) - -28.793) * 99, 1), clamp(0, (-27.069 - var(--pk)) * 99, 1)))"/><rect x="117.7" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="117.7" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -26.207) * 99, 1), min(clamp(0, (var(--pk) - -27.069) * 99, 1), clamp(0, (-25.345 - var(--pk)) * 99, 1)))"/><rect x="125.8" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="125.8" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -24.483) * 99, 1), min(clamp(0, (var(--pk) - -25.345) * 99, 1), clamp(0, (-23.621 - var(--pk)) * 99, 1)))"/><rect x="133.9" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="133.9" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -22.759) * 99, 1), min(clamp(0, (var(--pk) - -23.621) * 99, 1), clamp(0, (-21.897 - var(--pk)) * 99, 1)))"/><rect x="142.1" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="142.1" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -21.034) * 99, 1), min(clamp(0, (var(--pk) - -21.897) * 99, 1), clamp(0, (-20.172 - var(--pk)) * 99, 1)))"/><rect x="150.2" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="150.2" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -19.310) * 99, 1), min(clamp(0, (var(--pk) - -20.172) * 99, 1), clamp(0, (-18.448 - var(--pk)) * 99, 1)))"/><rect x="158.3" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="158.3" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -17.586) * 99, 1), min(clamp(0, (var(--pk) - -18.448) * 99, 1), clamp(0, (-16.724 - var(--pk)) * 99, 1)))"/><rect x="166.5" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="166.5" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -15.862) * 99, 1), min(clamp(0, (var(--pk) - -16.724) * 99, 1), clamp(0, (-15.000 - var(--pk)) * 99, 1)))"/><rect x="174.6" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="174.6" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -14.138) * 99, 1), min(clamp(0, (var(--pk) - -15.000) * 99, 1), clamp(0, (-13.276 - var(--pk)) * 99, 1)))"/><rect x="182.7" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="182.7" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -12.414) * 99, 1), min(clamp(0, (var(--pk) - -13.276) * 99, 1), clamp(0, (-11.552 - var(--pk)) * 99, 1)))"/><rect x="190.9" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="190.9" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -10.690) * 99, 1), min(clamp(0, (var(--pk) - -11.552) * 99, 1), clamp(0, (-9.828 - var(--pk)) * 99, 1)))"/><rect x="199.0" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="199.0" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -8.966) * 99, 1), min(clamp(0, (var(--pk) - -9.828) * 99, 1), clamp(0, (-8.103 - var(--pk)) * 99, 1)))"/><rect x="207.1" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="207.1" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -7.241) * 99, 1), min(clamp(0, (var(--pk) - -8.103) * 99, 1), clamp(0, (-6.379 - var(--pk)) * 99, 1)))"/><rect x="215.3" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="215.3" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -5.517) * 99, 1), min(clamp(0, (var(--pk) - -6.379) * 99, 1), clamp(0, (-4.655 - var(--pk)) * 99, 1)))"/><rect x="223.4" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="223.4" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -3.793) * 99, 1), min(clamp(0, (var(--pk) - -4.655) * 99, 1), clamp(0, (-2.931 - var(--pk)) * 99, 1)))"/><rect x="231.5" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="231.5" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -2.069) * 99, 1), min(clamp(0, (var(--pk) - -2.931) * 99, 1), clamp(0, (-1.207 - var(--pk)) * 99, 1)))"/><rect x="239.7" y="26" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="239.7" y="26" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -0.345) * 99, 1), min(clamp(0, (var(--pk) - -1.207) * 99, 1), clamp(0, (0.517 - var(--pk)) * 99, 1)))"/><rect x="247.8" y="26" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="247.8" y="26" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 1.379) * 99, 1), min(clamp(0, (var(--pk) - 0.517) * 99, 1), clamp(0, (2.241 - var(--pk)) * 99, 1)))"/><rect x="255.9" y="26" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="255.9" y="26" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 3.103) * 99, 1), min(clamp(0, (var(--pk) - 2.241) * 99, 1), clamp(0, (3.966 - var(--pk)) * 99, 1)))"/><rect x="264.1" y="26" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="264.1" y="26" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 4.828) * 99, 1), min(clamp(0, (var(--pk) - 3.966) * 99, 1), clamp(0, (5.690 - var(--pk)) * 99, 1)))"/><rect x="272.2" y="26" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="272.2" y="26" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 6.552) * 99, 1), min(clamp(0, (var(--pk) - 5.690) * 99, 1), clamp(0, (7.414 - var(--pk)) * 99, 1)))"/><rect x="280.3" y="26" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="280.3" y="26" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 8.276) * 99, 1), min(clamp(0, (var(--pk) - 7.414) * 99, 1), clamp(0, (9.138 - var(--pk)) * 99, 1)))"/><rect x="288.5" y="26" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="288.5" y="26" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 10.000) * 99, 1), min(clamp(0, (var(--pk) - 9.138) * 99, 1), clamp(0, (10.862 - var(--pk)) * 99, 1)))"/></g></g><path d="M52.0 94v4" stroke="#7d8791"/><text x="52.0" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">-40</text><path d="M100.8 94v4" stroke="#7d8791"/><text x="100.8" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">-30</text><path d="M149.6 94v4" stroke="#7d8791"/><text x="149.6" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">-20</text><path d="M198.4 94v4" stroke="#7d8791"/><text x="198.4" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">-10</text><path d="M217.9 94v4" stroke="#7d8791"/><text x="217.9" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">-6</text><path d="M247.2 94v4" stroke="#7d8791"/><text x="247.2" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">0</text><path d="M276.5 94v4" stroke="#7d8791"/><text x="276.5" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">+6</text><path d="M296.0 94v4" stroke="#7d8791"/><text x="296.0" y="108" text-anchor="middle" style="font: 600 7.5px ui-monospace, Menlo, monospace; letter-spacing: 0; fill: #9aa8b6">+10</text><text x="30" y="158" text-anchor="start" style="font: 700 15px system-ui, sans-serif; letter-spacing: 0; fill: #c9cfd5">R</text><g class="lvl" data-bind="ui.r"><g class="pkh" data-bind="ui.rp"><rect x="52.6" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="52.6" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -40.000) * 99, 1), min(clamp(0, (var(--pk) - -40.862) * 99, 1), clamp(0, (-39.138 - var(--pk)) * 99, 1)))"/><rect x="60.7" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="60.7" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -38.276) * 99, 1), min(clamp(0, (var(--pk) - -39.138) * 99, 1), clamp(0, (-37.414 - var(--pk)) * 99, 1)))"/><rect x="68.9" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="68.9" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -36.552) * 99, 1), min(clamp(0, (var(--pk) - -37.414) * 99, 1), clamp(0, (-35.690 - var(--pk)) * 99, 1)))"/><rect x="77.0" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="77.0" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -34.828) * 99, 1), min(clamp(0, (var(--pk) - -35.690) * 99, 1), clamp(0, (-33.966 - var(--pk)) * 99, 1)))"/><rect x="85.1" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="85.1" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -33.103) * 99, 1), min(clamp(0, (var(--pk) - -33.966) * 99, 1), clamp(0, (-32.241 - var(--pk)) * 99, 1)))"/><rect x="93.3" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="93.3" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -31.379) * 99, 1), min(clamp(0, (var(--pk) - -32.241) * 99, 1), clamp(0, (-30.517 - var(--pk)) * 99, 1)))"/><rect x="101.4" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="101.4" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -29.655) * 99, 1), min(clamp(0, (var(--pk) - -30.517) * 99, 1), clamp(0, (-28.793 - var(--pk)) * 99, 1)))"/><rect x="109.5" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="109.5" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -27.931) * 99, 1), min(clamp(0, (var(--pk) - -28.793) * 99, 1), clamp(0, (-27.069 - var(--pk)) * 99, 1)))"/><rect x="117.7" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="117.7" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -26.207) * 99, 1), min(clamp(0, (var(--pk) - -27.069) * 99, 1), clamp(0, (-25.345 - var(--pk)) * 99, 1)))"/><rect x="125.8" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="125.8" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -24.483) * 99, 1), min(clamp(0, (var(--pk) - -25.345) * 99, 1), clamp(0, (-23.621 - var(--pk)) * 99, 1)))"/><rect x="133.9" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="133.9" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -22.759) * 99, 1), min(clamp(0, (var(--pk) - -23.621) * 99, 1), clamp(0, (-21.897 - var(--pk)) * 99, 1)))"/><rect x="142.1" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="142.1" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -21.034) * 99, 1), min(clamp(0, (var(--pk) - -21.897) * 99, 1), clamp(0, (-20.172 - var(--pk)) * 99, 1)))"/><rect x="150.2" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="150.2" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -19.310) * 99, 1), min(clamp(0, (var(--pk) - -20.172) * 99, 1), clamp(0, (-18.448 - var(--pk)) * 99, 1)))"/><rect x="158.3" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="158.3" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -17.586) * 99, 1), min(clamp(0, (var(--pk) - -18.448) * 99, 1), clamp(0, (-16.724 - var(--pk)) * 99, 1)))"/><rect x="166.5" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="166.5" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -15.862) * 99, 1), min(clamp(0, (var(--pk) - -16.724) * 99, 1), clamp(0, (-15.000 - var(--pk)) * 99, 1)))"/><rect x="174.6" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="174.6" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -14.138) * 99, 1), min(clamp(0, (var(--pk) - -15.000) * 99, 1), clamp(0, (-13.276 - var(--pk)) * 99, 1)))"/><rect x="182.7" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="182.7" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -12.414) * 99, 1), min(clamp(0, (var(--pk) - -13.276) * 99, 1), clamp(0, (-11.552 - var(--pk)) * 99, 1)))"/><rect x="190.9" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="190.9" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -10.690) * 99, 1), min(clamp(0, (var(--pk) - -11.552) * 99, 1), clamp(0, (-9.828 - var(--pk)) * 99, 1)))"/><rect x="199.0" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="199.0" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -8.966) * 99, 1), min(clamp(0, (var(--pk) - -9.828) * 99, 1), clamp(0, (-8.103 - var(--pk)) * 99, 1)))"/><rect x="207.1" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="207.1" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -7.241) * 99, 1), min(clamp(0, (var(--pk) - -8.103) * 99, 1), clamp(0, (-6.379 - var(--pk)) * 99, 1)))"/><rect x="215.3" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="215.3" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -5.517) * 99, 1), min(clamp(0, (var(--pk) - -6.379) * 99, 1), clamp(0, (-4.655 - var(--pk)) * 99, 1)))"/><rect x="223.4" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="223.4" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -3.793) * 99, 1), min(clamp(0, (var(--pk) - -4.655) * 99, 1), clamp(0, (-2.931 - var(--pk)) * 99, 1)))"/><rect x="231.5" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="231.5" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -2.069) * 99, 1), min(clamp(0, (var(--pk) - -2.931) * 99, 1), clamp(0, (-1.207 - var(--pk)) * 99, 1)))"/><rect x="239.7" y="116" width="6.9" height="64" rx="1.5" fill="#0f2e1b"/><rect x="239.7" y="116" width="6.9" height="64" rx="1.5" fill="#38e07a" style="opacity: max(clamp(0, (var(--lv) - -0.345) * 99, 1), min(clamp(0, (var(--pk) - -1.207) * 99, 1), clamp(0, (0.517 - var(--pk)) * 99, 1)))"/><rect x="247.8" y="116" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="247.8" y="116" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 1.379) * 99, 1), min(clamp(0, (var(--pk) - 0.517) * 99, 1), clamp(0, (2.241 - var(--pk)) * 99, 1)))"/><rect x="255.9" y="116" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="255.9" y="116" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 3.103) * 99, 1), min(clamp(0, (var(--pk) - 2.241) * 99, 1), clamp(0, (3.966 - var(--pk)) * 99, 1)))"/><rect x="264.1" y="116" width="6.9" height="64" rx="1.5" fill="#3a2a0c"/><rect x="264.1" y="116" width="6.9" height="64" rx="1.5" fill="#ffb02e" style="opacity: max(clamp(0, (var(--lv) - 4.828) * 99, 1), min(clamp(0, (var(--pk) - 3.966) * 99, 1), clamp(0, (5.690 - var(--pk)) * 99, 1)))"/><rect x="272.2" y="116" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="272.2" y="116" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 6.552) * 99, 1), min(clamp(0, (var(--pk) - 5.690) * 99, 1), clamp(0, (7.414 - var(--pk)) * 99, 1)))"/><rect x="280.3" y="116" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="280.3" y="116" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 8.276) * 99, 1), min(clamp(0, (var(--pk) - 7.414) * 99, 1), clamp(0, (9.138 - var(--pk)) * 99, 1)))"/><rect x="288.5" y="116" width="6.9" height="64" rx="1.5" fill="#3a1010"/><rect x="288.5" y="116" width="6.9" height="64" rx="1.5" fill="#ff3b3b" style="opacity: max(clamp(0, (var(--lv) - 10.000) * 99, 1), min(clamp(0, (var(--pk) - 9.138) * 99, 1), clamp(0, (10.862 - var(--pk)) * 99, 1)))"/></g></g><path d="M266.7 22v162" stroke="#f2f4f6" stroke-width=".8" stroke-dasharray="2 2"/></svg></div><style> .inst { width: min(560px, 100%); margin: 0 auto; } .inst svg { display: block; width: 100%; height: auto; } .inst text { font-family: system-ui, sans-serif; } .dp rect { fill: var(--off); } .dp.on rect, .dp[data-value=true] rect { fill: var(--on); } .led circle { fill: #2a2f35; transition: fill .15s; } .led[data-value=true] circle { fill: var(--led, #38e07a); } .ann text { fill: var(--off); transition: fill .15s; } .ann[data-value=true] text { fill: var(--on); } .d7 rect { fill: var(--off); transition: fill .08s; } .d7[data-value="0"] :is(.sa, .sb, .sc, .sd, .se, .sf) { fill: var(--on); } .d7[data-value="1"] :is(.sb, .sc) { fill: var(--on); } .d7[data-value="2"] :is(.sa, .sb, .sd, .se, .sg) { fill: var(--on); } .d7[data-value="3"] :is(.sa, .sb, .sc, .sd, .sg) { fill: var(--on); } .d7[data-value="4"] :is(.sb, .sc, .sf, .sg) { fill: var(--on); } .d7[data-value="5"] :is(.sa, .sc, .sd, .sf, .sg) { fill: var(--on); } .d7[data-value="6"] :is(.sa, .sc, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="7"] :is(.sa, .sb, .sc) { fill: var(--on); } .d7[data-value="8"] :is(.sa, .sb, .sc, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="9"] :is(.sa, .sb, .sc, .sd, .sf, .sg) { fill: var(--on); } .d7[data-value="-"] :is(.sg) { fill: var(--on); } .d7[data-value="E"] :is(.sa, .sd, .se, .sf, .sg) { fill: var(--on); } .d7[data-value="U"] :is(.sb, .sc, .sd, .se, .sf) { fill: var(--on); } .d7[data-value="r"] :is(.se, .sg) { fill: var(--on); } .lvl { --lv: var(--value, -60); } .pkh { --pk: var(--value, -99); }</style>The phase
phases/led_level_meter.py
"""Steps a 1 kHz tone up to the +4 dBu nominal level and reads both outputs.`ui.l` and `ui.r` light the bargraphs in dBu, `ui.lp` and `ui.rp` hold eachpeak for two seconds. The run records both levels at nominal."""import timeHOLD_S = 2.0def level(ui, measurements, audio_analyzer): peaks = {"l": (-99.0, 0.0), "r": (-99.0, 0.0)} t, last = 0.0, (0.0, 0.0) for _ in range(audio_analyzer.length()): left, right = audio_analyzer.read() for ch, db in (("l", left), ("r", right)): setattr(ui, ch, round(db, 2)) held, since = peaks[ch] if db > held or t - since > HOLD_S: peaks[ch] = (db, t) setattr(ui, f"{ch}p", round(peaks[ch][0], 2)) last = (left, right) t += 0.1 time.sleep(0.1) measurements.level_left = round(last[0], 2) measurements.level_right = round(last[1], 2) time.sleep(1.5)The mocked instrument
plugs/audio_analyzer.py
"""Mock audio analyzer reading an amplifier's two outputs while a 1 kHz tonesteps up to the +4 dBu nominal level. Replace it with your analyzer's driver."""import mathSTEPS = [-30, -20, -10, 0, 4, 4, 4]class AudioAnalyzer: def __init__(self): self.k = 0 def length(self): return 91 def read(self): """[left dBu, right dBu]""" step = STEPS[min(len(STEPS) - 1, self.k * len(STEPS) // self.length())] self.k += 1 return [step + 0.05 + 0.15 * math.sin(self.k * 0.43), step - 0.12 + 0.15 * math.sin(self.k * 0.38 + 1)]