1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.42">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #952415}
16 span
.s1
{font: 18.0px Helvetica
}
17 span
.s2
{color: #0000ff}
18 span
.s3
{color: #0a20b3}
19 span
.s4
{color: #000000}
20 span
.s5
{color: #0d2bf0}
21 span
.Apple-tab-span
{white-space:pre
}
25 <p class=
"p1"><span class=
"s1"><b>MulAdd
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>Multiply and add to a signal
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p3"><b>MulAdd(in, mul, add)
</b></p>
28 <p class=
"p3"><span class=
"Apple-tab-span"> </span>or
</p>
29 <p class=
"p3"><b>in.madd(mul, add)
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3">Multiplies the signal by
<b>mul
</b> and adds
<b>add
</b>. This UGen is very efficient (it performs various optimisation checks, for example). It is used very heavily throughout SuperCollider to perform multiply and add operations on the server; in fact it is
<span class=
"Apple-converted-space"> </span>what
"really" performs the mul and add arguments found in many UGens.
</p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3"><b>See also:
</b> The discussion of mul and add arguments in the
<a href=
"../UGen.html"><span class=
"s2">UGen
</span></a> help file.
</p>
34 <p class=
"p2"><br></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p3"><b>Examples
</b></p>
37 <p class=
"p2"><br></p>
38 <p class=
"p4">s.boot;
</p>
39 <p class=
"p5"><br></p>
40 <p class=
"p6">// The mul and add arguments of SinOsc themselves use MulAdd!
</p>
41 <p class=
"p6">// These two examples will create precisely the same synth graph:
</p>
42 <p class=
"p4">x = {
<span class=
"s3">SinOsc
</span>.ar(
440,
0,
0.1,
0.05) }.play(s);
</p>
43 <p class=
"p6"><span class=
"s4">x.trace;
</span>// You should see a
"MulAdd" in the trace
</p>
44 <p class=
"p4">x.free;
</p>
45 <p class=
"p5"><br></p>
46 <p class=
"p4">x = {
<span class=
"s3">MulAdd
</span>(
<span class=
"s3">SinOsc
</span>.ar(
440,
0),
0.1,
0.05) }.play(s);
</p>
47 <p class=
"p4">x.trace;
</p>
48 <p class=
"p4">x.free;
</p>
49 <p class=
"p5"><br></p>
50 <p class=
"p6">// In fact this will produce the same graph too - the separate multiply and add are optimised into one MulAdd
</p>
51 <p class=
"p4">x = {
<span class=
"s3">SinOsc
</span>.ar(
440,
0) *
0.1 +
0.05 }.play(s);
</p>
52 <p class=
"p4">x.trace;
</p>
53 <p class=
"p4">x.free;
</p>
54 <p class=
"p2"><br></p>
55 <p class=
"p3">(Note: the
"trace" message is described in the helpfile for
<a href=
"../../ServerArchitecture/Node.html"><span class=
"s5">Node
</span></a>.)
</p>