hello all.
I'm a total newcomer here, and I have more or less 2 days working experience with Pd
so please bear with me for the "bad coding" or naivety or whatever. anyway, this is my first Pd patch, and I thought it deserves to be shared.
it is a morphing oscillator with controllable fatness, thus called "fatosc~". it has 2 inlets (frequency and fatness) and one outlet (the noise!).
the "fatosc~demo" patch features an oscilloscope and can be eventually played via MIDI. (no envelope or fancy stuff, monophonic and note on/off sensing seems to be a bit flakey).
I originally coded the oscillator for a completely different project of mine, but wanted to do some quick soundcheck with a realtime system, and Pd fitted just perfectly.
the original C code looks like this:
if(phase > 0.75) {
output = -1.0 + pow((phase-0.75)*4.0, fatness);
} else if(phase > 0.50) {
output = -1.0 + pow(1.0-(phase-0.50)*4.0, fatness);
} else if(t > 0.25) {
output = 1.0 - pow((phase-0.25)*4.0, fatness);
} else {
output = 1.0 - pow(1.0-phase*4.0, fatness);
}
I had a hardtime figuring out a Pd equivalent for if/else. and I'm still not sure I got it right
anyway: with fatness=1 the oscillator generates a triangle wave. with fatness=PI, it generates a sine wave (don't know if it's a mathematically pure sine, but it looks pretty similar). going up with the fatness, it approximates a square wave.
on the other hand, with fatness < 1 it generates a nice looking curved triangle waveform, which I've called "jawtooth". I was really thinking "shark tooth", but my fingers are faster than thought
with very small fatness values, it "degenerates" to almost silence.
should be interesting to do some FM or other modulation with it. that's what I'm going to try next.
hope you find it useful and/or entertaining.
PS. of course, the algorithm is "pat.pend.", so if you're going to use it in a commercial product, my horde of lawyers will knock at your door and haunt you in your dreams.
ok, just jocking, feel free to do whatever you like with it.
critics welcome!
cheers,
Aldo