aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/A06.frequency.pd
blob: b0601b0e90956dd73bd573f34c053aea67fb04c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#N canvas 8 17 693 642 12;
#N canvas 0 0 450 300 graph1 0;
#X array osc-output 4410 float 0;
#X coords 0 1.02 4410 -1.02 200 130 1;
#X restore 473 167 graph;
#X obj 98 261 tabwrite~ osc-output;
#X msg 98 232 bang;
#X floatatom 280 66 0 0 0 0 - - -;
#X text 147 231 <-- click to graph;
#X obj 15 206 r frequency;
#X msg 280 37 set \$1;
#X floatatom 6 66 0 0 0 0 - - -;
#X obj 6 8 r frequency;
#X msg 6 37 set \$1;
#X obj 19 90 s frequency;
#X obj 280 8 r pitch;
#X obj 289 90 s pitch;
#X obj 280 116 mtof;
#X obj 280 145 s frequency;
#X obj 6 145 s pitch;
#X obj 6 116 ftom;
#X text 105 66 <-- set frequency;
#X text 372 65 <-- set MIDI pitch;
#X text 15 429 Frequency and pitch are converted using the "ftom" and
"mtof" objects. Frequency refers to the number of cycles per second.
Pitch is "60" for Middle C \, 61 for C sharp \, 72 for the next C up
\, and so on.;
#X text 476 308 ---- 0.1 seconds ----;
#X text 447 6 FREQUENCY AND PITCH;
#X text 16 363 The osc~ object \, if you give it an argument \, expects
floating-point messages to set its frequency. Without arguments \,
its frequency is controlled by connecting an audio signal to its input.
;
#X text 14 496 Mtof and ftom work fine for microtones (non-integral
"MIDI pitch" ) and don't have MIDI's range restriction-- for example
\, MIDI -36 is about 1 Hz.;
#X text 15 553 Note also the "set" messages going to the number boxes
so that they can each update the other without bringing on an infinite
loop. (get help on number boxes for details.);
#X text 87 291 <-- output level;
#X text 51 116 <-- convert frequency;
#X text 106 134 to "MIDI" pitch;
#X text 327 117 <-- convert "MIDI" pitch to frequency;
#X obj 15 273 output~;
#X text 437 619 updated for Pd version 0.36;
#X obj 15 232 osc~;
#X connect 2 0 1 0;
#X connect 3 0 12 0;
#X connect 3 0 13 0;
#X connect 5 0 31 0;
#X connect 6 0 3 0;
#X connect 7 0 10 0;
#X connect 7 0 16 0;
#X connect 8 0 9 0;
#X connect 9 0 7 0;
#X connect 11 0 6 0;
#X connect 13 0 14 0;
#X connect 16 0 15 0;
#X connect 31 0 1 0;
#X connect 31 0 29 0;
#X connect 31 0 29 1;