«Nested ifs in a SynthDef» by 38nonprivate

on 12 Aug'11 18:30 in simpleif

A short, silly example of using if in a SynthDef. Using Select is generally a better thing to do.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(
{
var noise, out;
noise = LFNoise0.kr(8);

out = if( noise > 0.0,
	if(noise > 0.5, 
		if(noise > 0.9, WhiteNoise.ar(0.2), Pulse.ar(60, 0.5, 0.4)),
	SinOsc.ar(500, 0, 0.25)
	),
	Saw.ar(160, 0.5)
);

out ! 2

}.play;
)
raw 234 chars (focus & ctrl+a+c to copy)
reception
comments
Bjorn Westergard user 12 Aug'11 19:39

I had no idea this worked.