SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MBEAudioInterpolatorFilter Class Reference

#include <filtermbe.h>

+ Collaboration diagram for MBEAudioInterpolatorFilter:

Public Member Functions

 MBEAudioInterpolatorFilter ()
 
 ~MBEAudioInterpolatorFilter ()
 
void useHP (bool useHP)
 
bool usesHP () const
 
float run (const float &sample)
 
float runHP (const float &sample)
 
float runLP (const float &sample)
 

Private Attributes

IIRFilter< float, 2 > m_filterLP
 
IIRFilter< float, 2 > m_filterHP
 
bool m_useHP
 

Static Private Attributes

static const float m_lpa [3] = {1.0, 1.392667E+00, -5.474446E-01}
 
static const float m_lpb [3] = {3.869430E-02, 7.738860E-02, 3.869430E-02}
 
static const float m_hpa [3] = {1.000000e+00, 1.667871e+00, -7.156964e-01}
 
static const float m_hpb [3] = {8.459039e-01, -1.691760e+00, 8.459039e-01}
 

Detailed Description

Uses the generic IIR filter internally

Low pass / High pass:

This is a 2 pole Chebyshev (recursive) filter using coefficients found in table 20-1 (low pass) or table 20-2 (high pass) of http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch20.pdf

For low pass fc = 0.075 For high oass fc = 0.01

Convention taken here exchanges A and B coefficients as shown in this image: https://cdn.mikroe.com/ebooks/img/8/2016/02/digital-filter-design-chapter-03-image-2-9.gif So A applies to Y and B to X

At the interpolated sampling frequency of 48 kHz the -3 dB corner is at 48 * .075 = 3.6 kHz which is perfect for voice The high pass has a 3 dB corner of 48 * 0.01 = 0.48 kHz

Low pass:

b0 = 3.869430E-02 (a0 = 1.0) b1 = 7.738860E-02 a1 = 1.392667E+00 b2 = 3.869430E-02 a2 = -5.474446E-01

High pass:

b0 = 9.567529E-01 (a0 = 1.0) b1 = -1.913506E+00 a1 = 1.911437E+00 b2 = 9.567529E-01 a2 = -9.155749E-01

given x[n] is the new input sample and y[n] the returned output sample:

y[n] = b0*x[n] + b1*x[n] + b2*x[n] + a1*y[n-1] + a2*y[n-2]

This one works directly with floats

Definition at line 64 of file filtermbe.h.

Constructor & Destructor Documentation

◆ MBEAudioInterpolatorFilter()

MBEAudioInterpolatorFilter::MBEAudioInterpolatorFilter ( )

Definition at line 27 of file filtermbe.cpp.

27  :
30  m_useHP(false)
31 {
32 }
static const float m_hpb[3]
Definition: filtermbe.h:85
IIRFilter< float, 2 > m_filterHP
Definition: filtermbe.h:78
IIRFilter< float, 2 > m_filterLP
Definition: filtermbe.h:77
static const float m_lpb[3]
Definition: filtermbe.h:82
static const float m_hpa[3]
Definition: filtermbe.h:84
static const float m_lpa[3]
Definition: filtermbe.h:81

◆ ~MBEAudioInterpolatorFilter()

MBEAudioInterpolatorFilter::~MBEAudioInterpolatorFilter ( )

Definition at line 34 of file filtermbe.cpp.

35 {}

Member Function Documentation

◆ run()

float MBEAudioInterpolatorFilter::run ( const float &  sample)

Definition at line 37 of file filtermbe.cpp.

References m_filterHP, m_filterLP, m_useHP, and IIRFilter< Type, Order >::run().

38 {
39  return m_useHP ? m_filterLP.run(m_filterHP.run(sample)) : m_filterLP.run(sample);
40 }
Type run(const Type &sample)
Definition: iirfilter.h:98
IIRFilter< float, 2 > m_filterHP
Definition: filtermbe.h:78
IIRFilter< float, 2 > m_filterLP
Definition: filtermbe.h:77
+ Here is the call graph for this function:

◆ runHP()

float MBEAudioInterpolatorFilter::runHP ( const float &  sample)

Definition at line 42 of file filtermbe.cpp.

References m_filterHP, and IIRFilter< Type, Order >::run().

Referenced by AMBEWorker::noUpsample(), and AMBEWorker::upsample().

43 {
44  return m_filterHP.run(sample);
45 }
Type run(const Type &sample)
Definition: iirfilter.h:98
IIRFilter< float, 2 > m_filterHP
Definition: filtermbe.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runLP()

float MBEAudioInterpolatorFilter::runLP ( const float &  sample)

Definition at line 47 of file filtermbe.cpp.

References m_filterLP, and IIRFilter< Type, Order >::run().

Referenced by AMBEWorker::upsample().

48 {
49  return m_filterLP.run(sample);
50 }
Type run(const Type &sample)
Definition: iirfilter.h:98
IIRFilter< float, 2 > m_filterLP
Definition: filtermbe.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useHP()

void MBEAudioInterpolatorFilter::useHP ( bool  useHP)
inline

Definition at line 70 of file filtermbe.h.

References useHP().

Referenced by AMBEWorker::handleInputMessages(), and useHP().

70 { m_useHP = useHP; }
void useHP(bool useHP)
Definition: filtermbe.h:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usesHP()

bool MBEAudioInterpolatorFilter::usesHP ( ) const
inline

Definition at line 71 of file filtermbe.h.

Referenced by AMBEWorker::noUpsample(), and AMBEWorker::upsample().

71 { return m_useHP; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_filterHP

IIRFilter<float, 2> MBEAudioInterpolatorFilter::m_filterHP
private

Definition at line 78 of file filtermbe.h.

Referenced by run(), and runHP().

◆ m_filterLP

IIRFilter<float, 2> MBEAudioInterpolatorFilter::m_filterLP
private

Definition at line 77 of file filtermbe.h.

Referenced by run(), and runLP().

◆ m_hpa

const float MBEAudioInterpolatorFilter::m_hpa = {1.000000e+00, 1.667871e+00, -7.156964e-01}
staticprivate

Definition at line 84 of file filtermbe.h.

◆ m_hpb

const float MBEAudioInterpolatorFilter::m_hpb = {8.459039e-01, -1.691760e+00, 8.459039e-01}
staticprivate

Definition at line 85 of file filtermbe.h.

◆ m_lpa

const float MBEAudioInterpolatorFilter::m_lpa = {1.0, 1.392667E+00, -5.474446E-01}
staticprivate

Definition at line 81 of file filtermbe.h.

◆ m_lpb

const float MBEAudioInterpolatorFilter::m_lpb = {3.869430E-02, 7.738860E-02, 3.869430E-02}
staticprivate

Definition at line 82 of file filtermbe.h.

◆ m_useHP

bool MBEAudioInterpolatorFilter::m_useHP
private

Definition at line 79 of file filtermbe.h.

Referenced by run().


The documentation for this class was generated from the following files: