# [PD] Creating a basic oscillator from first principles?

Sat Feb 7 18:31:48 CET 2009

```Hi
I am very new to PD and DSP concepts.
So this will be hopelessly, awfully, basic :)

I have just started chapter 3 of 'The theory and technique of
electronic music'
which is excellent

However it raises a million questions in my head...... one of which
is how do I create an oscillator myself?

Its really bugging me everytime I create an example from the book. I
feel I need to understand the fundamentals of how the basic objects
are created too.

It seems too easy for me to just use the phasor object provided,

So I thought I would struggle through it and try to work it out.

This is how I am thinking about it.
If I want to create a sawtooth oscillator then this is just a ramp
function i.e. a number that increases by 1 each time.
therefore if I use a simple float that, that adds 1 each time and a
modulus % object to cap it, then I will have my repeating ramp wave :)

However I am triggering it by the metro object which is way too slow,
how can I send a bang to the float object say every sample? or alot
quicker than one millisecond?

My thinking is if I could speed up the bangs to a sample level I
would then have more scope to then actually tune it, and create the
shape I want. However I am sure to do this well would require working
at a higher sample rate, but I am not really sure how to proceed.

Below is my appalling attempt :) I use the number box to change pitch.

Any guidance appreciated
Cheers
Geoff

#N canvas 325 62 681 388 10;
#X obj 119 69 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 121 96 f;
#X obj 181 116 + 1;
#X obj 115 17 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 127 238 dac~;
#X obj 118 46 metro 1;
#X floatatom 187 163 5 0 0 0 - - -;
#X obj 115 160 %;
#X obj 114 199 /;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 0 7 0;
#X connect 2 0 1 1;
#X connect 3 0 5 0;
#X connect 5 0 0 0;
#X connect 6 0 7 1;
#X connect 6 0 8 1;
#X connect 7 0 8 0;
#X connect 8 0 4 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090207/3478d043/attachment.htm>
```