Skip to content

Add audio-engineering quantities and normalized parameter tapers#88

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/vst-plugin-upstream-djlud9
Jun 9, 2026
Merged

Add audio-engineering quantities and normalized parameter tapers#88
matt-edmondson merged 1 commit into
mainfrom
claude/vst-plugin-upstream-djlud9

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

Implements upstream roadmap item #2 from the .NET VST3 effects host plan: the audio-engineering quantities the existing SI/Acoustic domains don't cover, plus the host-normalization mapping that lets an effect parameter become "a thin, type-safe wrapper" with correct display formatting for free.

A new self-contained AudioEngineering/ set of generic value types (ktsu.Semantics namespace):

Type Purpose
Decibels<T> / Gain<T> logarithmic level ↔ linear amplitude (20·log10) and power (10·log10)
Semitones<T> / Cents<T> musical pitch intervals ↔ frequency ratios (2^(n/12), 1200 ¢/octave)
QFactor<T> filter Q ↔ absolute bandwidth (Hz) and bandwidth in octaves
Ratio<T> / Percent<T> dimensionless ratios with lossless round-trip
NormalizedParameter<T> + ParameterTaper maps host-normalized [0,1] ↔ a typed value via linear / power-skewed / logarithmic / center-anchored tapers (Denormalize/Normalize/Clamp)

Design note

dB and musical intervals are logarithmic and dimensionless, so they don't fit the linear SI unit/dimension framework (whose In() only does linear/offset conversions). These are therefore implemented as standalone readonly record struct value types — no core BootstrapUnits/PhysicalDimensions/Units files are touched, keeping the change purely additive and low-risk. They follow the library's numeric idiom (where T : struct, INumber<T> with double-based transcendental math), and provide comparison operators, CA2225-friendly operator alternates, and culture-invariant ToString formatting.

Testing

Added AudioEngineeringTests (19 cases): dB amplitude/power conversions and round-trips, semitone/cent/ratio relationships, Q ↔ bandwidth/octaves round-trip, ratio/percent conversions, all four taper mappings (incl. geometric-mean midpoint for logarithmic and WithCenter placement), clamping, and argument validation. All 19 pass locally (net10.0).

Note 1: 93 pre-existing failures in the suite are unrelated path/URI validation tests that fail under Linux path semantics in the sandbox — none are in AudioEngineering, which is additive.
Note 2: the sandbox's .NET SDK (10.0.108) predates the Roslyn the pinned ktsu.Sdk analyzers (2.8.0) require, so tests were run via the standard MSTest runner against net10.0. CI runs the full multi-target build with analyzers and style enforcement.

🤖 Part of the ktsu VST plugin upstream-enablement work.

https://claude.ai/code/session_01JQ3bQMuSYuumAnQZaYUKP7


Generated by Claude Code

Adds a self-contained AudioEngineering value-type set in support of the
.NET VST3 effects host plan (upstream roadmap item #2). These cover the
audio-engineering units the SI/Acoustic domains lack, so an effect's
parameters can be expressed as type-safe quantities with correct display
formatting and host-normalization mapping for free:

- Decibels<T> / Gain<T>: logarithmic level <-> linear amplitude (20·log10)
  and power (10·log10) conventions.
- Semitones<T> / Cents<T>: musical pitch intervals <-> frequency ratios
  (2^(n/12), 1200 cents/octave).
- QFactor<T>: filter Q <-> absolute bandwidth and bandwidth in octaves.
- Ratio<T> / Percent<T>: dimensionless ratios with lossless round-trip.
- NormalizedParameter<T> + ParameterTaper: maps host-normalized [0,1] <-> a
  typed value via linear, power-curve-skewed, logarithmic, or
  center-anchored tapers (Denormalize/Normalize/Clamp).

These are dimensionless/logarithmic and deliberately do not extend the
linear SI unit/dimension framework, so no core bootstrap/dimension/unit
files are touched — the change is purely additive. All types are generic
over INumber<T> following the library's double-based transcendental math
idiom, with comparison operators, friendly operator alternates, and
culture-invariant formatting.

Includes 19 MSTest cases covering conversions, round-trips, taper math,
clamping, and argument validation.
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@matt-edmondson matt-edmondson merged commit a780834 into main Jun 9, 2026
5 checks passed
@matt-edmondson matt-edmondson deleted the claude/vst-plugin-upstream-djlud9 branch June 9, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants