Simple Oscillator in Gen~

    Sep 20 2012 | 6:07 pm
    Ok bear with me while ask what must be very mundane questions for you Gen wizards.
    I want to make an oscillator from scratch in gen~. I was looking on page 3 of this paper for an implementation model:
    I'm having some trouble correlating the block diagram to what I should be doing in gen~, but here's my meager attempt at making a sine wave. I'm using a biquad for the "postfilter."
    How can I get rid of the rest of the upper frequencies? It seems I need a way to boost the signal the lower I set the cutoff frequency. Are there any other articles or sources that explain how to do this better?
    Thanks for humoring me. :)

    • Sep 24 2012 | 7:48 pm
      You're missing the mapping function (here it's: y = sin(2*pi*x)), so you're getting a lowpass-filtered sawtooth (also with quite a bit of DC offset!). You actually don't need the post filter probably. By using a big-enough lookup table (or calculating the result) you shouldn't need post-filtering. That's usually more a way of correcting some of the spectral inaccuracies in certain oscillator designs. (for instance, the DPW algorithm)
      Note that if you don't need instantaneous phase reset (e.g. hard sync) you can just use phasor for your phase incrementer. If you want to be really simple, you can just use cycle, but I'm guessing that may be beside the point of what you're trying to do.
    • Oct 04 2012 | 7:40 pm
      Thanks for replying Peter, and sorry for not responding. I've been in filterland all this time and the oscillator is kind of a side project. Implementing the mapping function is doing my head in. Simply using Gen~ operators that are analogous to the components of the equation (e.g. pi) doesn't seem to do much. Any hints on how to implement the mapping function?
      The rest of what you said in your post tells me that perhaps I need to study more before I try this again…
    • Oct 04 2012 | 8:24 pm
      Just take your 0-1 phasor-ish signal, multiply by 2*pi, and take the sine. You could do it in expr as: sin(2*PI*in1)
      You probably know about this one already, but on the off-chance you don't, in my toolbox I've implemented the ladder filter from the ICST paper (plus additional filter modes and shaping).
    • Oct 08 2012 | 7:46 pm
      Ok my problem was in how the "taking the sine" part was accomplished. Multiplying the out of the phasor(?) by 2∏ was clear but I was too thick to know I had to then send that into the sin operator. Thought I had to multiply by it or some nonsense. Sheesh!
      Now I've got a working sine wave.
      This was mostly an academic endeavor for me. I just want to understand how even the simplest processes in digital audio are accomplished and I am truly floored at how Gen allows one to visualize the processes and even build them (mostly) from scratch using nothing but a block diagram as a guide.
      @Peter: Thanks for your help, and yes I've been studying your Moog Ladder as a supplementary example for the class I'm taking in delay-based signal processing using Gen.