DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: potul on November 23, 2017, 10:32:47 AM

Title: any FV-1 cabsim?
Post by: potul on November 23, 2017, 10:32:47 AM
Hi All

I'm aware it's not possible to do convolutioni and use IR with the FV-1, so I guess it's not feasible to get a well donce cabsim with it... But I was wondering if at least some "poor man's" cabsim is possible. At the end... when looking at the simple DIY analog cabsims they are nothing more than filters...

So my question is, has anyone attempted to code some sort of cabsim with the FV-1?

If no, and I would need to start from scratch... what sort of filter should I be looking at to get a response similar to a cabsim?

Mat
Title: Re: any FV-1 cabsim?
Post by: Digital Larry on November 23, 2017, 12:32:59 PM
FV-1 is set up to do single pole recursive filters and 2-pole state variable filters pretty efficiently.  I've also seen 2-pole direct form IIRs done using delay RAM for the memory storage.

The old Hughes and Kettner Red Box "cab sim" direct box was just a 2-pole resonant low pass filter IIRC which could easily be made using the state variable structure.  My take on what people mean these days by "cab sim" is something that works with an impulse response.  You might be able to implement something that used 3 or 4 instructions per impulse response sample in an FIR.  You'd need to scale the input way down to prevent overload after summing up 32 samples.

Let's suppose you could get 32 samples (128 total instructions/4) at 32 kHz, that is a 1 msec impulse response to create your filter coefficients.  My guess is that this is not going to be adequate to get a lot of accuracy at low frequencies.
Title: Re: any FV-1 cabsim?
Post by: ElectricDruid on November 23, 2017, 04:10:57 PM
You could do something equivalent to this in the FV-1:

(http://cfs13.tistory.com/image/27/tistory/2009/01/21/00/45/4975f1a6bf759)

That's only a 2-pole LPF followed by a 2-pole HPF. That's going to be easy enough, I'd have thought.

Genuine impulse response sims are going to take more data-munching than the FV-1 will do, so you're back to faking it like we do in analog....

Tom
Title: Re: any FV-1 cabsim?
Post by: potul on November 23, 2017, 04:20:46 PM
Quote from: ElectricDruid on November 23, 2017, 04:10:57 PM
You could do something equivalent to this in the FV-1:

(http://cfs13.tistory.com/image/27/tistory/2009/01/21/00/45/4975f1a6bf759)

That's only a 2-pole LPF followed by a 2-pole HPF. That's going to be easy enough, I'd have thought.

Genuine impulse response sims are going to take more data-munching than the FV-1 will do, so you're back to faking it like we do in analog....

Tom

That's exactly what I had in mind.... a simple set of some 2-pole filters... I'm not trying to do any genuine IR based cab sim ... I just want to have an equivalent to these simple DIY cabsims we used to like not so long ago... :)

I will try to replicate the topology of the Bulldog, or maybe the Condor (http://runoffgroove.com/condor.html (http://runoffgroove.com/condor.html)), that uses an LPF, a HPF and a notch.

from the runoffgroove page:

Quote
Bridged-T notch filter. Produces the 400Hz notch found in the P10R response. Please note that the extra resistor in parallel with the capacitor to ground is not only for biasing the op-amp, but it also produces a high-pass shelving effect. High frequencies are then 6dB above low frequencies, as shown in the speaker response curve. To reduce the notch depth, you can replace the 1n and 15n caps with 1n5 and 10n, or even 2n2 and 6n8, respectively.

High-pass filter. This is the network between the first two op-amp stages. It simulates the low frequency rolloff of the speaker cabinet, plus the 90Hz peak. For deeper bass, you can replace the two 47nF caps with 56nF or 68nF. For less bass, use 39nF or 33nF.

Low-pass filter. These are the two identical networks between second and fourth op-amp stages. They simulate the steep high frequency rolloff of a guitar speaker, in addition to the peak near 3kHz. For more high frequency content, you can reduce the four 22k resistors to 18k or less. To cut more highs, increase them to 27k or more.
Title: Re: any FV-1 cabsim?
Post by: ElectricDruid on November 24, 2017, 04:24:23 PM
There'll be code for the simple two-pole filters on the SpinSemi website too. I'd have thought you can get close by bolting some stuff together and tweaking the coefficients to taste/by experimentation.

Good luck...;)

T.
Title: Re: any FV-1 cabsim?
Post by: Digital Larry on November 24, 2017, 08:03:23 PM
There are blocks for two pole state variable filters (high/low/bandpass) and a separate notch block (for no particularly good reason other than laziness on my part) in the latest version of SpinCAD Designer (see signature line).  It shouldn't take much time to get something basic going on and then it's just a matter of tweaking things.
Title: Re: any FV-1 cabsim?
Post by: potul on November 25, 2017, 04:55:01 AM
Quote from: Digital Larry on November 24, 2017, 08:03:23 PM
There are blocks for two pole state variable filters (high/low/bandpass) and a separate notch block (for no particularly good reason other than laziness on my part) in the latest version of SpinCAD Designer (see signature line).  It shouldn't take much time to get something basic going on and then it's just a matter of tweaking things.

Yep, ... this is what I had in mind. I will try and test
Title: Re: any FV-1 cabsim?
Post by: potul on November 27, 2017, 05:26:19 AM
Quote from: Digital Larry on November 24, 2017, 08:03:23 PM
There are blocks for two pole state variable filters (high/low/bandpass) and a separate notch block (for no particularly good reason other than laziness on my part) in the latest version of SpinCAD Designer (see signature line).  It shouldn't take much time to get something basic going on and then it's just a matter of tweaking things.

Hi Larry

I was playing a bit with the SpinCAD blocks.. and I have a doubt. The Frequency Control Input in these blocks, what does it represent? Is this the frequency coeff, or directly Hz, or maybe % vs Sampling freq?

In other words, if I want to have a filter with a giv en Hz, how do I calculate what to give to the block?

Mat


Title: Re: any FV-1 cabsim?
Post by: potul on November 28, 2017, 08:24:28 AM
Quote from: potul on November 27, 2017, 05:26:19 AM
Quote from: Digital Larry on November 24, 2017, 08:03:23 PM
There are blocks for two pole state variable filters (high/low/bandpass) and a separate notch block (for no particularly good reason other than laziness on my part) in the latest version of SpinCAD Designer (see signature line).  It shouldn't take much time to get something basic going on and then it's just a matter of tweaking things.

Hi Larry

I was playing a bit with the SpinCAD blocks.. and I have a doubt. The Frequency Control Input in these blocks, what does it represent? Is this the frequency coeff, or directly Hz, or maybe % vs Sampling freq?

In other words, if I want to have a filter with a giv en Hz, how do I calculate what to give to the block?

Mat

I was digging into the code of SpìnCAD and I could not fully get how the frequency control input is managed in the filters. I see you used an EXP and SOF to scale it, and then just use it in the filter as a coeff. So no direct relationship with the real frequency, but I suppose good enough for a pot control. BTW, are the LPF and HPF (2/4P ones) SVF filters in disguise?

On the other hand, I see there are fixed SVF blocks where I can provide the frequency directly, and they seem to work fine. I've done some testing today with them, and I have a prototype of a cabsim emulating the ROG Condor. I just need to figure out what resonance to use... If I have time later I will post some clips.

Mat



Title: Re: any FV-1 cabsim?
Post by: potul on November 28, 2017, 08:56:49 AM
Ok,

I could not wait until going home... so during lunch time I did this. It's just the output file generated by SpinCAD, but can give an idea. As soon as I can I will test it in the real FV-1
It starts without cabsim, and at around second 10 it kicks in. There's some reverb all over.

https://soundcloud.com/mateu-ros/out3 (https://soundcloud.com/mateu-ros/out3)

Mat
Title: Re: any FV-1 cabsim?
Post by: Digital Larry on November 29, 2017, 09:58:35 PM
Quote from: potul on November 28, 2017, 08:24:28 AM
I was digging into the code of SpìnCAD and I could not fully get how the frequency control input is managed in the filters. I see you used an EXP and SOF to scale it, and then just use it in the filter as a coeff. So no direct relationship with the real frequency, but I suppose good enough for a pot control. BTW, are the LPF and HPF (2/4P ones) SVF filters in disguise?

On the other hand, I see there are fixed SVF blocks where I can provide the frequency directly, and they seem to work fine. I've done some testing today with them, and I have a prototype of a cabsim emulating the ROG Condor. I just need to figure out what resonance to use... If I have time later I will post some clips.

Mat

Some of the filter blocks may have some control processing to give them a more log vs. control position frequency control curve.  And some would just scale the filter coefficient directly.  How does this work theoretically?  I can't exactly remember.  The filter with log control in it was probably taken from a voltage controlled filter example.  Adjust by ear with judicious use of scale/offset!

I'm pretty sure the 4 pole filters are two 2 pole SVFs in a row.  Supposedly there is a way to make a 4 pole SVF directly in a single structure but I haven't implemented anything like that yet.

Thanks,

DL
Title: Re: any FV-1 cabsim?
Post by: potul on November 30, 2017, 03:07:14 AM
Quote from: Digital Larry on November 29, 2017, 09:58:35 PM
Some of the filter blocks may have some control processing to give them a more log vs. control position frequency control curve.  And some would just scale the filter coefficient directly.  How does this work theoretically?  I can't exactly remember.  The filter with log control in it was probably taken from a voltage controlled filter example.  Adjust by ear with judicious use of scale/offset!

I'm pretty sure the 4 pole filters are two 2 pole SVFs in a row.  Supposedly there is a way to make a 4 pole SVF directly in a single structure but I haven't implemented anything like that yet.

This confirms what I was able to reverse-engineer from the code. The adjustable block are using some scaling of the coefficient and that's it. The fixed SVF filters use the frequency directy (the coeff gets calculated on SpinCAD before generating the ASM), and they should be ok for this usage, I don't want to have tweakable frequency.

By the way, I was looking for the .spincad files for the filter blocks and I couldn't find them. I assume you coded them directly in java, am I right?
Title: Re: any FV-1 cabsim?
Post by: Digital Larry on November 30, 2017, 08:47:29 AM
Quote from: potul on November 30, 2017, 03:07:14 AM
By the way, I was looking for the .spincad files for the filter blocks and I couldn't find them. I assume you coded them directly in java, am I right?

By my answer you'll conclude that I haven't spent much time on this recently... "probably"!   ;D

All of the blocks that were coded directly in Java can be found here:

https://github.com/HolyCityAudio/SpinCAD-Designer/tree/master/src/com/holycityaudio/SpinCAD/CADBlocks

I coded all of the initial blocks in Java which I found so excruciating after awhile that I forced myself to develop the SpinCAD language to allow using marked up Spin ASM.  Those were the good old days.  I had no idea what I was doing but managed to prevail nevertheless.
Title: Re: any FV-1 cabsim?
Post by: ElectricDruid on November 30, 2017, 03:03:55 PM
Quote from: potul on November 28, 2017, 08:56:49 AM
Ok,

I could not wait until going home... so during lunch time I did this. It's just the output file generated by SpinCAD, but can give an idea. As soon as I can I will test it in the real FV-1
It starts without cabsim, and at around second 10 it kicks in. There's some reverb all over.

https://soundcloud.com/mateu-ros/out3 (https://soundcloud.com/mateu-ros/out3)

Mat

Not bad for a first shot, but it sounds too resonant to me. There's a slightly thinned-out, whistly character that I associate with high resonance and passband drop-off.

T.
Title: Re: any FV-1 cabsim?
Post by: potul on November 30, 2017, 05:35:09 PM
Quote from: ElectricDruid on November 30, 2017, 03:03:55 PM
Quote from: potul on November 28, 2017, 08:56:49 AM
Ok,

I could not wait until going home... so during lunch time I did this. It's just the output file generated by SpinCAD, but can give an idea. As soon as I can I will test it in the real FV-1
It starts without cabsim, and at around second 10 it kicks in. There's some reverb all over.

https://soundcloud.com/mateu-ros/out3 (https://soundcloud.com/mateu-ros/out3)

Mat

Not bad for a first shot, but it sounds too resonant to me. There's a slightly thinned-out, whistly character that I associate with high resonance and passband drop-off.

T.

True... I just tested it in the FV-1 and it sounded awfully resonant, both low and high frequencies. I will try tomorrow with a more subtle setting.

Title: Re: any FV-1 cabsim?
Post by: gena_p1 on December 18, 2017, 05:07:13 AM
I did FIR cabsim generator for FV1 , it's pretty dummy, taking impulse wav and translate it to spin asm , but only 126 coefficients is too little (it's about 190 to compare to 48rHz sample rate).

It seem's ok with overdrive.
Title: Re: any FV-1 cabsim?
Post by: potul on December 18, 2017, 05:19:58 AM
Interesting..... Are you willing to share the code?

Mat
Title: Re: any FV-1 cabsim?
Post by: gena_p1 on December 18, 2017, 05:35:43 AM
RDAX   adcl , 0.05  because of high output gain ,  every patch required to choose gain personally



; s.shift-line.com/wav2spin
; file:13_SuproTB_SM57_32768.wav
; SUM of coefficients (max volume) = 0.462890625
;
RDAX adcl , 0.05
WRAX 0 , 1
RDA 0 , 0.0078125
RDA 1 , 0.146484375
RDA 2 , 0.66015625
RDA 3 , 1.294921875
RDA 4 , 1.4921875
RDA 5 , 1.16015625
RDA 6 , 0.556640625
RDA 7 , -0.0078125
RDA 8 , -0.453125
RDA 9 , -0.783203125
RDA 10 , -0.96875
RDA 11 , -0.947265625
RDA 12 , -0.701171875
RDA 13 , -0.30078125
RDA 14 , 0.099609375
RDA 15 , 0.27734375
RDA 16 , 0.158203125
RDA 17 , -0.08203125
RDA 18 , -0.22265625
RDA 19 , -0.18359375
RDA 20 , -0.078125
RDA 21 , -0.015625
RDA 22 , -0.033203125
RDA 23 , -0.080078125
RDA 24 , -0.103515625
RDA 25 , -0.130859375
RDA 26 , -0.181640625
RDA 27 , -0.2265625
RDA 28 , -0.197265625
RDA 29 , -0.087890625
RDA 30 , 0.0390625
RDA 31 , 0.072265625
RDA 32 , 0.00390625
RDA 33 , -0.060546875
RDA 34 , -0.09375
RDA 35 , -0.11328125
RDA 36 , -0.13671875
RDA 37 , -0.1875
RDA 38 , -0.232421875
RDA 39 , -0.228515625
RDA 40 , -0.205078125
RDA 41 , -0.224609375
RDA 42 , -0.26953125
RDA 43 , -0.232421875
RDA 44 , -0.1015625
RDA 45 , 0.01953125
RDA 46 , 0.056640625
RDA 47 , 0.015625
RDA 48 , -0.0546875
RDA 49 , -0.078125
RDA 50 , -0.033203125
RDA 51 , 0.046875
RDA 52 , 0.1171875
RDA 53 , 0.150390625
RDA 54 , 0.138671875
RDA 55 , 0.091796875
RDA 56 , 0.03125
RDA 57 , 0.021484375
RDA 58 , 0.083984375
RDA 59 , 0.15234375
RDA 60 , 0.142578125
RDA 61 , 0.078125
RDA 62 , 0.013671875
RDA 63 , -0.03515625
RDA 64 , -0.0625
RDA 65 , -0.095703125
RDA 66 , -0.130859375
RDA 67 , -0.123046875
RDA 68 , -0.072265625
RDA 69 , -0.009765625
RDA 70 , 0.0078125
RDA 71 , -0.025390625
RDA 72 , -0.080078125
RDA 73 , -0.1171875
RDA 74 , -0.09765625
RDA 75 , -0.025390625
RDA 76 , 0.0546875
RDA 77 , 0.099609375
RDA 78 , 0.103515625
RDA 79 , 0.087890625
RDA 80 , 0.05859375
RDA 81 , 0.013671875
RDA 82 , -0.017578125
RDA 83 , -0.001953125
RDA 84 , 0.044921875
RDA 85 , 0.09765625
RDA 86 , 0.10546875
RDA 87 , 0.06640625
RDA 88 , 0.021484375
RDA 89 , -0.005859375
RDA 90 , -0.015625
RDA 91 , -0.017578125
RDA 92 , -0.00390625
RDA 93 , 0.017578125
RDA 94 , 0.03515625
RDA 95 , 0.052734375
RDA 96 , 0.0625
RDA 97 , 0.0703125
RDA 98 , 0.08203125
RDA 99 , 0.08984375
RDA 100 , 0.08203125
RDA 101 , 0.05859375
RDA 102 , 0.013671875
RDA 103 , -0.029296875
RDA 104 , -0.025390625
RDA 105 , 0.0234375
RDA 106 , 0.08203125
RDA 107 , 0.123046875
RDA 108 , 0.130859375
RDA 109 , 0.1171875
RDA 110 , 0.09375
RDA 111 , 0.078125
RDA 112 , 0.068359375
RDA 113 , 0.052734375
RDA 114 , 0.03125
RDA 115 , 0.015625
RDA 116 , 0.025390625
RDA 117 , 0.044921875
RDA 118 , 0.05078125
RDA 119 , 0.0390625
RDA 120 , 0.009765625
RDA 121 , -0.013671875
RDA 122 , -0.01171875
RDA 123 , 0.01953125
RDA 124 , 0.056640625
WRAX dacl , 0

Title: Re: any FV-1 cabsim?
Post by: potul on December 18, 2017, 05:46:58 AM
Interesting.... where did you get IR files with 32768 sample rate?
Title: Re: any FV-1 cabsim?
Post by: ElectricDruid on December 18, 2017, 06:14:21 AM
So much for the "FV-1 hasn't got the horsepower" theory! Just munge through the data and bingo.

I suspect with some judicious tweaking of the coefficients/response, that could get pretty good. 126 coefficients might not be a huge IR, but it's a pretty substantial FIR filter.

Nice work, even if only for trying what other people didn't think to try because "there isn't enough power" or "it'll sound hopeless".

Tom
Title: Re: any FV-1 cabsim?
Post by: gena_p1 on December 18, 2017, 08:04:20 AM
Quote from: potul on December 18, 2017, 05:46:58 AM
Interesting.... where did you get IR files with 32768 sample rate?
just asked our sound director to make.

We did project called "CabZone" FIR cabsim based on adau1701 , so impulses were prepared and translators from wav to C were made.
And i just spent couple of hours to make wav2spin off wav2fir
Title: Re: any FV-1 cabsim?
Post by: Firesledge on December 18, 2017, 04:16:14 PM
Quote from: potul on December 18, 2017, 05:46:58 AMInteresting.... where did you get IR files with 32768 sample rate?

You can resample the IR like any other sample. Just make sure that the phase is not messed up.

Title: Re: any FV-1 cabsim?
Post by: potul on December 18, 2017, 05:28:36 PM
Quote from: Firesledge on December 18, 2017, 04:16:14 PM
Quote from: potul on December 18, 2017, 05:46:58 AMInteresting.... where did you get IR files with 32768 sample rate?

You can resample the IR like any other sample. Just make sure that the phase is not messed up.

So I can use something like ffmpeg and resample it like a regular wav? I will give it a try.

Title: Re: any FV-1 cabsim?
Post by: Rob Strand on December 18, 2017, 06:54:59 PM
Short FIR filters will never work very well for low frequency filters.   Very roughly it will pretty much do nothing for frequencies below 'sample frequency'/filter length.

There's a trick in DSP called polyphase filtering  (it comes under the topic of multirate filtering) it is far more efficient than using a single filter when the filter's cut-off frequency is small compared to the sample frequency.  It's all formalized and optimised in the DSP literature but unfortunately the way it is presented is hard to understand.   When you look at it you might think it is complicated and takes more processing but it doesn't, it is *far* more efficient.

The key to the idea is if want a *low-pass* filter with low frequency cut-off, say 100Hz, the required length of the filter at sample rate fs/2 is shorter than at fs.   If we keep going fs/4, fs/8   then the length of the low-pass filter gets shorter and shorter.  What we are doing here is down sampling the input signal.  In practice there's an optimum place to stop.  Anyway if you say down sample a bit to say fs/4 or fs/8  the filter is a hell of a lot shorter.    Notice also the 100Hz filter has less samples to process because its operating at a lower sample frequency.

So you down sample, then filter with a short filter at the lower sample rate. Now, the next step is to upsample again back upto sample rate fs.

When you downsample and upsample and you need anti-aliasing low-pass filters.  Sometimes you can go from fs to fs/4 directly other times you can do two steps of fs/2.   The filters need a fair amount of attenuation to prevent unwanted spectral images appearing.   However, they can be short and each step operates at a lower sample rate -> so less calculations.  You might even be able to use half-band filters which have a lot of zeros in the coefficients.

Anyway after all that you end-up with a very efficient *low pass* filter. 

To make this a high-pass filter what you do is calculate:

           High-pass filter   = 1 - Low-pass filter.

[Edit: That's the idea *but* what you really have to calculate ,

           High-pass filter   = Delayed Input - Low-pass filter.

Where the delay matches the delay of all the filters in the Low-pass chain.

You can check it by measuring the output with DC or low frequency input.
]

You would do this high-pass filtering then put it though the higher-frequency low-pass filters which operate at sample frequency fs.

That's the idea.  I don't really want to fill in all the details.  It takes too long. I don't want to write a book here.  If you understand upsampling and downsampling then you should be OK.  Watch out to get the correct scaling when upsampling. 

Title: Re: any FV-1 cabsim?
Post by: benqbasic on October 14, 2018, 05:22:27 AM
Quote from: gena_p1 on December 18, 2017, 08:04:20 AM
Quote from: potul on December 18, 2017, 05:46:58 AM
Interesting.... where did you get IR files with 32768 sample rate?
just asked our sound director to make.

We did project called "CabZone" FIR cabsim based on adau1701 , so impulses were prepared and translators from wav to C were made.
And i just spent couple of hours to make wav2spin off wav2fir

That is quite an achievement. I am struggling to get an IR file converted to FIR table and loaded into the adau1701.
You need quite a few taps to get the correct bass response.
Did you program a script within SigmaStudios?


Title: Re: any FV-1 cabsim?
Post by: gena_p1 on October 14, 2018, 10:43:38 AM
I think, my tool might help: http://s.shift-line.com/wav2fir/

It converts mono pcm 48kHz 24bit uncompressed wav to FIR table +/-1  ,
24 bit wav to 24 lower bits of ADAU.

It has hex output is for testing purposes, bytes are LSB (intel format) , so to send it to ADAU you need to convert it to MSB format.

Title: Re: any FV-1 cabsim?
Post by: benqbasic on October 14, 2018, 10:38:18 PM
Quote from: gena_p1 on October 14, 2018, 10:43:38 AM
I think, my tool might help: http://s.shift-line.com/wav2fir/

It converts mono pcm 48kHz 24bit uncompressed wav to FIR table +/-1  ,
24 bit wav to 24 lower bits of ADAU.

It has hex output is for testing purposes, bytes are LSB (intel format) , so to send it to ADAU you need to convert it to MSB format.

Thank you, I will check this out when I get home!!!

Can the FIR table be copied directly into the FIR block within SigmaStudio?

Once I get this functioning correctly I will need to work out how to send over i2s to the ADAU.
All new too me so thanks for pointing me in the right direction.




Title: Re: any FV-1 cabsim?
Post by: gena_p1 on October 15, 2018, 12:45:13 AM
Yes, you may ctrl+c, ctrl+v to sigma studio.