namespace DeepDrftContent.Processors; /// /// Strategy for reducing a stream of PCM samples to a fixed-length, peak-normalized loudness /// envelope. Swappable so the loudness measure (RMS today, LUFS later) can change without /// touching WaveformProfileService, the stored wire format, or the frontend renderer. /// public interface ILoudnessAlgorithm { /// /// Computes a peak-normalized loudness profile from raw interleaved PCM. /// /// Interleaved, little-endian PCM sample bytes (the WAV data chunk). /// Number of interleaved channels; averaged to mono per sample. /// Samples per second (unused by RMS but part of the contract for measures that need it). /// Bit depth (8 unsigned, 16/24/32 signed) used to decode samples. /// Number of equal time slices to reduce the signal to. /// /// A double[bucketCount], each value in [0, 1], peak-normalized so the loudest bucket /// is 1. All zeros when the signal is silent (peak is 0) or no samples are present. /// double[] Compute(ReadOnlySpan pcmData, int channels, int sampleRate, int bitsPerSample, int bucketCount); }