Merge branch 'newtree'
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2pd / examples / basic / test.pd
1 #N canvas 283 179 627 567 10;
2 #X obj 160 958 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
3 -1;
4 #X obj 220 1044 print;
5 #X obj 258 973 karplus~;
6 #X msg 88 918 gate 1;
7 #X msg 148 918 gate 0;
8 #X obj 283 1044 dac~;
9 #X obj 467 640 tone~;
10 #X obj 467 189 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
11 -1;
12 #X obj 467 705 print;
13 #X msg 467 376 vol;
14 #X obj 481 675 dac~;
15 #X msg 467 409 pitch 220;
16 #X msg 467 431 pitch 440;
17 #X msg 467 319 vol 0.3;
18 #X msg 467 604 vol 0;
19 #X msg 258 915 freq \$1;
20 #X text 24 374 5 Sending just the control name reports the current
21 value of the control on the first outlet.;
22 #X text 24 417 6 Use these to change the pitch (frequency) of the tone.
23 ;
24 #X text 23 9 1 This is a simple test patch which demonstrates how you
25 work with Faust DSPs in Pd. As with any other Pd external \, you need
26 to compile the Faust DSPs before you can use them in Pd. The accompanying
27 GNU Makefile has the rules to do this. So if you haven't done this
28 already \, use "make" now to compile the plugins using the faust compiler
29 and gcc \, which will make all the "can't create" messages go away.
30 ;
31 #X obj 498 587 loadbang;
32 #X obj 469 27 loadbang;
33 #X obj 88 866 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
34 -1;
35 #X obj 148 892 del 100;
36 #X text 110 864 <-- bang to play a note;
37 #X text 333 892 <-- change the pitch here;
38 #X text 29 1139 Albert Graef \, Sep 2006;
39 #X obj 253 1008 freeverb~;
40 #X text 23 958 print controls -->;
41 #X text 24 186 3 You can bang the leftmost \, "control" inlet to get
42 the control parameters of the DSP. The descriptions of the controls
43 are then sent to the first outlet to which we have connected a print
44 object below so that the results are printed in Pd's main window. For
45 each control the description contains the type of control (as defined
46 by the Faust source) \, the (fully qualified) name of the control \,
47 its current value \, its initial value \, its range (from..to) and
48 step size.;
49 #X msg 356 972 active \$1;
50 #X obj 356 950 tgl 15 0 empty active empty 0 -6 0 8 -262144 -1 -1 1
51 1;
52 #X msg 467 483 active \$1;
53 #X obj 467 461 tgl 15 0 empty active empty 0 -6 0 8 -262144 -1 -1 1
54 1;
55 #X text 375 950 <-- enable/disable freeverb here;
56 #X text 25 584 8 Hit the "vol 0" message when you've heard enough.
57 (We've also attached a loadbang to this message so that the unit is
58 silent initially.);
59 #X text 25 740 10 Our final example is a slightly improved version
60 of the Karplus-Strong synth from the Faust distribution (karplus.dsp).
61 It can be played by changing the pitch with the number box and sending
62 gate 1/gate 0 messages to start and end a note \, respectively. In
63 this patch we've added a bang and a delay to automate this process.
64 We've also attached a little freeverb~ unit (freeverb.dsp) to illustrate
65 how you can build a simple synth/effect chain.;
66 #X text 489 461 <-- enable/disable;
67 #X obj 258 893 nbx 5 14 20 20000 0 0 empty freq empty 0 -6 0 10 -262144
68 -1 -1 220 256;
69 #X msg 469 60 \; pd dsp 1 \; active 1 \; freq 440;
70 #X text 23 120 2 Ok \, if you've successfully compiled the DSPs then
71 this patch should load without errors now. So let's take a look at
72 our first example \, a simple sine tone generator. You can find the
73 Faust source for this unit in tone.dsp.;
74 #X text 25 314 4 You can change a control value by sending a message
75 with the control name and value to the first inlet. E.g. \, let's hit
76 the "vol 0.3" message to crank up the volume so that we can listen
77 to the unit.;
78 #X text 24 456 7 There's also a special control named "active" which
79 lets you turn a Faust DSP on and off. This control is added automatically
80 for your convenience so that you do not have to define it yourself.
81 The default behaviour of the control \, when the value is 0 \, is to
82 pass through the input signal if the number of audio inputs and outputs
83 match \, and to generate silence otherwise. (You can also give your
84 own custom definition of the active control in the Faust source if
85 the default behaviour is not appropriate.);
86 #X text 28 1077 More examples of useful Faust DSPs can be found in
87 the other examples subdirectories. In particular \, take a look at
88 examples/synth/synth.pd which contains a full-blown polyphonic synth
89 based on different Faust units. Enjoy! :);
90 #X text 24 634 9 Here's the object itself \, with a print attached
91 so that the results of control messages sent to the leftmost inlet
92 are printed in Pd's main window. The remaining outlets are the audio
93 outputs which can be routed to a dac~. In general Faust DSPs may also
94 have audio inputs \, of course \, these will then be available as additional
95 audio inlets (see \, e.g. \, the freeverb~ object below as an example).
96 ;
97 #X connect 0 0 2 0;
98 #X connect 0 0 26 0;
99 #X connect 2 0 1 0;
100 #X connect 2 1 26 1;
101 #X connect 2 2 26 2;
102 #X connect 3 0 2 0;
103 #X connect 4 0 2 0;
104 #X connect 6 0 8 0;
105 #X connect 6 1 10 0;
106 #X connect 6 2 10 1;
107 #X connect 7 0 6 0;
108 #X connect 9 0 6 0;
109 #X connect 11 0 6 0;
110 #X connect 12 0 6 0;
111 #X connect 13 0 6 0;
112 #X connect 14 0 6 0;
113 #X connect 15 0 2 0;
114 #X connect 19 0 14 0;
115 #X connect 20 0 38 0;
116 #X connect 21 0 3 0;
117 #X connect 21 0 22 0;
118 #X connect 22 0 4 0;
119 #X connect 26 0 1 0;
120 #X connect 26 1 5 0;
121 #X connect 26 2 5 1;
122 #X connect 29 0 26 0;
123 #X connect 30 0 29 0;
124 #X connect 31 0 6 0;
125 #X connect 32 0 31 0;
126 #X connect 37 0 15 0;