Open303 - open source 303 emulation project - collaborators wanted

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS
JC-303

Post

What kind of HP filters do you use? I'm using bilinear transformed first order HPs, which look like this (Java):

Code: Select all

private static class HpFilter
{
    private double a0, a1, b1;
    private double x1, y1;
    
    public HpFilter() { /* */ }
    
    public void set(double fs, double fc)
    {
        double k = Math.tan(fc * Math.PI / fs);
        double b0 = k + 1;
        this.a0 = 1.0 / b0;
        this.a1 = -this.a0;
        this.b1 = (k - 1) / b0;
    }
    
    public double getPhase(double wc)
    {
        return Math.atan(
                ((this.a1 - this.b1 * this.a0) * Math.sin(wc)) /
                ((this.a0 + this.b1 * this.a1 + (this.a1 + this.b1 * this.a0) * Math.cos(wc)))
                );
    }
    
    public double process(double input)
    {
        this.y1 = this.a0 * input + this.a1 * this.x1 - this.b1 * this.y1 + Synth.DENORM;
        this.x1 = input;
        return this.y1;
    }
}
I'm using two HP's on the input, both @60Hz, one HP in the feedback loop @320Hz and one on the output which varies with q from 30 -> 210Hz. Using Robins tuning stuff and compensating for the HP phase shift I get well sounding results.

Code: Select all

private static class Filter
{
    private double co, q;
    private double a, k, gain;
    public double[] buf = new double[4];
    private HpFilter hpfilt1 = new HpFilter();
    private HpFilter hpfilt2 = new HpFilter();
    private HpFilter hpfilt3 = new HpFilter();
    private HpFilter hpfilt4 = new HpFilter();
    
    public Filter()
    {
        this.set(1, 0);
        this.hpfilt1.set(Synth.getSampleRate() * 4, 60);
        this.hpfilt2.set(Synth.getSampleRate() * 4, 60);
        this.hpfilt3.set(Synth.getSampleRate() * 4, 320);
    }
    
    private void recalc()
    {
        double wc = this.co * Math.PI;
        double c = Math.cos(wc);
        double s = Math.sin(wc);
        double wcf = this.hpfilt3.getPhase(wc);
        double t = Math.tan((wc + wcf - Math.PI) * 0.25);
        double a1 = -t / (c * t - s); 
        double b0 = 1.0 + a1;
        double b02 = b0 * b0;
        double g2 = b02 / (1 + a1 * a1 + 2 * a1 * c);
        this.a = b0;
        this.k = (this.q * 0.95) / (g2 * g2);
        this.gain = 1 + this.q;
        this.hpfilt4.set(Synth.getSampleRate() * 4, 30 + 180 * this.q);
    }

    public void set(double c, double res)
    {
        this.co = c < 0 ? 0 : c > 1 ? 1 : c;
        this.q = res < 0 ? 0 : res > 1 ? 1 : res;
        this.recalc();
    }

    public double process(double inp)
    {
        double fb = -this.hpfilt1.process(this.hpfilt2.process(inp)) - this.k * this.hpfilt3.process(this.buf[3]);
        this.buf[0] = this.buf[0] + this.a * (Math.tanh(fb) - this.buf[0]) + DENORM;
        this.buf[1] = this.buf[1] + this.a * (this.buf[0] - this.buf[1]) + DENORM;
        this.buf[2] = this.buf[2] + this.a * (this.buf[1] - this.buf[2]) + DENORM;
        this.buf[3] = this.buf[3] + this.a * (this.buf[2] - this.buf[3]) + DENORM;
        return this.hpfilt4.process(this.buf[3]) * this.gain;
    }
}
Well, it's close enough for me and I think I'll stick with this filter.

Edit: The above configuration was the one which I developed before Tim's recent posts ... there are similarities to the real filter :D ... and I won't change it anymore ... too much tweaking will kill the filter :D

Edit2: This is still my 'dirty-evaluation-version'.
... when time becomes a loop ...
---
Intel i7 3770k @3.5GHz, 16GB RAM, Windows 7 / Ubuntu 16.04, Cubase Artist, Reaktor 6, Superior Drummer 3, M-Audio Audiophile 2496, Akai MPK-249, Roland TD-11KV+

Post

oh, these look different
i use 1pole HP filters from dspguide
x = exp(-2 * pi * Fc/Fs);
a0 = (1+x)/2;
a1 = -(1+x)/2;
b1 = x;
... but i've "optimized" the calculation a little, to use less variables and stuff
b1 = exp(-2 * pi * omega); // still the same thing, no "x" variable
a0 = (1+b1)*0.5; // no division
a1 = -a0; // should be the same as above

transfere function is like yours, but i also "optimized" it a little
y0 = input*a0 + x1*a1 + y0*b1; // the previous output is already stored in y0..
x1 = input;

hm..
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

the one on your feedback loop is at 320Hz?! do you have resonance at all? ;]
can you upload a sample, how does the filter sound there?
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

Sure, here is a sample :)

Edit: I'm starting with knobs at zero cutoff, zero modulation, full resonance, full decay, 3/4 accent.
... when time becomes a loop ...
---
Intel i7 3770k @3.5GHz, 16GB RAM, Windows 7 / Ubuntu 16.04, Cubase Artist, Reaktor 6, Superior Drummer 3, M-Audio Audiophile 2496, Akai MPK-249, Roland TD-11KV+

Post

neotec wrote:Sure, here is a sample :)
there's a really ugly effect going on there, very audible on the accent

dunno how to describe: bird in a metal tank?
sounds a bit like the filter on the acidlab bassline/bombass

Post

rv0 wrote:there's a really ugly effect going on there, very audible on the accent
Hmm, I think I know what you mean ... and I think this is because of the additional phase shift from the feedback HPF and its compensation.


Edit: I'll try 'inverting' the HPFs ... maybe that sounds better
Edit2: Hmm, I think I don't know what you mean, rv0 :D, can you specify a time position in the mp3 where this effect is well heared?
... when time becomes a loop ...
---
Intel i7 3770k @3.5GHz, 16GB RAM, Windows 7 / Ubuntu 16.04, Cubase Artist, Reaktor 6, Superior Drummer 3, M-Audio Audiophile 2496, Akai MPK-249, Roland TD-11KV+

Post

not sure i can hear that bird, but i think i find the metal tank familiar
this is kind of how accents sound when envmod=max and cutoff is around the middle (accent=max, reso=max)

neotec: sounds good, but i think the signal is too loud in there, and the clippers take off some of the resonance, which is not bad, it's good if you want some Josh Wink sound ;]

but with all these filters and stuff (and mainly, the way the filters are placed around the input+feedback path) i suppose it'll be very hard to "tune" the filter, no?
at least i couldn't, changing the HPF frequencies of some of them changed the tuning too much, i'm not sure if the whole filter would "respond" the same way with the same parameters at all sampling rates (which is vital in my case)

i just returned back to kunn's filter again, this time, with all nonlinearities, and just 3 HP filters (like before, but i had only 1 nonlinearity in the feedback)
i also added a little knob, to test the input level of the filter (which makes difference because of the nonlinearities)
so i did something like this:
g1a = *knobval;
g1b = 1.0 / g1a;

then i multiply the input signal, before it goes into the filter, and i multiply the output (without messing the filter memory with this)
so..
x0 = input * g1a;
<filter>
output = y4 * g1b;

so, changing the input gain is compensated by scaling the output
the result is, that with high gain, the resonance is too restricted, i adjusted it so that there is enough "room" for the resonance to grow a little over the amplitude of the sawtooth, kinda fair ;]

and i also tested this at 2 sampling rates, to see if it sounds/looks/behaves the same
vb303_tpcs01_44100vs192000.mp3 (3MB)
the pattern is kinda familiar ;] (prodigy)
so, i automated the synth, recorded it at 192000, and then again at 44100, upsampled the 44100 version and placed it next to the 192000 version, the wave-file got realy big (can't upload it) so i also downsampled it and saved to mp3
anyway, the only difference is the oscillator "drifting" and the 44100 filter being "restricted" to 22050Hz
i don't hear any big difference otherwise (looking for one mainly in the filter)
oh, and when i opened the sonogram - the 44100 version has something looking like background noise (looks like white noise) .. the other one has it too, but it's much quieter (this is probably because of the coefficients being changed)
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

oops, i forgot to mention something important
i have no idea (haven't tested) what is the difference in the coefficients of the HP filters we use, but i believe the ones that i use (dspguide) are "accurate" because otherwise, this test would fail
1. the filter would fail, will have either too much or less resonance in the lows
2. the filter again, it won't look the same on a sonogram/scope (and it'll sound different)
3. i'm also using 1 pole LP filters from dspguide, the formula is the same (based on exp()) so the slides in this test would have failed

maybe your formulas give the same results as mine, i don't know, i could test them?
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto wrote:neotec: sounds good, but i think the signal is too loud in there, and the clippers take off some of the resonance, which is not bad, it's good if you want some Josh Wink sound ;]
Well, the input signal is in the range of [-.25f,.25f], which should be 'silent' enough. I've limited the resonance to a max of .95f ... everything above is too much, I think :). I can even leave out the tanh() on the fb without sound changes.
... when time becomes a loop ...
---
Intel i7 3770k @3.5GHz, 16GB RAM, Windows 7 / Ubuntu 16.04, Cubase Artist, Reaktor 6, Superior Drummer 3, M-Audio Audiophile 2496, Akai MPK-249, Roland TD-11KV+

Post

oh, just my ears..
what about different sampling rates? does it "work" the same way?

for the resonance.. i think in most unmodified tb303 can't normaly go into selfoscillation, they are even quite far
to figure the maximum resonance, i use my ears, starting of with no resonance, and then i increase it slowly till i get to that "sweet" part, and just a bit more
tho, i also like the JoshWink sound, where it is like selfoscillating (or very close)
not sure about the nonlinearities, but when resonance is fully off, the waveform (at least the sawtooth) doesn't get clipped or shaped too much, since you can clearly see it's edges going smooth
when i increase the gain of my filter, it softens the negative edge of the sawtooth (the negative one, because of the HP filtering)
i haven't seen that kind of behaviour in any audio samples yet (tho, i still have in mind that the ugly bump on the square wave might be just a result of the filter clippers somewhere, tho, i doubt it more and more now)
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

just to keep you guys informed, i'm currently preparing some documentation for the code (block-diagrams 'n stuff). i'm planning to release the source code for the DSP-part without the GUI stuff and without the GPL hassle. i'll probably rename the project into Open303 and use the name AciDevil for my own version of it
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

good idea ;]
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

Robin from www.rs-met.com wrote:just to keep you guys informed, i'm currently preparing some documentation for the code (block-diagrams 'n stuff). i'm planning to release the source code for the DSP-part without the GUI stuff and without the GPL hassle. i'll probably rename the project into Open303 and use the name AciDevil for my own version of it
:tu: woohoo


looking forward to whatever will come from your efforts

Post

O.K., i just created the repository on sourceforge:

https://sourceforge.net/projects/open303/

not much content as of yet besides the pure source code, but this will hopefully grow. i don't have experience in administrating open source projects, but i will try to come up with some more content in the coming days/weeks (mainly documentation stuff)
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

nice, i'll have a better look after work :tu:
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post Reply

Return to “DSP and Plugin Development”