Login / Register  0 items | $0.00 NewWhat is KVR? Submit News Advertise
xoxos
Mr Entertainment
 
12056 posts since 29 Apr, 2002, from i might peeramid

Postby xoxos; Wed Mar 08, 2017 7:11 pm Re: the beginnings of a beautiful era for audio dsp

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"
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.
xoxos
Mr Entertainment
 
12056 posts since 29 Apr, 2002, from i might peeramid

Postby xoxos; Wed Apr 12, 2017 11:34 am Re: the beginnings of a beautiful era for audio dsp

adding the saw.

normalisationsynthesis.png
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.
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sat Sep 30, 2017 11:58 am Re: the beginnings of a beautiful era for audio dsp

viewtopic.php?p=6656238#p6656238
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?
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sat Sep 30, 2017 12:09 pm Re: the beginnings of a beautiful era for audio dsp

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.

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);
   }
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sat Sep 30, 2017 3:21 pm Re: the beginnings of a beautiful era for audio dsp

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.
User avatar
antto
KVRAF
 
2470 posts since 4 Sep, 2006, from 127.0.0.1

Postby antto; Sat Sep 30, 2017 6:02 pm Re: the beginnings of a beautiful era for audio dsp

st0 and st1 are used as state variables
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
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sat Sep 30, 2017 8:36 pm Re: the beginnings of a beautiful era for audio dsp

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 :ud:

removed attempt 1
Last edited by Architeuthis on Sun Oct 01, 2017 10:25 am, edited 1 time in total.
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sat Sep 30, 2017 8:45 pm Re: the beginnings of a beautiful era for audio dsp

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.
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sun Oct 01, 2017 5:05 am Re: the beginnings of a beautiful era for audio dsp

removed attempt 3
Last edited by Architeuthis on Sun Oct 01, 2017 10:25 am, edited 1 time in total.
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sun Oct 01, 2017 9:45 am Re: the beginnings of a beautiful era for audio dsp

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.
User avatar
Architeuthis
KVRAF
 
2873 posts since 27 Jan, 2006, from Phoenix, AZ

Postby Architeuthis; Sun Oct 01, 2017 11:18 am Re: the beginnings of a beautiful era for audio dsp

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?

Code: Select all
void setFrequency(double v)
{
   double phaseInc = (v*4)/sampleRate * PI_z_2 + PI_z_2;
   sinCos(phaseInc, &w0, &w1);
}
User avatar
Smashed Transistors
KVRist
 
114 posts since 10 Oct, 2014

Postby Smashed Transistors; Tue Oct 03, 2017 3:43 pm Re: the beginnings of a beautiful era for audio dsp

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 :hyper: .


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 !
See you here and there... Youtube, Google Play, SoundCloud...
mystran
KVRAF
 
4579 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Tue Oct 03, 2017 10:05 pm Re: the beginnings of a beautiful era for audio dsp

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).
Image <- plugins | forum
User avatar
Smashed Transistors
KVRist
 
114 posts since 10 Oct, 2014

Postby Smashed Transistors; Wed Oct 04, 2017 10:32 am Re: the beginnings of a beautiful era for audio dsp

ZDF-SVF can be cool to experiment with :D

Is ZDF-SVF stable with audio rate frequency and Q modulations ?
See you here and there... Youtube, Google Play, SoundCloud...
mystran
KVRAF
 
4579 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Wed Oct 04, 2017 11:47 am Re: the beginnings of a beautiful era for audio dsp

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

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.
Image <- plugins | forum
PreviousNext

Moderator: Moderators (Main)

Return to DSP and Plug-in Development