- Should I invert my matrix or not?
- From netlist to code: strategies to implement schematics modelling, the results
- Analog modelling: A prototype generic modeller in Python
- Analog modelling: The Moog ladder filter emulation in Python
- SD1 vs TS9
- Triode circuit
- Comparing preamps
Last month, I presented my latest work on Audio ToolKit at ADC 2018, namely how I turned a SPICE netlist to a filter.
It is now time to present some of the results here.
What is ATK Modelling?
The Modelling module is responsible for generating on the fly filters from a schema description. That description can be given as a SPICE list that gets turned into an AST, or for dynamic filter, they can also be created with components by hand.
Dynamic refers to the fact that the code generated is not optimized for the schema. Components share a virtual interface, thus adding overhead to the computation. Also the Newton Raphson algorithm is not tuned to the schema either.
Static refers to the fact that code is generated and then compiled on the fly (the code can also be tuned manually afterwards). In this case, all the computations are written and are not recreated. The matrix structures are known in advance, and the Newton Raphson can be tuned (currently still a work in progress).
Here is an example with a simplified Moog filter:
Both dynamic and static filters give the same result when run:
Let’s see how fast they go. For the dynamic filter, 1s at 96kHz consumes 80ms on an old Nehalem box:
We can see as well that the non tune dense inverse takes about half of the time, the rest being setting up the matrix. There is nothing much that can be done to make this fast.
Now if we look at the static build, we get a speed of 33ms for the filter when compiled offline, and 36ms when using the JIT, which is twice as fast as the dynamic version. Most of the time is obviously consumed in this case by the not-yet-optimized inverse int he computation:
Audio ToolKit has now a good modeller tool for SPICE net lists. The static performance will be improved in the next few months with dedicated sparse matrix inverses as well as better support for variable components.
The dynamic part is available on GitHub.