# SOUL for linear algebra based analog simulations?

Hi folks!

After years of wandering through the maze of life, I’m very happy to see the recent development in the JUCE galaxy. SOUL is a very promising project.

Since i’m working on analog circuit simulation using the ACME project, my first question is about the C++ code integration. As first sight, the concept is similar to Faust project where you can include some external datas by including headers files. I’m pretty sure that there’s no equivalent in SOUL because the langage abstraction. But what about building synth based on analog modeling?

We’ve a cool Diode clipper with solver based on Newton iteration, good point. But in the case of more complex circuit where linear algebra and matrices based solver are needed? To be more specific, ACME (Analog Circuit Modeling and Emulation) is a brillant Julia project (ACME.jl) based on the scientific works of Martin Holters. This project allow to discretize circuit from schematic with less restriction than the DK-Method. See the paper : M. Holters, U. Zölzer, “A Generalized Method for the Derivation of Non-Linear State-Space Models from Circuit Schematics”

I’ve port the ACME project for some personal reason to C++ (Julia is slow on my oldschool computer) and attempt to generate on the fly the discretized model to and exploitable C++ version using the very good Fastor library developped by Roman Poya. Fastor is compile-time Linear Algebra based on Tensor based on optimized Expression Template.

You can read my github issue on ACME for more information about my idea : Proof of concept - C++ backend using Fastor Library · Issue #28 · HSU-ANT/ACME.jl · GitHub

For example, the clone of the guitar stompbox BOSS SD-1 (Overdrive with 4 diodes, 2 transistors, 2 opamps for the non-linear part) become after discretization a bunch of matrix (tensor) manipulation followed by a simple LU-based solver with homotopy iterations.

OK. So my question is here. If coding some of theses solvers (including the LU factorization & solver) with SOUL syntax seem trivial. The problem come with the linear algebra kind of matrix operations. Maybe i’m wrong but I don’t think SOUL support multidimensional arrays and/or matrix?

I understand that this kind of project is very specific, but ACME can be used to discretize all or part from circuits. For example, you can easily decompose and isolate some analog synth schematic that is sound critical and emulate the rest of the circuit as common simplification using SOUL “as usual”. That’s why, maybe calling some external process can be an alternative to integrate a complex linear algebra support.

I don’t know if this kind of idea can be integrated inside the JIT building without broke the optimization process. But for my user point of view, that can be a very good point in the future.

In all case, very good work guys! Congratulations! And Jule, what a long way we have come in all these years, I never thought that JUCE would take such a turn. It is always a pleasure to code with your framework.

Cheers,
Maxime ‘maxprod’ Coorevits

3 Likes

Hi there, yes, circuit simulation is a DSP approach we’d like to make feel very natural and easy in SOUL, and I agree, we need good matrix support to make that happen. We’ve been talking about adding it for a while, and I think the most natural fit will be to see this as a multi-dimensional vector (so you’d have types like float<4,6>).

At present you can sort of fake multi-dimensional arrays by creating an array of structs, with the structure containing another array as a member. It’s not pretty though…

2 Likes