From 86ea0095469934d49814dec58c7941641af8d0a6 Mon Sep 17 00:00:00 2001 From: Cyro Date: Wed, 11 Sep 2024 18:13:57 -0500 Subject: [PATCH] feat(zita)#: Add parameter struct and helper for easier passing of zita parameters around --- SharpPipe/Docs.xml | 134 ++++++++++++++++++++++++++- SharpPipe/Helpers/ParameterHelper.cs | 27 ++++++ SharpPipe/Structs/ZitaParameters.cs | 63 +++++++++++++ 3 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 SharpPipe/Helpers/ParameterHelper.cs create mode 100644 SharpPipe/Structs/ZitaParameters.cs diff --git a/SharpPipe/Docs.xml b/SharpPipe/Docs.xml index e01f3d0..060726d 100644 --- a/SharpPipe/Docs.xml +++ b/SharpPipe/Docs.xml @@ -4,6 +4,78 @@ SharpPipe + + + Helper class for easier manipulation of parameters + + + + + Copies the parameters from one Zita filter implementation to another + + This Zita filter + The Zita filter to copy parameters from + + + + Represents the interface for Zita Reverb objects + + + + + The input delay (ms) before reverb is applied to the incoming signal (default: 60ms) + + + + + The separation between 'high' and 'low' frequencies (default: 200hz) + + + + + The time in seconds it takes for low frequencies to decrease by 60dB (default: 3 seconds) + + + + + The time in seconds it takes for mid frequencies to decrease by 60dB (default: 2 seconds) + + + + + Frequencies (hz) above this one are heard half as long as as the mid-range frequencies - e.g. when their T60 is half of the middle-range's T60 (default: 6000hz) + + + + + The center frequency (hz) of the Regalia Mitra peaking equalizer for the first section (default: 315hz) + + + + + The peak level (dB) of equalizer 1 (default: 0dB) + + + + + The center frequency (hz) of the Regalia Mitra peaking equalizer for the second section (default: 1500hz) + + + + + The peak level (dB) of equalizer 2 (default: 0dB) + + + + + Mixes the wet and dry signals - e.g. 0 is no reverb, 1 is only reverb (default: 1) + + + + + The factor (dB) to scale the output by (default: -20dB) + + @@ -75,7 +147,7 @@ Uses the 8 FDB zitareverb algorithm to provide reverb to processed samples ( see: https://paulbatchelor.github.io/res/soundpipe/docs/zitarev.html ) - + The soundpipe object used by this reverb @@ -356,5 +428,65 @@ Array struct because P/Invoke is a pain in the butt and doesn't let you do fixed buffers of pointers >:( + + + Parameter struct that implements the Zita filter interface + + + + + The input delay (ms) before reverb is applied to the incoming signal (default: 60ms) + + + + + The separation between 'high' and 'low' frequencies (default: 200hz) + + + + + The time in seconds it takes for low frequencies to decrease by 60dB (default: 3 seconds) + + + + + The time in seconds it takes for mid frequencies to decrease by 60dB (default: 2 seconds) + + + + + Frequencies (hz) above this one are heard half as long as as the mid-range frequencies - e.g. when their T60 is half of the middle-range's T60 (default: 6000hz) + + + + + The center frequency (hz) of the Regalia Mitra peaking equalizer for the first section (default: 315hz) + + + + + The peak level (dB) of equalizer 1 (default: 0dB) + + + + + The center frequency (hz) of the Regalia Mitra peaking equalizer for the second section (default: 1500hz) + + + + + The peak level (dB) of equalizer 2 (default: 0dB) + + + + + Mixes the wet and dry signals - e.g. 0 is no reverb, 1 is only reverb (default: 1) + + + + + The factor (dB) to scale the output by (default: -20dB) + + diff --git a/SharpPipe/Helpers/ParameterHelper.cs b/SharpPipe/Helpers/ParameterHelper.cs new file mode 100644 index 0000000..0147a25 --- /dev/null +++ b/SharpPipe/Helpers/ParameterHelper.cs @@ -0,0 +1,27 @@ +namespace SharpPipe; + +/// +/// Helper class for easier manipulation of parameters +/// +public static class ParameterHelper +{ + /// + /// Copies the parameters from one Zita filter implementation to another + /// + /// This Zita filter + /// The Zita filter to copy parameters from + public static void FromOther(this IZitaFilter zita, in IZitaFilter other) + { + zita.InDelay = other.InDelay; + zita.Crossover = other.Crossover; + zita.RT60Low = other.RT60Low; + zita.RT60Mid = other.RT60Mid; + zita.HighFrequencyDamping = other.HighFrequencyDamping; + zita.EQ1Frequency = other.EQ1Frequency; + zita.EQ1Level = other.EQ1Level; + zita.EQ2Frequency = other.EQ2Frequency; + zita.EQ2Level = other.EQ2Level; + zita.Mix = other.Mix; + zita.Level = other.Level; + } +} \ No newline at end of file diff --git a/SharpPipe/Structs/ZitaParameters.cs b/SharpPipe/Structs/ZitaParameters.cs new file mode 100644 index 0000000..e2b7e90 --- /dev/null +++ b/SharpPipe/Structs/ZitaParameters.cs @@ -0,0 +1,63 @@ +namespace SharpPipe; + + +/// +/// Parameter struct that implements the Zita filter interface +/// +public struct ZitaParameters : IZitaFilter +{ + /// + /// The input delay (ms) before reverb is applied to the incoming signal (default: 60ms) + /// + public float InDelay { get; set; } + + /// + /// The separation between 'high' and 'low' frequencies (default: 200hz) + /// + public float Crossover { get; set; } + + /// + /// The time in seconds it takes for low frequencies to decrease by 60dB (default: 3 seconds) + /// + public float RT60Low { get; set; } + + /// + /// The time in seconds it takes for mid frequencies to decrease by 60dB (default: 2 seconds) + /// + public float RT60Mid { get; set; } + + /// + /// Frequencies (hz) above this one are heard half as long as as the mid-range frequencies - e.g. when their T60 is half of the middle-range's T60 (default: 6000hz) + /// + public float HighFrequencyDamping { get; set; } + + /// + /// The center frequency (hz) of the Regalia Mitra peaking equalizer for the first section (default: 315hz) + /// + public float EQ1Frequency { get; set; } + + /// + /// The peak level (dB) of equalizer 1 (default: 0dB) + /// + public float EQ1Level { get; set; } + + /// + /// The center frequency (hz) of the Regalia Mitra peaking equalizer for the second section (default: 1500hz) + /// + public float EQ2Frequency { get; set; } + + /// + /// The peak level (dB) of equalizer 2 (default: 0dB) + /// + public float EQ2Level { get; set; } + + /// + /// Mixes the wet and dry signals - e.g. 0 is no reverb, 1 is only reverb (default: 1) + /// + public float Mix { get; set; } + + /// + /// The factor (dB) to scale the output by (default: -20dB) + /// + public float Level { get; set; } +} \ No newline at end of file