gen~ : oscillator without delays lines or cos/sin function. how is it possible ?

lucas boutignon's icon

hello!

i've been working on waveguides for a little while, and i've been curious of creating a model that could produce an oscillation without using a "long" delay line , but only 1 samples feedback loops.

i realized that in some situation, manipulating the gain of a really short delay line could produce low oscillations. i am surprised by that and i don't understand how it's possible. i have a here an example of an oscillator that is almost in tune, that can create almost any frequency without the use of a "long" delay line, or a wavetable, or a sine/cosine object.

it seems like this system is a self-sustained oscillator, as it produces a periodic oscillation without any periodic input. through trial an errors, i found the formulas in order to tune the oscillator and define its frequency properly, and also to adjust the output's amplitude accordingly.

does anybody know if this oscillator could be useful ? i wonder how this is even possible. at least, adding some fm modulation and self modulation can create interesting chaotic sounds, that are a bit different from the sounds achieved with more traditional, parametric oscillators.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

there is a number of possible reasons for "deeper" frequencies, f.e. the base frequency is usually the sum of the fractional delays, then there is the the required interpolation of their output which can also come to play.

i havent looked at your code (and i am all but an expert to the topic) but if there are allpassfilters included somewhere, their effective feedback time is far longer, even if it looks like it would be only 1 sample.

👽!t W∆s ∆lienz!👽's icon

that's beautiful! you've discovered your own oscillator algo, i think it might be stemming from the basics of Karplus-Strong synthesis, but i could be wrong. i love how you guide it into a steady and smooth oscillation, though!

one thing to note is that the sampling rate changes the output frequency(according to the comparison with the cycle~ object you included, you must've tried all this out at 44.1kHz sampling-rate, if you try others you'll see how to tune it according to sample-rate, too).

another thing is that it seems to have an upper ceiling of frequency which is less than what cycle~ can output(i've no idea why that is, but just mentioning as it can effect how it will do in modulated circumstances).

beautiful discovery, all in all 🍻

jninek's icon

here's an oscillator based on a counter and a modulo. it's pretty gritty though.

modulo-osc.maxpat
Max Patch

lucas boutignon's icon

thank you all for your imputs!

roman : i've heard about this idea of using fractional delay, i think i'm using this technique as the loop is made from the sum of two signal, one delayed by one sample and the second one delay by two samples. variating the gain of one of the two signals produces the change in pitch so it ressembles the concept of using fractional delays.

thank you alien - it is based on the karplus strong algo, i'm just really surprised it works without having to use a delay line. but my algo does not produce the damping effect of the karplus strong effect, however it still seems to exhibit some dynamic behaviors in lower frequencies.

jninek nice i like your algo even though i'm not familiar with the technique. i would assume it's easier to produce a saw wave with basic operations , i was mainly curious on how my algo could produce a sine wave with just basic operations. but i think i found a lead and it seems to be about quadratic equations , that can be used to project circular shape on a plane with equations that does not use cos or sine functions. i don't understand where the sine function is created in my algo, because there's no "room" in the algo to store the wave, as there's no wavetable or delayline.

it makes me think, does anybody knows how the sin/cos object works in gen ? does it use a wavetable or does it produce the sine wave algorithmically ? how could we create a sine wave if we don't have the actual data that forms a sine wave ? i'm really confused about that

Roman Thilenius's icon

not a wavetable. the math operations sin() and cos() are as basic as + or * are, and calculate phases from radiants.

the gen~ sin object performs (sin(x)/3.14...), just as the MSP object sin~ does. simply because that is far more often required for audio or graphics than only the math function.

the [sin] object in MAX is a "regular" math object and only performs sin(x).

regarding your original question: you can also create quasi-cosine-periods from ringing filters, that is actually quite common in audio DSP. it is cheap, but comes with some hysterisis when you modulate it.

jninek's icon

Lucas: your gen patch is integrating an integrator. Also have a look at the Analog devices AD633 datasheet. It has a circuit for a quadrature oscillator .

lucas boutignon's icon

Thank you both for your responses. i will take a look at all those things !

Graham Wakefield's icon

I'm traveling right now so can't open the patch, but one of the main applications of waveguides is to create oscillators (e.g. string modelling synthesis).

The junction at the core of a waveguide is essentially the same as a complex multiplication, which is a rotation of a vector by matrix transform. (And after all, sin/cos are all about rotations.)

The same effect is also achieved by resonant self oscillating filters, which can also be represented as matrix operations on vectors. Look inside a biquad or SVF, there is no sin/cos on the main audio loops, just multiplies, adds, and delays.

So I wonder if you may have encountered a circuit equivalent to one of these matrix transforms?