A Collection of Useful C++ Classes for Signal Processing

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Miles1981 wrote:Audio Toolkit can be integrated as several JUCE modules, simpler than this!
And maintained...
Thanks, but I probably wasn't clear enough. I'm only trying to get the JUCE/DSPFilters demo built, I'm not using JUCE for my own stuff. ATK does seem well maintained, and rather cool, but it's not what I'm looking for at the moment. The DSPFilters code proper does build without issues and is at a more appropriate level of abstraction for my needs at the moment.

I have no interest in purchasing JUCE, but I might want to release some of my plugins, so GPL code is out of the question for now. Any other BSD/MIT licensed lightweight libraries might be of interest to me. By lightweight I mean in terms of developer usage, not CPU usage. Efficiency is not a primary goal for what I'm working on ATM. I will be incorporating them into wdl-ol based plugins and/or Synthedit externals.

Post

There is a free licence where you don't need to release your code under the GPL if you make less than 50k£ (IIRC).

The abstraction level of ATK may be a little bit higher, but not that higher, as you still can fiddle with any parameter, implement your own filter. It's just that all the buffer/memory management is handled by the library and is optimized. (and yes, it's a shameless advertisement on someone else's library topic!).

Post

Miles1981 wrote:There is a free licence where you don't need to release your code under the GPL if you make less than 50k£ (IIRC).
Is that new?
The abstraction level of ATK may be a little bit higher, but not that higher, as you still can fiddle with any parameter, implement your own filter. It's just that all the buffer/memory management is handled by the library and is optimized. (and yes, it's a shameless advertisement on someone else's library topic!).
Sure, it's just not what I'm looking for right now.

Post

Yes, it appeared with JUCE 5.

Post

hi there. i think wonderful work has benn done here. i need to implement elliptic low pass filter in c#. with all of those templates, your code is a bit difficult to understand. can u please take some time to make it easy for me by explaining in what order different functions need to be called?

Post

Hi folk !

I'm beginner for the DspFilters.

I have an app for capture sound from notebook's microphone.
Result of the capturing is not good sounds (echo, noise ..)

I have seen examples of using the filters in the Documentation.cpp,
but I don't know which of them to use for remove echo and noise side effects.

Please, tips me: what are order of (queue) applying filters to captured signal
and what are name of them :)

PS: sorry for my incompetention in this theme ))

UPD: That is naming reverberation.
I need to know: which filter from DspFilters
can remove the reverb effect from my sound

--
the best regards

Post

It generally isn't worthwhile to try to improve upon the response of a single unidirectional mic like used on a laptop or tablet. It is possible to get good results using a mid/side technique with multiple mics as some newer tablets and similar are using today but this is generally handled directly by the DSP chips rather than in software.

You will almost always get an order of magnitude or more improvement from a better mic, amplifier and recording location and only slight incremental improvements trying to apply a generalized algorithm to improve variably sourced recordings.

You can almost always design a mic and processing in combination to get highly accurate low-noise directional response like is used in the telephony mic for most modern handsets or phones. Such systems tend to provide 20 dB or better improvements rather than slight 6 dB improvements.

For improvement in terms of the intelligibility of vocal recordings generally a dynamics processing system is used rather than filters. Noise reduction is possible, but the more important aspect is to increase dynamic range between voiced vs. unvoiced portions of the audio in order to improve intelligibility. This is accomplished by a combination of gating, expanders, compressors and limiters with basic EQ.

Improving echo reduction can be accomplished if you have a stereo source: you can remove the side channel completely which will generally be almost entirely reverberation content from the environment. Unfortunately though without knowing the conditions of the environment, mic and signal path ahead of time it is impossible to create an ideal algorithm.

It is possible if you can measure an accurate IR to approximately "deconvolve" the recording but this is generally a high-latency process and extremely process intensive. It will also be very inaccurate if the environment changes: for example if the user is walking between rooms while recording.

General purpose noise reduction is always a trade-off between side-effects and noise. You can easily get near zero noise if you are also happy with near zero signal :)

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
aciddose, thank you very much, for fast and detailed answer to my question !
aciddose wrote: Improving echo reduction can be accomplished if you have a stereo source: you can remove the side channel completely which will generally be almost entirely reverberation content from the environment. Unfortunately though without knowing the conditions of the environment, mic and signal path ahead of time it is impossible to create an ideal algorithm.
Ok, I have find out this: draft-aec-03 (http://www.andreadrian.de/echo_cancel/draft-aec-03.txt)


aciddose wrote: General purpose noise reduction is always a trade-off between side-effects and noise. You can easily get near zero noise if you are also happy with near zero signal :)
:)))


PS: if you have compiled DspFilters Demo (bin version) for windows/linux - send me please )

Post

I'm trying to code an EQ plugin and I need to use several RBJ filters in series. How do I access the output samples to pass into the subsequent filters? Does the processing code modify the input array of samples directly, and if so, do I just pass it to the next filters in the chain?

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
I do some as:

Code: Select all (#)

void my_loop (void *inputBuffer, unsigned int nBufferFrames , Device* dev) {

  // here I have readed portion raw audio data from device (void *inputBuffer, unsigned int nBufferFrames)
  
  // before I need to convert datas into specific order bytes:
  float** adf = nullptr; // output data in the specific format
  pre_filter(inputBuffer, nBufferFrames, dev->audio_channels(), adf);

  { // first filter
    Dsp::Filter* f = new Dsp::FilterDesign <Dsp::ChebyshevII::Design::LowShelf <5>, 2>;
    Dsp::Params 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->setParams (params);
    f->process (nBufferFrames, adf);
  }


  { // second filter
    Dsp::SimpleFilter <Dsp::ChebyshevI::BandStop <3>, 2> f;
    f.setup (
      3,    // order
      44100,// sample rate
      1200, // center frequency
      400,  // band width
      1    // ripple dB
    );
    f.process<float> (nBufferFrames, adf);
  }


  // back converting datas into my previous format
  post_filter(inputBuffer, nBufferFrames, dev->audio_channels(), adf);
  

}

and this for convert from/to my format

Code: Select all (#)

  [[maybe_unused]] static void pre_filter(void* &data, uint32_t samples, uint32_t channels, float** &out) {
    if (!data || !samples || !channels) return;
    float *in = static_cast<float*>(data);

    if (!out) {
      out = new float*[channels];
      for (uint32_t _i = 0; _i < channels; _i++) out[_i] = new float[samples+1];
    }

    for (uint32_t _i = 0; _i < samples; _i++) {
      for (uint32_t _c = 0; _c < channels; _c++) {
        out[_c][_i] = in[_i*channels+_c];
      }
    }
  }


  [[maybe_unused]] static void post_filter(void* &data, uint32_t samples, uint32_t channels, float** &out) {
    if (!data || !out || !samples || !channels) return;
    float *in = static_cast<float*>(data);

    for (uint32_t _i = 0; _i < samples; _i++) {
      for (uint32_t _c = 0; _c < channels; _c++) {
        in[_i*channels+_c] = out[_c][_i];
      }
    }

    for (uint32_t _i = 0; _i < channels; _i++) delete[] out[_i];
    delete[] out; out = nullptr;
  }

PS: I have not tested that, only did write code for future, may be I am wrong in that ))

Post

chipnix wrote:for the record,

it seems that some numerics function from the standard library which are used by this library, behave differently when you switch the Standard Library to "libc++" in XCode ( from libstdc++ ), which is needed to support c++11 language features.

Especially std::polar
http://lists.llvm.org/pipermail/cfe-dev ... 33572.html

So if you use libc++ some filters like "low shelf butterworth" will not work with higher orders, any help appreciated.
this is my attempt at a fix:

Code: Select all

void AnalogLowShelf::design (int numPoles, double gainDb)
{
  if (m_numPoles != numPoles ||
      m_gainDb != gainDb)
  {
    m_numPoles = numPoles;
    m_gainDb = gainDb;

    reset ();

    const double n2 = numPoles * 2;
    const double g = pow (pow (10., gainDb/20), 1. / n2);
      
    double gp = -1. / g;
    double gz = -g;

    // JEFF std::polar no longer accepts negative magnitude
    double flipAngle = 0.0f;
    double gp_safe;
    double gz_safe;
    if( gp < 0 )
    {
        gp_safe = -gp;
        gz_safe = -gz;
        flipAngle = doublePi;
    }
    else
    {
        gp_safe = gp;
        gz_safe = gz;
    }
      
    const int pairs = numPoles / 2;
    for (int i = 1; i <= pairs; ++i)
    {
      const double theta = flipAngle + doublePi * (0.5 - (2 * i - 1) / n2);
      addPoleZeroConjugatePairs (std::polar (gp_safe, theta), std::polar (gz_safe, theta));
    }
    
    if (numPoles & 1)
      add (gp, gz);
  }
}

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Hello,

I'm new with this library.

I'm using this library to code the Butterworth filters for my dsp applications.

I'm trying to use as the code provided in the github page :

Code: Select all (#)

// Create a Chebyshev type I Band Stop filter of order 3
// with state for processing 2 channels of audio.
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, arrayOfChannels);
I can't find the setup method either for Chebyshev type I or Butterworh filter type.

Can you help me.
Thank you.
Florent.

Post

Hello, I am trying to do some testing on this package and I need to know what format the filters expect for the audio files. If anyone has samples of audio that I can test the filters on, that would be great too. Any help would be appreciated! thanks so much.

Post Reply

Return to “DSP and Plugin Development”