VU meter

rms, peak = engine.level() # the master output, 0..1ui.audio.VuMeter(level=[rms, peak]) # one bar per valueLevels and scale
Section titled “Levels and scale”level is one number or a list (one bar per channel), as linear amplitude from 0 to 1, which is
what node.level() and engine.level() return. With scale="db" (the default) the meter shows
it in decibels from floor (−60 dB) to 0 dB, as mixers do: quiet sounds still move it.
scale="linear" shows the raw number (good for control signals).
Each channel holds its peak for hold seconds, then lets it fall.
variant |
Looks like |
|---|---|
"led" |
Segments that light up (segments of them), dim when off. |
"bar" |
A smooth bar with the colors as a gradient. |
"analog" |
A needle VU meter (−20 to +3 VU) that moves with the ~300 ms ballistics of a real one. |
colors is a palette name ("vu", "fl", "neon", "fire"… see Colors)
or a list of colors from quiet to loud. vertical=False lays it out horizontally.
| Property | Default | What it does |
|---|---|---|
level |
0 |
A level or a list of levels (0..1). |
variant |
"led" |
"led", "bar" or "analog". |
vertical |
True |
Direction of the bars. |
length, thickness |
160, 10 |
Size of each bar in pixels. |
segments |
24 |
LEDs per bar. |
scale, floor |
"db", -60 |
How a level maps to the meter. |
hold |
1.2 |
Seconds a peak is held. |
colors |
"vu" |
A palette name or a list of colors. |