19. 5rm and 5 mix using Array or Mix.fill

//5rm and 5 mix(at least 2 using Array or Mix.fill)

(
var input1,input2,rm;
{
input1=SinOsc.ar(SinOsc.kr(0.1,0,300,1700),0,0.3);
input2=LFTri.ar(LFTri.kr(0.4,0,500,2500),0,0.3);
rm=Pan2.ar(input1 ring1: input2)}.scope
)
/*
ring2: ring3: ring4:
*/
//rm1
(
var in1, in2, rm;
{
in1=SinOsc.ar(400,0,0.3);
in2=SinOsc.ar(500,0,0.1);
rm=Pan2.ar(in1 ring1:in2)}.scope
)

//rm2
(
var in1, in2, rm;
{in1=LFNoise0.ar(400,0.3);
in2=SinOsc.ar(401,0,0.3);
rm=Pan2.ar(in1 ring1:in2)}.scope
)
//rm3
(
        (
        var in1, in2, rm;
        a={|den=0.01,mul=0.5|
                {in1 = WhiteNoise.ar(den);
                 in2 = LFTri.ar(0.5,0,mul);
                 rm = Pan2.ar(in1 ring1:in2)}
               }
         )
)
{a.value}.scope
//rm4
(
var in1, in2, rm;
a={|freq=1000,mul1=0.3,mul2=0.01|
in1=Array.fill(4,{Saw.ar(Dust.kr(freq.rand+100,1000,2000),mul1.rand+0.1)});
in2=LFNoise0.ar(50,mul2);
rm={Pan2.ar(in1 ring1:in2)}!2
        }
)
{a.value}.scope
//rm5
(
var in1, in2, rm;
{|freq1=100,mul1=0.5,freq2=101,mul2=0.5,mul3=0.5|
in1=Mix.fill(2,{SinOsc.ar(freq1.rand,1pi.rand,mul1)
                                        +
                                   LFTri.ar(freq2.rand,0,mul2)*0.5/2});
in2=WhiteNoise.ar(mul3);
rm={Pan2.ar(in1 ring1:in2)}}.scope
)

//mix1
(
var a, b, m;
        x ={|freq1 = 440, freq2=441|
                a=Mix{[SinOsc.ar(freq1,0,0.3), SinOsc.ar(freq2,0,0.3)]};
                b=Mix{[Saw.ar(330,0.3),Saw.ar(331,0.3)]};
                m={Pan2.ar(a+b)}//****
        }
)
{x.value}.scope
{x.value(freq1:390,freq2:872)}.scope                

//mix2
(
var a, b, m;
        z ={|den = 400, den2=10, min=100, max=1000|
                a=Mix.fill(5,{Dust.ar(den,0.5)+Saw.ar(exprand(min,max))}*0.1/5);
                b=Mix.fill(5,{Dust.ar(den2,0.5)+Saw.ar(31,0.3)});
                m=(Mix([a,b])*0.5)!2//**********
        }
)
{z.value}.scope

//mix3
(
var a, b, m;
        y={| size=4, size2=9, den1=0.3, den2=0.01,freq=400,freq2=50,rq=0.01,rq2=0.1|
        a=Mix.fill(size, {Resonz.ar(WhiteNoise.ar(den1.rand),freq+freq.rand,rq)});
        b=Mix.fill(size2, {Resonz.ar(WhiteNoise.ar(den2.rand),freq2+freq2.rand,rq2.rand)});
        m=(Mix([a,b])*3)!2
        }
)
{y.value}.scope

//mix4
(
var a, b, m;
        u={| size=4, size2=9, den1=0.3, den2=0.01,freq=400,rq=0.01,rq2=0.1,start=1.5,end=0.01,dur=5|
        a=Array.fill(size, {Resonz.ar(WhiteNoise.ar(den1.rand),freq+freq.rand,XLine.kr(end,start,dur))});
        b=Array.fill(size2, {Resonz.ar(WhiteNoise.ar(den2.rand),(freq*1/2)+(freq*1/2).rand,XLine.kr(start,end,dur))});
        m=(Mix([a,b])*0.5)!2
        }
)
{u.value}.scope

//mix5
(
var a,b,c,m;
                i={|start=10000,end=3,dur=5, freq=500.0,decay=1.0|
                a=Array.fill(10, {Ringz.ar(Impulse.ar(freq+freq.rand,0,0.5),freq*1/2,decay.rand,0.5)}*0.1/10);
                b=Mix.fill(10,{Ringz.ar(Dust.ar(XLine.kr(start,end,dur,0.1),0.5),freq,decay.rand,0.5)}*0.1/10);
                c=Mix.fill(10,{SinOsc.ar(freq-freq.rand,0,0.4)}*0.1/10);
                m=(Mix([a,b,c]))!2
                    }
)        
{i.value}.scope

//——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community

18. 5 different example using argument with Mix and Array

//1
(
a={|freq = 1000, decaytime = 0.5, mul = 0.5|

        {Ringz.ar(WhiteNoise.ar(0.05),freq.rand,decaytime,mul)
        }!4
        }
)
{a.value}.scope
{a.value(500)}.scope
{a.value(freq:500, mul:0.5.rand)}.scope

//2
(
b={|size = 2, density=100, freq=1,decaytime = 2, mul=0.1, mul2=0.5|
                        Mix.fill(size,{Ringz.ar(Dust.ar(density,mul/size)
                                                 +
                                                SinOsc.ar(freq,0,mul2/size))
                                                }
                                        )!4
        }
)
{b.value}.scope
{b.value(density:10)}.scope                
{b.value(freq:1000.0.rand,mul2:0.005)}.scope

//3        
(
c={|size = 2, density=100, freq=1,min=100,max=4000, mul=0.05|
                        Mix.fill(size,
                                                {Saw.ar(exprand(min,max)
                                                 +
                                                SinOsc.kr(freq,0,mul)*(0.1/size))
                                                })
        }
)

(
c={|size = 2, density=100, freq=1,min=100,max=4000, mul=0.05|
                        Mix.fill(size,
                                                {Saw.ar(exprand(min,max))
                                                 +
                                                SinOsc.ar(freq,0,mul)
                                                *(0.1/size)
                                                })!8
        }
)
{c.value}.scope
{c.value(freq:5,mul:0.3)}.scope
{c.value(min:100,max:5000.0.rand,mul:0.05)}.scope

//4-correct
(
d={| size=2,den=0.005, freq=100, sinmul=1000,sinadd=1100|
                Mix.fill(size,{WhiteNoise.ar(den)
                                                +
                                                Saw.ar(
                                                Array.fill(5,{SinOsc.kr(freq.rand,0,sinmul,sinadd)
                                                })*0.1/5)                        
                                                }*0.1/size)!2
                                                }
)
//correct
(
d={| size=2,den=0.005, freq=100, sinmul=500,sinadd=1000|
                Mix.fill(size,{WhiteNoise.ar(den)
                                                +
                                        Saw.ar(Array.fill(
                                                                          5,{
                                                                        Saw.ar(freq.rand,sinmul.rand,sinadd)
                                                                                }*0.1/5
                                                                          )
                                                        )*0.1/size
                                                }
                                )!2
        }
)
(
a={Array.fill(3,{SinOsc.ar([220,440,660].choose,0,[0.1,0.3,0.2].choose)})}
)
{a.value}.scope
{d.value}.scope
{d.value(freq:20)}.scope
{d.value(den:0.001,sinmul:500.rand,sinadd:exprand(510,2000))}.scope

//5-correct
(
e={| size=2, den=10, freq=1000|
                Mix.fill(size,{Dust.ar(den,0.2)
                                                +
                                                SinOsc.ar(Array.fill(8,
                                                                                {SinOsc.kr(freq,0,100,1000)}
                                                ))}*0.1/size)!2
                                                }
)
{e.value}.scope
{e.value(den:1000.0.rand, freq:10.0.rand)}.scope
//6
(
f={|den=0.5, freq=1000, ffreq=1000,mul=0.5|
                Mix([WhiteNoise.ar(den),
                     Resonz.ar(Saw.ar(SinOsc.kr(freq,0,0.5)),
                                                ffreq,exprand(0.1,1.0),mul)
                                                ])!2
                                                }
)
{f.value}.scope
{f.value(den:0.1,ffreq:4000.0.rand)}.scope

//——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community

17. 6 different resonant filters 예제

6 different resonant filters using as a trigger Dust, Impulse, and SinOsc. rq should be modulated with MouseX, XLine, and other UGens.(with doneAction:2)

{Ringz.ar(Dust.ar(5,0.3),SinOsc.kr(0.5,0,500,1000),XLine.kr(0.1,0.5,5,doneAction:2),0.5)}.scope

{Resonz.ar(Dust.ar(1000,0.5),SinOsc.kr(0.5,0,500,1000),XLine.kr(0.1,3,8,doneAction:2),0.8)}.scope

{Resonz.ar(Impulse.ar(100,0,0.8),LFTri.kr(0.5,mul:1000,add:2000),XLine.kr(0.01,5,10,doneAction:2),1)}.scope

{Resonz.ar(WhiteNoise.ar(0.5),SinOsc.kr(0.1,0,2000,5000),MouseX.kr(0.001,2,1),0.3)}.scope

{Resonz.ar(WhiteNoise.ar(0.5),MouseY.kr(1000,4000,1),MouseX.kr(0.01,2,1),0.3)}.scope

{Resonz.ar(Dust.ar(100,0.5),MouseY.kr(100,10000,1),MouseX.kr(0.01,1,1),0.8)}.scope

{Resonz.ar(WhiteNoise.ar(0.5),MouseY.kr(100,3000,1),MouseX.kr(0.01,1,1),0.8)}.scope

{Resonz.ar(WhiteNoise.ar(0.8),XLine.kr(1000,50,1.8,doneAction:2),XLine.kr(1,0.01,2,doneAction:2),0.5)}.scope

{Resonz.ar(Impulse.ar(500,0,0.8),SinOsc.kr(10,0,200,800),XLine.kr(0.01,0.8,5,doneAction:2),0.5)}.scope

{Ringz.ar(WhiteNoise.ar(0.05),SinOsc.kr(0.5,0,500,2500),XLine.kr(2,0.1,10,doneAction:2),0.1)}.scope

//——————————————
http://csound.x-y.net
Ji Youn Kang,
Csound Max Community