Hi all,
according to WDF algorithms, I would like to implement a particular fuzz model extracted from LTSpice, but i need a IIR function to calculate output signal. I'm not DSP expert (theory and implementation) so I ask for clarification.
Thanks in advance
Converting a fuzz model from Spice?
Fuzz, overdrive and distortion modelling
(moved to new topic, as this fits better in the AxoObject coding category)
There is quite a gap between an LTSpice model and a IIR function. There is no general fits-all IIR function (or it would be numerically unstable). Could you be more specific, maybe refer to a paper book or tutorial, about what you're trying to do?
Well, the link is: https://www.linuxmusicians.com/viewtopic.php?f=48&t=13625
I understood that algorithm, works firstable with the coefficients calculation and then applying IIR to that coefficients.
Is this correct?
Modeled Compressor and EQ etc
I see, this is Faust code, Faust can then convert this into c++ code. I think that code will contain the relevant IIR implementation, since there are several common types: direct-form-I, direct-form-II, transposed-form-I, transposed-form-II
I don't have experience with Faust, but exporting Faust to Axoloti objects is on my wishlist
Embedding Faust DSPs on the Axoloti
So, it seems i have a sort of crystal ball to see your desires...well, I don't have experience with Faust too, but we can try to obtain something working.
If you plan to wrap Faust-generated code into an Axoloti object, for performance reasons, it is better to use float
than double
because the processor does not have hardware support for "double".
I notice this particular algorithm uses a 5th order IIR, which I find a bit odd, as those can be numerically unstable, often IIR filters are split into 2nd order sections. Higher orders are not necessarily numerically unstable, a Karplus-Strong resonator is a very-high-order IIR. Conversion from double
to float
may or may not cause trouble for this fuzz model, if you experience numerical instability this is suspect.
Having a quick look now.
Update: can't get the online faust compiler to process the fuzzface faust code, giving up for now.
So, you want to use Karplus-Strong resonator instead of a 5th order IIR.
On my first Faust installation, the original dsp code doesn't work -> Faust crash!
No, KS is only an example of a stable, well-conditioned, high-order IIR topology, but not a replacement.
Yes, there seems to be a problem in the referenced Faust code.
I found working faust fuzzface.dsp code and corresponding fuzzface.cc. It looks quite transferable to axoloti, but I'm in doubt between addressing a single one or trying to address faust in general.
I know fuzzface.cc 'cause "time and time ago" I ported that algorithm to other architecture...just translation, without understanding! I am a bit 'tired to not understand
Back from my wedding and honeymoon
Sorry, what is the difference between k-rate and s-rate code?
the frequency of execution.
k-rate = control rate, its 3kHz , use for control signals... e.g. an envelope feeding a vca
s-rate = sample rate, aka audio rate , 48kHz, used for audio signal (or audio rate modulation)
in axoloti, the dsp callback is at k-rate (3kHz) and for each cycle we have a 16 sample buffer, so 3x16 = 48kHz.
you will find in the object editor a tab for k-rate code, s-rate code.
looking at the fuzzface.cc very quickly (so not really looking at what it did at all!)
the function:
void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
is very similar to the axoloti dsp() function which is k-rate.
where count is (I assume) the number of samples.
the k-rate function can access the entire audio buffer, and BUFSIZE is the number of samples (16)
if you look at something like osc/pwm and the filters you will kind of see what I mean.
(basically the bit in the compute() for loop is the s-rate code, but you cannot just insert this into the s-rate handler in axoloti, since you need to execute the code before and after it at k-rate... and in axoloti the k-rate code is execute before the s-rate, so you wouldn't be able to the bit after)
Another question: algorithm above uses double or float, so i decided to use float as a first test.
How can i convert/cast/scale dsp (const int32buffer inlet_i1,int32buffer & outlet_o,
buffer's integer values to float?
int param_fuxxlevel )
the buffer is an array, so you will need 2 float arrays,
you can then convert each element with
float f = v*(float)(1.0f/(1<<27))
(and the reverse) to go back to int32
(the int32 is Q27 format)
WTH...it works! I hear something...but i've to increase my bass guitar active pickup over the top...
cool, it would be interesting to hear what steps you went thru to do this...
a couple of specific questions:
- whats the performance like? (cpu)
- did you just take the faust code as a starting point and edit it, or did you get it to compile directly?