From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Batteryman ·
I'm seeking for a request, that formula to construct basic OSC.
And formulas that shows hows to do the stuff.
Considering beginners like me, who whant to understand the basics about OSC, whitout searching itself nuts after formulas. 🙂
If Synthmakers experts here can easly shows examples.
I know however there is a formula that make a Sinus OSC, but that version does not work very well as a Carrier if you whant to modulate it whit frequence,but you can use this as a modulator , that modulate a stock OSC.
Yet, it doesnt have phase input, however in advantage, this forumula takes around 14.9 Cycles.
streamin f;
streamout o;
float sin;
float cos;
float mul;
f = f*8;
stage (0) {sin=0;cos=1;}
hop (2048) {mul = 2*sin1(0.25*f);}
hop ( 4 ) { sin = sin + mul * cos; }
hop ( 4 ) { cos = cos - mul * sin; }
hop (4) { o=(0.25*sin); }
f = f*8 - Works like an pitch offset, like a detuner does, make it sounds like a normal stock OSC would do at C-note, or any other note
hop (2048) - Where you find this number 2048, will make an delay when the signal starts, if you whant to use this code as a modulator, it might be better to set it at 1024 maximum.
hop ( 4 ) { sin = sin + mul * cos; }
hop ( 4 ) { cos = cos - mul * sin; } -Bouth this lines seems to effekt the base pitch,therefore i use f*8 to calibrate the pitch
hop (4) { o=(0.25*sin); } - - By increasing this number it seems to make an resolution "distortion" on the signal, in this example it sounds very 8-bit i beleve.
So , i hope thise experts here can bring up more basic formula here, to learn the beginners Coding 🙂
Batteryman ·
This is also an interesting formula, but takes much cycles compare to a stock OSC,however , you can experiemnts whit Hop codes, and the end result is a bit different than plain , saw and square waves.
feedback = 0.2; - This value can distort the waveform,
0.0 = Sine "orginal"
0.2 = Sawlike
0.3 = Sawlike whit some resonanse like peaks
If you change output = sin1(cnt + output * feedback); TO output = sin1(cnt + output * output*feedback);
You will make a 2 sided waveform, each has mirror side, the result will be square, you can experiement the value between 0.15 to 0.3
aliasant ·
I made some modifications to your first code.
This uses a little more. About 12.7 cycles on my machine. The original used 10 cycles.
The f Input is actually a 0-1 ranged input that probably has little to do with frequency but it works quite well for a fast
lfo signal.
And there are no delays or such weirdness so the rate can be varied.
Could be useful for some maybe?