OpenShot Audio Library | OpenShotAudio  0.3.0
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 
27 namespace juce
28 {
29 namespace dsp
30 {
31 
41 template <typename FloatType>
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 
260  {
261  ReferenceCountedArray<IIRCoefficients> directPath, delayedPath;
262  Array<double> alpha;
263  };
264 
285  static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod (FloatType normalisedTransitionWidth,
286  FloatType stopbandAmplitudedB);
287 
288 private:
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
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev1Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderEllipticMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderChebyshev2Method(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
static IIRPolyphaseAllpassStructure designIIRLowpassHalfBandPolyphaseAllpassMethod(FloatType normalisedTransitionWidth, FloatType stopbandAmplitudedB)
static FIRCoefficientsPtr designFIRLowpassLeastSquaresMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType stopBandWeight)
static FIRCoefficientsPtr designFIRLowpassTransitionMethod(FloatType frequency, double sampleRate, size_t order, FloatType normalisedTransitionWidth, FloatType spline)
static FIRCoefficientsPtr designFIRLowpassWindowMethod(FloatType frequency, double sampleRate, size_t order, WindowingMethod type, FloatType beta=static_cast< FloatType >(2))
static FIRCoefficientsPtr designFIRLowpassHalfBandEquirippleMethod(FloatType normalisedTransitionWidth, FloatType amplitudedB)
static ReferenceCountedArray< IIRCoefficients > designIIRLowpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType passbandAmplitudedB, FloatType stopbandAmplitudedB)
static FIRCoefficientsPtr designFIRLowpassKaiserMethod(FloatType frequency, double sampleRate, FloatType normalisedTransitionWidth, FloatType amplitudedB)
static ReferenceCountedArray< IIRCoefficients > designIIRHighpassHighOrderButterworthMethod(FloatType frequency, double sampleRate, int order)