Giter VIP home page Giter VIP logo

Comments (9)

jpcima avatar jpcima commented on May 18, 2024 1

@redtide edited.
Also, added the All-pass and Notch.

from sfizz.

paulfd avatar paulfd commented on May 18, 2024 1

Hi @jpcima and thank for all this work. I may not have time until this WE but I will prepare integration then and we can discuss more on a pull request if that's OK with you?

from sfizz.

redtide avatar redtide commented on May 18, 2024

brf_2p is listed in SFZ1 fil_type, I kept them separated.

from sfizz.

jpcima avatar jpcima commented on May 18, 2024

Here, I implemented the Hal Chamberlin state-variable filter.
This one fits requirements to implement the *_sv opcodes, but needs way more precaution.
chamberlin.dsp.gz

Reference: https://www.earlevel.com/main/2003/03/02/the-digital-state-variable-filter/

As noted from the article:

The main drawback of the digital state variable is that it becomes unstable at higher frequencies. It depends on the Q setting, but basically the upper bound of stability is about where f reaches 1, which is at one-sixth of the sample rate (8 kHz at 48 kHz). The only way around this is to oversample. A simple way to double the filter’s sample rate (and thereby double the filter’s frequency range) is to run the filter twice with the same input sample, and discard one output sample.

It means if we want to permit range up to 22 kHz, oversample by 3 and call the filter with 1/3 effective cutoff.
(Assuming 44.1 kHz as FsMin)

from sfizz.

jpcima avatar jpcima commented on May 18, 2024

More general notes:

The cutoff is modulable, it means to recompute the filter coeffs, potentially at the audio rate.

  • as it is, the operation will be expensive, considering it makes 1 or 2 mathcalls each audio frame (sin, cos, or "sincos" if known to compiler)
  • a way to reduce computation, it's to update filter coeffs less frequently. for example, only update every Nth frame (typical N=16).
  • in effect, this creates a staircase effect; while probably not perceptible, it needs to check if strong modulation affects the filter stability
  • when LFO exists, it should be tested at extreme conditions that the filter stability holds well. one can generate the faust code with internal double precision to improve numerical robustness. (flag -double)

from sfizz.

jpcima avatar jpcima commented on May 18, 2024

I made a multimode-filter wrapper class. It is a very simple API.
https://github.com/jpcima/sfz-filters-experimental

It's probable that sfizz can use it like it is, however, it will be better if I make also a dedicated stereo wrapper, because then it can optimize filter computations further.

It permits modulation of Cutoff and Q. It works like this:

  • Filter coeffs will recompute at some particular time intervals, such that it's less computation than updating it every frame. Computing the filter involves trigonometric functions.
  • The coeffs are also going to be smoothed (an advice of David), such that it will be more robust in case of strong modulation. Also note than in this configuration, vectorizing is not possible.
  • The smoothing is not really calibrated at this point, it was set to a default thing, which means a LFO may possibly lag. I left a TODO comment at smoothCoefs.

from sfizz.

jpcima avatar jpcima commented on May 18, 2024

Implemented most of filters in the sfz-filters-experimental repo above.
I think code as ready to be copied into sfizz at this point.

  • added an optimized specialization for stereo
  • added state-variable filters, based on Eric Tarr's Sallen-Key digital model
  • had to upgrade the precision to double, as some models were instable (eg. the 6-poles)

From observation, state-variable variants don't have a lot of difference with ordinary biquads.

In the repo, you can find also a JACK Qt client if you'd like to test these filters.

from sfizz.

jpcima avatar jpcima commented on May 18, 2024

Added the Peaking EQ and shelves.

from sfizz.

paulfd avatar paulfd commented on May 18, 2024

Let's move this into the release, thanks alot!

from sfizz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.