Add audio-engineering quantities and normalized parameter tapers#88
Merged
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.Semanticsnamespace):Decibels<T>/Gain<T>20·log10) and power (10·log10)Semitones<T>/Cents<T>2^(n/12), 1200 ¢/octave)QFactor<T>Ratio<T>/Percent<T>NormalizedParameter<T>+ParameterTaper[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 standalonereadonly record structvalue types — no coreBootstrapUnits/PhysicalDimensions/Unitsfiles are touched, keeping the change purely additive and low-risk. They follow the library's numeric idiom (where T : struct, INumber<T>withdouble-based transcendental math), and provide comparison operators, CA2225-friendly operator alternates, and culture-invariantToStringformatting.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 andWithCenterplacement), clamping, and argument validation. All 19 pass locally (net10.0).🤖 Part of the ktsu VST plugin upstream-enablement work.
https://claude.ai/code/session_01JQ3bQMuSYuumAnQZaYUKP7
Generated by Claude Code