- Mr Entertainment
- 12018 posts since 29 Apr, 2002, from i might peeramid

i like that part in evil flow,

cos i'm modeling the future over and over

except it's like, the future, and, over like, over

clever things, appeal to the intellect, tricky

or like right there

the horns of the lord above, brother

see the horns on me - i get blowed

before they get to you - i get stuck

come see the horns on a big bad demon

course it's got that horn sound in the background. clever though. "doctor xo"

cos i'm modeling the future over and over

except it's like, the future, and, over like, over

clever things, appeal to the intellect, tricky

or like right there

the horns of the lord above, brother

see the horns on me - i get blowed

before they get to you - i get stuck

come see the horns on a big bad demon

course it's got that horn sound in the background. clever though. "doctor xo"

you come and go, you come and go. amitabha xoxos.net free vst. neither a follower nor a leader be

tagore "where roads are made i lose my way"

where there is certainty, consideration is absent.

tagore "where roads are made i lose my way"

where there is certainty, consideration is absent.

- Mr Entertainment
- 12018 posts since 29 Apr, 2002, from i might peeramid

adding the saw.

You do not have the required permissions to view the files attached to this post.

you come and go, you come and go. amitabha xoxos.net free vst. neither a follower nor a leader be

tagore "where roads are made i lose my way"

where there is certainty, consideration is absent.

tagore "where roads are made i lose my way"

where there is certainty, consideration is absent.

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

viewtopic.php?p=6656238#p6656238

Has anyone been able to translate this into working C++ code? I'm too math-illiterate

oh wait I'm seeing something here.

rotation is defined as:

is this correct?

but it looks somewhat different than tis

I'm guessing w0/w1/m0/m1 are -1 to +1 values coming out of a sin/cos function, so

m0 = cos(m);

m1 = sin(m);

w0 = cos(w)

w1 = sin(w)

s0,s1 is internal updated variable

x,y is the output

that leaves t, m, w, in2, in4 variables unknown

in2, in4 are parameters... t, m, w, not sure. one or two of those is phase?

t is angle?

that means m and w. 90 degrees phase different from a single phase/angle value?

xoxos wrote:

- Code: Select all
`double t = s0;`

s0 = s0 * w0 + s1 * w1; // circular oscillator

s1 = s1 * w0 - t * w1;

x = s0 * *in2; // scale

t = s1 + *in4; // offset

y = t * m0 - x * m1; // angle

x = x * m0 + t * m1;

*out1 = y / sqrt(x * x + y * y);

Has anyone been able to translate this into working C++ code? I'm too math-illiterate

oh wait I'm seeing something here.

rotation is defined as:

- Code: Select all
`*X = x * cos(angle) - y * sin(angle);`

*Y = x * sin(angle) + y * cos(angle);

is this correct?

but it looks somewhat different than tis

- Code: Select all
`s0 = s0 * w0 + s1 * w1; // circular oscillator`

s1 = s1 * w0 - t * w1;

y = t * m0 - x * m1; // angle

x = x * m0 + t * m1;

I'm guessing w0/w1/m0/m1 are -1 to +1 values coming out of a sin/cos function, so

m0 = cos(m);

m1 = sin(m);

w0 = cos(w)

w1 = sin(w)

s0,s1 is internal updated variable

x,y is the output

that leaves t, m, w, in2, in4 variables unknown

in2, in4 are parameters... t, m, w, not sure. one or two of those is phase?

t is angle?

that means m and w. 90 degrees phase different from a single phase/angle value?

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

I want to possibly turn this into an envelope generator.

here's my attempt at C++ code, I don't know what to do with s0, s1, w0, w1. One of them is definitely phase.

here's my attempt at C++ code, I don't know what to do with s0, s1, w0, w1. One of them is definitely phase.

- Code: Select all
`double xoxos(double s0, double s1, double angle_m0, double angle_m1, double w0, double w1, double scale, double offset)`

{

double x, y, t = s0;

s0 = s0 * w0 + s1 * w1;

s1 = s1 * w0 - t * w1;

x = s0 * scale;

t = s1 + offset;

y = t * angle_m0 - x * angle_m1;

x = x * angle_m0 + t * angle_m1;

return y / sqrt(x * x + y * y);

}

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

here's working version using formula given earlier, but it is not recursive, it just takes in a phase.

- Code: Select all
`double xoxos(double phase, double A, double B_sin, double B_cos, double C)`

{

double sin_x, cos_x;

sinCos(phase, &sin_x, &cos_x);

double sqrt_val = sqrt(pow(A + cos_x, 2) + pow(C*sin_x, 2));

double out = ((A + cos_x)*B_cos + (C*sin_x)*B_sin) / sqrt_val;

return out;

}

Last edited by Architeuthis on Sun Oct 01, 2017 9:46 am, edited 1 time in total.

- KVRAF
- 2496 posts since 4 Sep, 2006, from 127.0.0.1

st0 and st1 are used as state variables

this is a recursive structure, not a mere function

this is a recursive structure, not a mere function

It doesn't matter how it sounds..

..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr

..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

antto wrote:st0 and st1 are used as state variables

this is a recursive structure, not a mere function

ok yes! So please correct my c++ code, i waaant iiiit

removed attempt 1

Last edited by Architeuthis on Sun Oct 01, 2017 10:25 am, edited 1 time in total.

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

attempt 2

- Code: Select all
`class XoxosOscillator`

{

public:

void setFrequency(double v)

{

double phaseInc = (v*4)/sampleRate * PI_z_2 + PI_z_2;

sinCos(phaseInc, &w0, &w1);

}

void setSampleRate(double v) { ; }

void setAngle(double v) { sinCos(v, &m0, &m1); }

void setScale(double v) { scale = v; }

void setOffset(double v) { offset = v; }

double getSample()

{

double x, y, t = s0;

s0 = s0 * w0 + s1 * w1;

s1 = s1 * w0 - t * w1;

x = s0 * scale;

t = s1 + offset;

y = t * m0 - x * m1;

x = x * m0 + t * m1;

return y / sqrt(x * x + y * y);

}

protected:

double s0 = 0, s1 = 1;

double w0 = 0, w1 = 1;

double m0 = 0, m1 = 1;

double

sampleRate = 44100,

frequency = 1,

scale = 0,

offset = 1;

};

Last edited by Architeuthis on Sun Oct 01, 2017 11:19 am, edited 2 times in total.

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

removed attempt 3

Last edited by Architeuthis on Sun Oct 01, 2017 10:25 am, edited 1 time in total.

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

ok so attempt 2 is the most correct so far, and im correcting my earlier post for the formula that just takes in phase.

all i need to know is how to convert pi/2 to pi range to frequency.

all i need to know is how to convert pi/2 to pi range to frequency.

- KVRAF
- 2922 posts since 27 Jan, 2006, from Phoenix, AZ

ok i got frequency control but I have no idea wtf I'm doing,

what is this equation? and I'm not sure it's correct to call the result phaseInc... maybe call it rotationSpeed?

what is this equation? and I'm not sure it's correct to call the result phaseInc... maybe call it rotationSpeed?

- Code: Select all
`void setFrequency(double v)`

{

double phaseInc = (v*4)/sampleRate * PI_z_2 + PI_z_2;

sinCos(phaseInc, &w0, &w1);

}

- KVRist
- 126 posts since 10 Oct, 2014

Rotations are good because they preserve signal energy (i.e sum of their squares).

To sort things out, maybe, you can have a look at :

https://ccrma.stanford.edu/courses/250a ... ilters.pdf

It shows how a pass band filter can be implemented with a rotation/scale i.e. a complex multiplication.

This implementation is very stable even with audio rate frequency modulation .

I've derived a simple variant - much simpler than your attempts - of the Matthews filter.

Non linear modulation of the rotation depending on the input or/and output.

Even this basic variation leads to interesting sort of filtering/distortion.

I used this principle in a Reaper synth (cXf synth available in the Reaper Stash) :

https://soundcloud.com/thierry-rochebois-1/test-cxf03

https://soundcloud.com/thierry-rocheboi ... nth-rev-07

It uses a pair of sines as an input to a self-non-linearly-frequency-modulated Matthews filter.

Now... imagine this with coupled units.. and even delays in the feedback loops...

There is so many possibilities to experiment with !

To sort things out, maybe, you can have a look at :

https://ccrma.stanford.edu/courses/250a ... ilters.pdf

It shows how a pass band filter can be implemented with a rotation/scale i.e. a complex multiplication.

This implementation is very stable even with audio rate frequency modulation .

I've derived a simple variant - much simpler than your attempts - of the Matthews filter.

Non linear modulation of the rotation depending on the input or/and output.

Even this basic variation leads to interesting sort of filtering/distortion.

I used this principle in a Reaper synth (cXf synth available in the Reaper Stash) :

https://soundcloud.com/thierry-rochebois-1/test-cxf03

https://soundcloud.com/thierry-rocheboi ... nth-rev-07

It uses a pair of sines as an input to a self-non-linearly-frequency-modulated Matthews filter.

Now... imagine this with coupled units.. and even delays in the feedback loops...

There is so many possibilities to experiment with !

- KVRAF
- 4927 posts since 11 Feb, 2006, from Helsinki, Finland

Smashed Transistors wrote:Rotations are good because they preserve signal energy (i.e sum of their squares).

In exact arithmetics, yeah.. in floating point, not so much. Rounding errors with "naive rotation" lead to both phase drift (=wrong frequency) and amplitude drift (which should be fixed periodically).

To get you an idea of how much the accuracy can cause trouble, one of the first version of my FFT used naive rotations. It turns out that (in double precision!) this made an FFT unstable somewhere around 1 million points (maybe earlier, I don't know). There are better recurrences though (eg. the undamped ZDF-SVF is a good one).

<- plugins | forum

- KVRist
- 126 posts since 10 Oct, 2014

ZDF-SVF can be cool to experiment with

Is ZDF-SVF stable with audio rate frequency and Q modulations ?

Is ZDF-SVF stable with audio rate frequency and Q modulations ?

- KVRAF
- 4927 posts since 11 Feb, 2006, from Helsinki, Finland

Smashed Transistors wrote:ZDF-SVF can be cool to experiment with

Is ZDF-SVF stable with audio rate frequency and Q modulations ?

Yeah. It essentially comes down to damped rotations, just calculated in a different way.

<- plugins | forum

**Moderator:** Moderators (Main)