OpenShot Audio Library | OpenShotAudio: juce_FilterDesign.h Source File

OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_FilterDesign.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce::dsp
27{
28
38template <typename FloatType>
39 struct FilterDesign
40{
41 using FIRCoefficientsPtr = typename FIR::Coefficients<FloatType>::Ptr;
42 using IIRCoefficients = typename IIR::Coefficients<FloatType>;
43
44 using WindowingMethod = typename WindowingFunction<FloatType>::WindowingMethod;
45
46 //==============================================================================
66 static FIRCoefficientsPtr designFIRLowpassWindowMethod (FloatType frequency, double sampleRate,
67 size_t order, WindowingMethod type,
68 FloatType beta = static_cast<FloatType> (2));
69
84 static FIRCoefficientsPtr designFIRLowpassKaiserMethod (FloatType frequency, double sampleRate,
85 FloatType normalisedTransitionWidth,
86 FloatType amplitudedB);
87
88
103 static FIRCoefficientsPtr designFIRLowpassTransitionMethod (FloatType frequency, double sampleRate,
104 size_t order,
105 FloatType normalisedTransitionWidth,
106 FloatType spline);
107
123 static FIRCoefficientsPtr designFIRLowpassLeastSquaresMethod (FloatType frequency, double sampleRate, size_t order,
124 FloatType normalisedTransitionWidth,
125 FloatType stopBandWeight);
126
139 static FIRCoefficientsPtr designFIRLowpassHalfBandEquirippleMethod (FloatType normalisedTransitionWidth,
140 FloatType amplitudedB);
141
142 //==============================================================================
158 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
159 FloatType normalisedTransitionWidth,
160 FloatType passbandAmplitudedB,
161 FloatType stopbandAmplitudedB);
162
163 //==============================================================================
174 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
175 int order);
176
187 static ReferenceCountedArray<IIRCoefficients> designIIRHighpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
188 int order);
189
204 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderChebyshev1Method (FloatType frequency, double sampleRate,
205 FloatType normalisedTransitionWidth,
206 FloatType passbandAmplitudedB,
207 FloatType stopbandAmplitudedB);
208
223 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderChebyshev2Method (FloatType frequency, double sampleRate,
224 FloatType normalisedTransitionWidth,
225 FloatType passbandAmplitudedB,
226 FloatType stopbandAmplitudedB);
227
242 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderEllipticMethod (FloatType frequency, double sampleRate,
243 FloatType normalisedTransitionWidth,
244 FloatType passbandAmplitudedB,
245 FloatType stopbandAmplitudedB);
246
256 struct IIRPolyphaseAllpassStructure
257 {
258 ReferenceCountedArray<IIRCoefficients> directPath, delayedPath;
259 Array<double> alpha;
260 };
261
282 static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod (FloatType normalisedTransitionWidth,
283 FloatType stopbandAmplitudedB);
284
285private:
286 //==============================================================================
287 static Array<double> getPartialImpulseResponseHn (int n, double kp);
288
289 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderGeneralMethod (int type, FloatType frequency, double sampleRate,
290 FloatType normalisedTransitionWidth,
291 FloatType passbandAmplitudedB,
292 FloatType stopbandAmplitudedB);
293 FilterDesign() = delete;
294};
295
296} // namespace juce::dsp
juce::Array
Definition juce_Array.h:56
juce::ReferenceCountedArray
Definition juce_ReferenceCountedArray.h:51
juce::ReferenceCountedObjectPtr
Definition juce_ReferenceCountedObject.h:247
juce::dsp::WindowingFunction::WindowingMethod
WindowingMethod
Definition juce_Windowing.h:46
juce::dsp::FilterDesign
Definition juce_FilterDesign.h:40
juce::dsp::FilterDesign::designIIRLowpassHighOrderButterworthMethod
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition juce_FilterDesign.cpp:337
juce::dsp::FilterDesign::designFIRLowpassLeastSquaresMethod
static FIRCoefficientsPtr designFIRLowpassLeastSquaresMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType stopBandWeight)
Definition juce_FilterDesign.cpp:126
juce::dsp::FilterDesign::designFIRLowpassKaiserMethod
static FIRCoefficientsPtr designFIRLowpassKaiserMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType amplitudedB)
Definition juce_FilterDesign.cpp:65
juce::dsp::FilterDesign::designIIRLowpassHalfBandPolyphaseAllpassMethod
static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod(FloatType normalisedTransitionWidth, FloatType stopbandAmplitudedB)
Definition juce_FilterDesign.cpp:612
juce::dsp::FilterDesign::designIIRLowpassHighOrderChebyshev1Method
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev1Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition juce_FilterDesign.cpp:348
juce::dsp::FilterDesign::designIIRHighpassHighOrderButterworthMethod
static ReferenceCountedArray< IIRCoefficients > designIIRHighpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, int order)
Definition juce_FilterDesign.cpp:577
juce::dsp::FilterDesign::designFIRLowpassTransitionMethod
static FIRCoefficientsPtr designFIRLowpassTransitionMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType spline)
Definition juce_FilterDesign.cpp:93
juce::dsp::FilterDesign::designIIRLowpassHighOrderChebyshev2Method
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev2Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition juce_FilterDesign.cpp:359
juce::dsp::FilterDesign::designIIRLowpassHighOrderEllipticMethod
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderEllipticMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition juce_FilterDesign.cpp:370
juce::dsp::FilterDesign::designFIRLowpassHalfBandEquirippleMethod
static FIRCoefficientsPtr designFIRLowpassHalfBandEquirippleMethod(FloatType normalisedTransitionWidth, FloatType amplitudedB)
Definition juce_FilterDesign.cpp:235
juce::dsp::FilterDesign::designFIRLowpassWindowMethod
static FIRCoefficientsPtr designFIRLowpassWindowMethod(FloatType frequency, double sampleRate, size_t order, WindowingMethod type, FloatType beta=static_cast< FloatType >(2))
Definition juce_FilterDesign.cpp:31
juce::dsp::FilterDesign::IIRPolyphaseAllpassStructure
Definition juce_FilterDesign.h:257
juce::dsp::IIR::Coefficients
Definition juce_dsp/processors/juce_IIRFilter.h:124