CngxAudioPitch
projects/common/audio/pitch-mode/audio-pitch.directive.ts
Import#
import { CngxAudioPitch } from '@cngx/common/audio'
Description#
Pitch-mode audio binder. Sonifies a continuous numeric value: each change of
[cngxAudioPitch] clamps against a fixed domain, linear-scales into an output
frequency range, and plays a short tone. Useful for sliders, gauges, and live
metrics — the ear tracks a value without looking.
<input type="range" min="0" max="100"
[cngxAudioPitch]="volume()"
[pitchDomain]="[0, 100]"
[pitchRange]="[220, 880]" />The inputs are discrete rather than an options record so [cngxAudioPitch]
stays a native reactive input — passing [cngxAudioPitch]="volume()" binds a
signal value directly, never a Signal smuggled inside a config object. The
domain is caller-supplied and fixed; it is never accumulated from observed
values, so the directive holds no hidden state. Value-to-frequency is a pure
derivation; rapid sweeps are throttled through the shared createDebouncer.
Metadata#
Index#
Inputs#
Suppress this element's audio without unbinding.
false, { transform: booleanAttribute }number | undefinedPer-element volume multiplier in [0, 1]; unset uses the tone default.
[number, number]Fixed input domain [min, max] the value is clamped against.
[number, number]Output frequency range [lo, hi] in Hz. Default [220, 880].
[220, 880]