Temporal Filter Box - Bandpass order

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
ChromaticIsobar
Posts: 2
Joined: Fri May 17, 2019 2:05 pm
Location: Plymouth, UK

Temporal Filter Box - Bandpass order

Post by ChromaticIsobar »

I am using the Temporal Filter Box for band-energy computation.
I was wondering if the order of the Bandpass filter is the parameter "Filter Order" or double that, as in MATLAB, so that both the band-pass and the hi-pass transition-bands of the filter have the steepness of a "Filter Order" order filter.

I've been reading this forum for a while, but it's my first post, so if I didn't explain myself or this is not the right place or way to post my question, please let me know.

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Temporal Filter Box - Bandpass order

Post by Thibaut »

hello, this is the right place (the forum is not very big ^ ^).
Regarding, the order, I just looked at the Butterworth code. Having never had to study this type of filtering, I put you directly the part of the code use the order passed in parameter (numpole is the order) when creating the filter that you can judge by yourself.
The file is here : [OpenViBE-FOLDER]\sdk\dependencies-source\dsp-filters

Code: Select all

void AnalogLowPass::design(int numPoles)
{
	if (m_numPoles != numPoles)
	{
		m_numPoles = numPoles;
		reset();
		const double n2 = 2 * numPoles;
		const int pairs = numPoles / 2;
		for (int i = 0; i < pairs; ++i)
		{
			complex_t c = std::polar(1., doublePi_2 + (2 * i + 1) * doublePi / n2);
			addPoleZeroConjugatePairs(c, infinity());
		}
		if (numPoles & 1) { add(-1, infinity()); }
	}
}

ChromaticIsobar
Posts: 2
Joined: Fri May 17, 2019 2:05 pm
Location: Plymouth, UK

Re: Temporal Filter Box - Bandpass order

Post by ChromaticIsobar »

Thanks Thibaut for your quick answer.
Unfortunately the code snippet you posted was about the LowPass filter, but it gave me directions for where to look in the code.

In [OpenViBE-FOLDER]\sdk\dependencies-source\dsp-filters\Butterworth.h (rows 145 to 184) it can be seen that the number of poles (and zeros, I guess) is double for the band filters

Code: Select all

//
// Raw filters
//

template <int MaxOrder>
struct LowPass : PoleFilter <LowPassBase, MaxOrder>
{
};

template <int MaxOrder>
struct HighPass : PoleFilter <HighPassBase, MaxOrder>
{
};

template <int MaxOrder>
struct BandPass : PoleFilter <BandPassBase, MaxOrder, MaxOrder*2>
{
};

template <int MaxOrder>
struct BandStop : PoleFilter <BandStopBase, MaxOrder, MaxOrder*2>
{
};

template <int MaxOrder>
struct LowShelf : PoleFilter <LowShelfBase, MaxOrder>
{
};

template <int MaxOrder>
struct HighShelf : PoleFilter <HighShelfBase, MaxOrder>
{
};

template <int MaxOrder>
struct BandShelf : PoleFilter <BandShelfBase, MaxOrder, MaxOrder*2>
{
};

//------------------------------------------------------------------------------
I think this answers my question, unless someone with more experience than me in digging into the OpenVibe source code shows that I got it wrong

Post Reply