OpenViBE forum

The OpenViBE community
It is currently Sat Aug 24, 2019 6:30 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Jun 03, 2019 5:01 pm 
Offline

Joined: Fri May 17, 2019 2:05 pm
Posts: 2
Location: Plymouth, UK
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 04, 2019 8:23 am 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
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:
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()); }
   }
}


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 04, 2019 4:07 pm 
Offline

Joined: Fri May 17, 2019 2:05 pm
Posts: 2
Location: Plymouth, UK
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:
//
// 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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.