OpenShot Audio Library | OpenShotAudio: juce_FilterDesign.h Source File

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_FilterDesign.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
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 5 End-User License
11 Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
12 27th April 2017).
13
14 End User License Agreement: www.juce.com/juce-5-licence
15 Privacy Policy: www.juce.com/juce-5-privacy-policy
16
17 Or: You may also use this code under the terms of the GPL v3 (see
18 www.gnu.org/licenses).
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27namespace juce
28{
29namespace dsp
30{
31
41template <typename FloatType>
42 struct FilterDesign
43{
44 using FIRCoefficientsPtr = typename FIR::Coefficients<FloatType>::Ptr;
45 using IIRCoefficients = typename IIR::Coefficients<FloatType>;
46
47 using WindowingMethod = typename WindowingFunction<FloatType>::WindowingMethod;
48
49 //==============================================================================
69 static FIRCoefficientsPtr designFIRLowpassWindowMethod (FloatType frequency, double sampleRate,
70 size_t order, WindowingMethod type,
71 FloatType beta = static_cast<FloatType> (2));
72
87 static FIRCoefficientsPtr designFIRLowpassKaiserMethod (FloatType frequency, double sampleRate,
88 FloatType normalisedTransitionWidth,
89 FloatType amplitudedB);
90
91
106 static FIRCoefficientsPtr designFIRLowpassTransitionMethod (FloatType frequency, double sampleRate,
107 size_t order,
108 FloatType normalisedTransitionWidth,
109 FloatType spline);
110
126 static FIRCoefficientsPtr designFIRLowpassLeastSquaresMethod (FloatType frequency, double sampleRate, size_t order,
127 FloatType normalisedTransitionWidth,
128 FloatType stopBandWeight);
129
142 static FIRCoefficientsPtr designFIRLowpassHalfBandEquirippleMethod (FloatType normalisedTransitionWidth,
143 FloatType amplitudedB);
144
145 //==============================================================================
161 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
162 FloatType normalisedTransitionWidth,
163 FloatType passbandAmplitudedB,
164 FloatType stopbandAmplitudedB);
165
166 //==============================================================================
177 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
178 int order);
179
190 static ReferenceCountedArray<IIRCoefficients> designIIRHighpassHighOrderButterworthMethod (FloatType frequency, double sampleRate,
191 int order);
192
207 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderChebyshev1Method (FloatType frequency, double sampleRate,
208 FloatType normalisedTransitionWidth,
209 FloatType passbandAmplitudedB,
210 FloatType stopbandAmplitudedB);
211
226 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderChebyshev2Method (FloatType frequency, double sampleRate,
227 FloatType normalisedTransitionWidth,
228 FloatType passbandAmplitudedB,
229 FloatType stopbandAmplitudedB);
230
245 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderEllipticMethod (FloatType frequency, double sampleRate,
246 FloatType normalisedTransitionWidth,
247 FloatType passbandAmplitudedB,
248 FloatType stopbandAmplitudedB);
249
259 struct IIRPolyphaseAllpassStructure
260 {
261 ReferenceCountedArray<IIRCoefficients> directPath, delayedPath;
262 Array<double> alpha;
263 };
264
285 static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod (FloatType normalisedTransitionWidth,
286 FloatType stopbandAmplitudedB);
287
288private:
289 //==============================================================================
290 static Array<double> getPartialImpulseResponseHn (int n, double kp);
291
292 static ReferenceCountedArray<IIRCoefficients> designIIRLowpassHighOrderGeneralMethod (int type, FloatType frequency, double sampleRate,
293 FloatType normalisedTransitionWidth,
294 FloatType passbandAmplitudedB,
295 FloatType stopbandAmplitudedB);
296 FilterDesign() = delete;
297};
298
299} // namespace dsp
300} // namespace juce
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:49
juce::dsp::FilterDesign
Definition: juce_FilterDesign.h:43
juce::dsp::FilterDesign::designIIRLowpassHighOrderButterworthMethod
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition: juce_FilterDesign.cpp:341
juce::dsp::FilterDesign::designFIRLowpassLeastSquaresMethod
static FIRCoefficientsPtr designFIRLowpassLeastSquaresMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType stopBandWeight)
Definition: juce_FilterDesign.cpp:129
juce::dsp::FilterDesign::designFIRLowpassKaiserMethod
static FIRCoefficientsPtr designFIRLowpassKaiserMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType amplitudedB)
Definition: juce_FilterDesign.cpp:68
juce::dsp::FilterDesign::designIIRLowpassHalfBandPolyphaseAllpassMethod
static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod(FloatType normalisedTransitionWidth, FloatType stopbandAmplitudedB)
Definition: juce_FilterDesign.cpp:613
juce::dsp::FilterDesign::designIIRLowpassHighOrderChebyshev1Method
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev1Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition: juce_FilterDesign.cpp:352
juce::dsp::FilterDesign::designIIRHighpassHighOrderButterworthMethod
static ReferenceCountedArray< IIRCoefficients > designIIRHighpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, int order)
Definition: juce_FilterDesign.cpp:578
juce::dsp::FilterDesign::designFIRLowpassTransitionMethod
static FIRCoefficientsPtr designFIRLowpassTransitionMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType spline)
Definition: juce_FilterDesign.cpp:96
juce::dsp::FilterDesign::designIIRLowpassHighOrderChebyshev2Method
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev2Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition: juce_FilterDesign.cpp:363
juce::dsp::FilterDesign::designIIRLowpassHighOrderEllipticMethod
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderEllipticMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
Definition: juce_FilterDesign.cpp:374
juce::dsp::FilterDesign::designFIRLowpassHalfBandEquirippleMethod
static FIRCoefficientsPtr designFIRLowpassHalfBandEquirippleMethod(FloatType normalisedTransitionWidth, FloatType amplitudedB)
Definition: juce_FilterDesign.cpp:239
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:34
juce::dsp::FilterDesign::IIRPolyphaseAllpassStructure
Definition: juce_FilterDesign.h:260
juce::dsp::IIR::Coefficients
Definition: juce_dsp/processors/juce_IIRFilter.h:158