-
Notifications
You must be signed in to change notification settings - Fork 7
Specification for Volume Controls and Level Meters
Huan Zhang edited this page Sep 6, 2021
·
1 revision
Modules with Volume Controls: Player, Sample Player, Mixer, Signalgen, Directinput
Modules with Level Meters: Direct Input, Mixer, Speaker, Player
- All volume controls are the same.
- Volume is edited in
frontend/src/audio/sc-module.js, and it's universal in all modules - Displayed range of slider: let x in [0, 100]
if x >= 10:
let y = (x - 100) * 1/2 --so y is in range [0, -45]
if x < 10
let y = dB_to_linear(-45dB) * x / 10 \ - The upper part (-45dB cutoff) is logarithmic, and the lower part is linear.
- All level meters are the same.
- Level is based on dB output calculated from
frontend/src/audio/sc-analyzer.js, roughly comes in [-100, 10] - if -45 < x < 10:
scalepoint = 0.1 * width + ((x + 45) / 55) * (0.9 * width);
(map into the top (or right) 90% of the window)
else:
scalepoint = ((x + 100) / 55) * (0.1 * width);
(map into the bottom 10% of the window) - all linear in dB, but with different scale
- colors: >0dB -> red, [-12, 0]dB -> yellow, <-12dB -> green
the display of color is in linear gradient, where the color stops are (0, green), (0.75, yellow), (1, red), meaning that it's pure yellow at 0.75 (-6dB point is 0.73) length of the bar and pure green / pure red at respective ends.