Plug-ins, Hosts, Apps,
Hardware, Soundware
Developers
(Brands)
Videos Groups
Whats's in?
Banks & Patches
Download & Upload
Music Search
KVR
   
KVR Forum » DSP and Plug-in Development
Thread Read
A Collection of Useful C++ Classes for Signal Processing
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 19, 20, 21  Next
Jeff McClintock
KVRist
- profile
- pm
- www
PostPosted: Thu Nov 03, 2011 5:03 pm reply with quote
Anyone else get problems with Elliptic filters on Mac?

When I run the demo application Elliptic Low Pass filters show a single narrow peak on the magnitude graph, the requency response graph is all wrong, and the audio turns to a loud high pitched ringing sound?
( The same setup on PC works fine.)

Any help appreciated.

Cheers, Jeff
^ Joined: 30 Jan 2005  Member: #56398  Location: New Zealand
jovanovi
KVRer
- profile
- pm
PostPosted: Mon Nov 14, 2011 1:22 pm reply with quote
I recently downloaded your DSPFilters library and I must thanks Vincent for making this code open source and providing it to different communities. I was able to use it very fast in Visual Studio 2010 and it all worked good. I am using the library in the context of prepossessing ultrasound signals for B-mode ultrasound scanners.

I have a question about the group delay of these filters. In my application i need to have a zero or constant delay. I know this is impossible with IIR filters but in some implementations we can have quasi-linear phase iir filters.

So, far I used Butterworth filter with

order = 4, samplingFrequency = 12e6 Hz; centerFrequency = 2e6 Hz; bandwidth = 3.8e6 Hz

and the phase seems to be zero, what is good for me.

However, I need to know under what conditions I can have this quasi-linear phase. Could anyone give me the exact implementation formulas or point to the paper where this is discussed or shed some light on the linear phase issue?
^ Joined: 11 Nov 2011  Member: #268452  
tl3
KVRist
- profile
- pm
- e-mail
PostPosted: Mon Dec 19, 2011 7:41 pm reply with quote
Can anyone help me figure out what I'm doing wrong in my attempt to incorporate dspfilters into my project?

Just adding this as a test, and trying to compile, I get a lot of errors like this.

Error 1 error C2039: 'Parameters' : is not a member of 'Dsp' C:\Users\Tyson\Documents\Visual Studio 2010\Projects\UNIVERSIFYER\UNIVERSIFYER\UV.cpp 75 1 UNIVERSI FYER

Error 8 error C2039: 'setParameters' : is not a member of 'Dsp::Filter' C:\Users\Tyson\Documents\Visual Studio 2010\Projects\UNIVERSIFYER\UNIVERSIFYER\UV.cpp 79 1 UNIVERSI FYER

Error 20 error C2065: 'Parameters' : undeclared identifier C:\Users\Tyson\Documents\Visual Studio 2010\Projects\UNIVERSIFYER\UNIVERSIFYER\UV.cpp 102 1 UNIVERS IFYER


I'm just trying to get a n order butterworth high pass and low pass to work, and I don't need parameter smoothing, and I'm not working in real time. I just have an array of audio samples I would like to process.

#include "DspFilters\Dsp.h"

static void UsageExamples ()
{
  // create a two channel audio buffer
  int numSamples = 2000;
  float* audioData[2];
  audioData[0] = new float[numSamples];
  audioData[1] = new float[numSamples];

  // create a 2-channel RBJ Low Pass with parameter smoothing
  // and apply it to the audio data
  {
    // "1024" is the number of samples over which to fade parameter changes
    Dsp::Filter* f = new Dsp::SmoothedFilterDesign
      <Dsp::RBJ::Design::LowPass, 2> (1024);
    Dsp::Parameters params;
    params[0] = 44100; // sample rate
    params[1] = 4000; // cutoff frequency
    params[2] = 1.25; // Q
    f->setParameters (params);
    f->process (numSamples, audioData);
  }
 
  // set up a 2-channel RBJ High Pass with parameter smoothing,
  // but bypass virtual function overhead
  {
    // the difference here is that we don't go through a pointer.
    Dsp::SmoothedFilterDesign <Dsp::RBJ::Design::LowPass, 2> f (1024);
    Dsp::Parameters params;
    params[0] = 44100; // sample rate
    params[1] = 4000; // cutoff frequency
    params[2] = 1.25; // Q
    f.setParameters (params);
    f.process (numSamples, audioData);
  }

  // create a 2-channel Butterworth Band Pass of order 4,
  // with parameter smoothing and apply it to the audio data.
  // Output samples are generated using Direct Form II realization.
  {
    Dsp::Filter* f = new Dsp::SmoothedFilterDesign
      <Dsp::Butterworth::Design::BandPass <4>, 2, Dsp::DirectFormII> (1024);
    Dsp::Parameters params;
    params[0] = 44100; // sample rate
    params[1] = 4; // order
    params[2] = 4000; // center frequency
    params[3] = 880; // band width
    f->setParameters (params);
    f->process (numSamples, audioData);
  }
 
  // create a 2-channel Inverse Chebyshev Low Shelf of order 5
  // and passband ripple 0.1dB, without parameter smoothing and apply it.
  {
    Dsp::Filter* f = new Dsp::FilterDesign
      <Dsp::ChebyshevII::Design::LowShelf <5>, 2>;
    Dsp::Parameters params;
    params[0] = 44100; // sample rate
    params[1] = 5; // order
    params[2] = 4000; // corner frequency
    params[3] = 6; // shelf gain
    params[4] = 0.1; // passband ripple
    f->setParameters (params);
    f->process (numSamples, audioData);
  }
 
  // create an abstract Butterworth High Pass of order 4.
  // This one can't process channels, it can only be used for analysis
  // (i.e. extract poles and zeros).
  {
    Dsp::Filter* f = new Dsp::FilterDesign
      <Dsp::Butterworth::Design::HighPass <4> >;
    Dsp::Parameters params;
    params[0] = 44100; // sample rate
    params[1] = 4; // order
    params[2] = 4000; // cutoff frequency
    f->setParameters (params);
    // this will cause a runtime assertion
    f->process (numSamples, audioData);
  }

  // Use the simple filter API to create a Chebyshev Band Stop of order 3
  // and 1dB ripple in the passband. The simle API has a smaller
  // footprint, but no introspection or smoothing.
  {
    // Note we use the raw filter instead of the one
    // from the Design namespace.
    Dsp::SimpleFilter <Dsp::ChebyshevI::BandStop <3>, 2> f;
    f.setup (3,    // order
             44100,// sample rate
             4000, // center frequency
             880,  // band width
             1);   // ripple dB
    f.process (numSamples, audioData);
  }
}
^ Joined: 10 Sep 2011  Member: #264486  
billythekidd
KVRer
- profile
- pm
PostPosted: Fri Feb 24, 2012 6:54 am reply with quote
Quote:
Anyone else get problems with Elliptic filters on Mac?


Same problem. The screenshot shows windows version (running in Parallels software under OSX) next to native OSX version.

^ Joined: 22 Mar 2011  Member: #253020  
thevinn
KVRian
- profile
- pm
- www
PostPosted: Fri Feb 24, 2012 8:15 am reply with quote
I wouldn't even know where to start in diagnosing this...

...could it be a build setting, or call to one of the built in trigonometric functions?
^ Joined: 30 Nov 2008  Member: #194779  
billythekidd
KVRer
- profile
- pm
PostPosted: Sat Feb 25, 2012 1:48 pm reply with quote
thevinn wrote:
or call to one of the built in trigonometric functions?


I think that this is the most likely candidate. The calculation of the poles is screwed up on mac. I made a new project so that the demo would build using the new modular juce and then compiled using both GCC 4.2 and Apple compiler 3.0. The problem persisted with both.

I will try and make a simple command line project next to see if I can get to the root of the problem . . . as in at least see the function call returns a different number on the mac compared to the pc.
^ Joined: 22 Mar 2011  Member: #253020  
codehead
KVRer
- profile
- pm
PostPosted: Sat Feb 25, 2012 2:35 pm reply with quote
thevinn wrote:
I wouldn't even know where to start in diagnosing this...

...could it be a build setting, or call to one of the built in trigonometric functions?


I just downloaded and took a very quick look—the use of "abs" instead of "fabs" gives an "Implicit conversion shortens 64-bit value into a 32-bit value" warning, and there are several in AnalogLowPass::design. Running the demo app, it's easy to see a quantization-like problem if you run a second order elliptic lowpass, and rotate through the "w" parameter—the poles jump to the until circle at a point.
^ Joined: 22 Dec 2010  Member: #246113  
codehead
KVRer
- profile
- pm
PostPosted: Sat Feb 25, 2012 2:59 pm reply with quote
codehead wrote:
thevinn wrote:
I wouldn't even know where to start in diagnosing this...

...could it be a build setting, or call to one of the built in trigonometric functions?


I just downloaded and took a very quick look—the use of "abs" instead of "fabs" gives an "Implicit conversion shortens 64-bit value into a 32-bit value" warning...


Yeah, that fixed it for me—change abs to fabs.
^ Joined: 22 Dec 2010  Member: #246113  
thevinn
KVRian
- profile
- pm
- www
PostPosted: Sat Feb 25, 2012 4:50 pm reply with quote
codehead wrote:
Yeah, that fixed it for me—change abs to fabs.


Wow awesome!!!

I'm in the midst of updating DSP Filters Demo to the latest juce tip so I will be testing it on Mac shortly.
^ Joined: 30 Nov 2008  Member: #194779  
thevinn
KVRian
- profile
- pm
- www
PostPosted: Sat Feb 25, 2012 7:31 pm reply with quote
I updated the SVN repo for DSP Filters:

- Replaced abs() with fabs()

- Revised the JuceAmalgam sources to use an amalgamation built from the latest modules tip

- Updated the Windows and Macintosh project files to use the new amalgamation

It seems to work great, feedback is appreciated!
^ Joined: 30 Nov 2008  Member: #194779  
billythekidd
KVRer
- profile
- pm
PostPosted: Sun Feb 26, 2012 3:33 am reply with quote
codehead wrote:

Yeah, that fixed it for me—change abs to fabs.


Awesome.
^ Joined: 22 Mar 2011  Member: #253020  
thevinn
KVRian
- profile
- pm
- www
PostPosted: Thu Mar 08, 2012 1:04 pm reply with quote
"A Collection of Useful C++ Classes for Digital Signal Processing" has moved to Github! Please update your bookmarks:

https://github.com/vinniefalco/DSPFilters

Feel free to follow and/or contribute to the project.

Thanks!
^ Joined: 30 Nov 2008  Member: #194779  
thevinn
KVRian
- profile
- pm
- www
PostPosted: Thu Mar 08, 2012 6:57 pm reply with quote
billythekidd wrote:
I made a new project so that the demo would build using the new modular juce


FYI I have updated the DSP Filters source tree to include my amalgamated version of Juce. It is split up by module - each module is in a single amalgamated .cpp. So it's really convenient.
^ Joined: 30 Nov 2008  Member: #194779  
Jeff McClintock
KVRist
- profile
- pm
- www
PostPosted: Tue Apr 10, 2012 3:50 pm reply with quote
billythekidd wrote:
codehead wrote:

Yeah, that fixed it for me—change abs to fabs.


Awesome.


*double* awesome. Thanks, that had me stumped.
^ Joined: 30 Jan 2005  Member: #56398  Location: New Zealand
thevinn
KVRian
- profile
- pm
- www
PostPosted: Tue Apr 10, 2012 4:39 pm reply with quote
Can someone give me a hand with a very simple Makefile for this thing so I can build it in my Ubuntu virtual box?

A while back someone told me it could easily be compiled by just compiling all the .cpp together, adding the magic switches to link in the right libs (X11 and whatever audio api flavor) and presto.

It should go in shared/DSPFiltersDemo/Builds/Make as Makefile (replacing the 1 line nonsense that I wrote). Fork and pull request on Github, thanks!
^ Joined: 30 Nov 2008  Member: #194779  
All times are GMT - 8 Hours

Printable version
Page 16 of 21
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 19, 20, 21  Next
Display posts from previous:   
ReplyNew TopicPrevious TopicNext Topic
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 vote in polls in this forum
Username: Password:  
KVR Developer Challenge 2012