iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree
ewreirrmewwiemirrirwiermiemerweeirwiimweeeeiirerwrwiiwewemeirimemmeeimiiwwrmimiwweiwwmrmiriweeeiremriiemeweireerweeirmwewememriiew
eieewmwmwmrereeiwireeeewermeeereriirriwmemermmmimewmeerwemieieremrrewmemmmmmeirmrmriemmrmweimwrrimeemermiimwwiweeemereieemeeeeweww
eiwereiirmieerwerieeieeereeieweeiieweiwrirmrewieemewiiemeiewmemmewrmreewemmeieiwimwiieieiireeemrmeewmmmmrermewiriiwireereemeirerem
mwrmeeemeeieeieereimmrweweeweeireweeweeieiiieememmwerrrrewewremreeemeeewimwwrewrmrrreeiwmrwewrrwmireemiwwieimieiweeewmmrmemmerieee
emiweiemewrmirerereeerwrmereemeweeiirewmrwwweeewwememrewmwewrmewmwrewemeeiirewwreeeeiweeeiirrimmeimrmrieieeerewrmwewemeerwewwmrwie
iriieweemwwmrwweeeeriirwerirmwiieiieeeerrerwmrmeeerireeweeeemmwmiiweeiewreweiewwiewwwwermrwemwiewwmrrwiiriereereimwieerrermeemerwr
rmimmrreeieerwmirwreiweewermririwmeemiewrieewrmemmmrrweeeieimmwriieeewiemewmemeereeewmwwmweemimewrrewrrermrmeeririiiweiiwwwimeerme
rmemmrweriiwiemeewiierimweierwremrreeweemeireerrrmwewiwwiiiwrwweewreeeirweemwewermeemiieeeiiereriwrererrwrmewiwiwwmeirewrieiiwrrrm
wmeweemireemieeeriererrmemeweewerewerrerwewirremereieririeiimrwireemeweeewirirrwirrmeeeewewriwmrweerremewmwmerrererreeemeriwerewee
erimeimremreierwrwemeeeeemeewwmrwerremeirrrmwewimrrieirewwiewwreeerierwewwmweeiwemrmewemiiewweewrweerremwerewieeweiwweiwwmwwmiieri
eeerrriwmmeweeewrerwrreeeeewemeiiermmeewirmiiremmieeeweiwiirwmeieemwemewmmmiemwiwwieemewerrememewmewieeiimmemrrwereierwieewerirwrr
mmeemerwermerieemiemewrireeeeiwieewrimeiwmiwrerwwrmreeerewreirrwwmieiewemrremmerrwweemiweweiwmmwmmweiirrieerimewmwwremwriweewimeme
rmwiiimeiirwriewmrweeewirwimiremeewrmemmmrrmeieeewwriweeriwrwreimirwewmmmieerewwewwwememimeieeeeewmrreeemmemeeewimeeremeeerriweemi
reewmeeewmiiweimermeeemeeewiwmewemeeweerrwememiweemrwmmiremirirmrerrweemermmewiwweeirmrwmewrmwweewiremimreewiwmeeiiriiwiiirrewmeiw
iereermmeimrwirreirrewerwrirrwemiemrieermwmimeiwwrrreemmermwiewwmiweewemeeewmiweeeriwwrewrweweremrreireiemieimweiieimeieiiemmiemmm
weemwewerrmereirwewiremimiimweeemmwieweieeerimeeweiewrmiwiiwmiemmrwemewemieirewmwieimimeemeeiiemrwrrememmemieiieiiwremmeeeemrewree
emerreiweierrrrirrrwemrmmweeremeeieewrmieeriireiwrrmeemieriereeirimweerwmiiieeimmmrwwewereerrmerreeeiwweirirmiwmeirmrwwmreewieeiie
emeeeimieweiwiiiwemeiiweirmmremwmwmieimmeewwwmerwermimeieieiiwimiewrremrmwewwmeemwermemrrereiemrwrmmimiimeimiieimireweeeirrewewwww
reiereieweerimriieeeeriereimrerweiwiiwirirmwweeiiwremrmriereewiieiererimmweeimrrmmmmmewmrmeeweemwerieiiewimrerrwwwmwmermrwerewrrir
wmmerwwiewriweierirrermemeireeerieememriiewrmmiemmwiweeieeewmrwmiiiiieimrmermirweeweiweeiiiemwwrmirrwemeewmeiemiimerieieiewmermrie
meiireemeemmiieiereemeeeiiiewrrmweewwremmeemirmewweerwwmmmeeeiiieerrmrwereweiiemewirremiemewewimmwrewiiewiriwiririwewrriwemeiewrii
eirrrmrwrrwrieiwriimiememeiiewweeiemrwewewirriiwmwwmimereerieewwrrmmrrmemereieeewimrreeiiwweeiwwweiiemrwimreieiimiwweremeeweemriwr
erriremerwwmremewriweemweerrweemeiwmimerieweiemmrrrwrmeirmrmewmwweeimrwmewwwrmemerimreerrewmrrewrieeemmwemwrwmeermwwemreeeewweweei
ireeeeeiirmeiireemmremrerirwererieewiwerimmeieerermmmiimeeieeiwmiimrermrewemmremimiwireeeremrereiemmemewrrereerewwrewimemreewmirir
rmeeimmmieeewiiimmeeewrwerewreeimeeweeiwwemimrwmwriwreiimeiieeeeewewewimrmiwrieemeeirweemieeimmmrmreereewmmmeirmiemwrrwriwmeieimwr
rwrimwrwemimimwweewiimremiweereeeeririeemeereeerweirweremrreeiwwmmieeewrwriemeimewreeierieermreieeirmmwwwweiwwieemmimrermreeeeeeri
iewmmeereweiiierieriirmwmemreiremiereemwimmwwmeemreiirreereemmreeimeiwwwrewriirewweewmmrwereemerieemiewiiirrremmerwrewmeririrweeiw
eiwiremwrireieemiieemerewrrwiieemerrmmemeiwwerewiemweewiemmeiemrwwirermrrewmeirmiieeeeeeewemeeeeiiimreeiiiwwewirrreeewriwreiimeiee
miermerwmeewrmeirwmemiweewwwmemwieeeeemeiieeeiiwrmwieewmiewwwewewmreerewrerweeewwmmermmwremwriemeeereerremmwierwiweeemwwmweirrriwe
eememewimrriererwrerwemweiemeierireeememewewieiirmwrwwerimwimiemiemimmmieweewwiierereemiiiwmwwrrwwemrwiiewereeimewrwrreieiwimwmrmr
wmmmeirrrirerwiimweewrieweiieimwiwiweiwiirwemeeererewrreiemwwiwrermmiwieirirrmeeiimriwewrrmrreeereeeeewmrwimrwrrmiewemwrwimreemwwi
eeeerrerwrierriermeeerwermmeeiwimmiereerwewimwewieremwewreimeeiwireriireemiemiwerweriewireeeemmererwmrmmreeererweemmerwrmirrmeeeee
meewreiirwrmmmwwemiimreeeiieweeeewiieeeermremewmermweerrermwwmemeerireiimwwiwewermeermmrreermimiiermeewereeeewmrwwrwmmerwwrimeeeii
rmiieeewwirimemmwermimeremrmeimmwiiewmmerrrieiiemwemwmmmewrmmeemreeewemewmewieeemieirwmmermeemreemieweeeiieweirremeieeeeemieiiieew
eemwrermeeeeeeeeemrrmieeeemwiewiieerrreiewmmeiwiwiirirmewewrwwrimeiermiwmrriweiiwweweewmwmmewwmrieieewwremiiiimririiiwmimewwmeieer
irrememieemrrmemrweerimmeimeeiwirimeeweweeewreeiermewiweweieieirrwwwrmereeiwermeeeirmieeeweiiewwwiereremeemmrmmwmmwwiiwiweieereimr
wwmremiiwrreeirrieewerweimweremeweemmmieriwemeemiwerirmeeeimerewmrrereeweiewermrimiwmwremireimriimiweewmmweeremewirrmiwwemmewmweee
ieremmmwrrmreereiweermewreiriewirerimrirerreemmwmeieriieeeemiirireemeiiewrmeermwmremmrwwmwmwewreirierrmewmwmewmmwwwemimrmmrmeewrmr
ewrrmriewreemmmmewwiewmewiiimrreeimeeieeewmeeweweiiwimiewrwriwwreremewwewmweeiemmrieiwermimmewireeweiwrirerewemeeieeewmeweeeiemmir
rremewemwwimiiweeiemerwiweiwreeeieerewreremweewieweermmrieermrimmermmeieirerririeeweireemeirwiiemwmiwrwwewrewrmeeeeemmmwremeeereem

5.9.08

lets get physical

.cc - week six.

This week I attempted to use the physical modeling technique called Karplus-Strong string synthesis.



(
//SYNTHS

//WHITE NOISE SYNTH
// Delayed Noise Generator - Envelope > Noise Generator > Delay
SynthDef("White Noise", {

// Arguments
arg midiPitch = 50; //input

// Variables
var burstEnv, noise, delay, att = 0.00001, dec = 0.001, out,
delayDecay = 10, trigRate = 1;
//delayTime = midiPitch.midicps.reciprocal,

// Envelope
burstEnv = EnvGen.kr(
envelope: Env.perc(att, dec),
doneAction: 0
);

// Noise Generator
noise = WhiteNoise.ar(
mul: burstEnv
);

// Delay
delay = CombL.ar(
in: noise,
maxdelaytime: midiPitch.midicps.reciprocal,
delaytime: midiPitch.midicps.reciprocal,
decaytime: delayDecay,
add: noise
);

// Output
Out.ar(
bus: 0,
channelsArray: delay.dup
);

}).send(s);

//PINK NOISE SYNTH
// Delayed Noise Generator - Envelope > Noise Generator > Delay
SynthDef("Pink Noise", {

// Arguments
arg midiPitch = 50; //input

// Variables
var burstEnv, noise, delay, att = 0.00001, dec = 0.001, out,
delayDecay = 10, trigRate = 1;

// Envelope
burstEnv = EnvGen.kr(
envelope: Env.perc(att, dec),
doneAction: 0
);

// Noise Generator
noise = PinkNoise.ar(
mul: burstEnv
);

// Delay
delay = CombL.ar(
in: noise,
maxdelaytime: midiPitch.midicps.reciprocal,
delaytime: midiPitch.midicps.reciprocal,
decaytime: delayDecay,
add: noise
);

// Output
Out.ar(
bus: 0,
channelsArray: delay.dup
);

}).send(s);

//GREY NOISE SYNTH
// Delayed Noise Generator - Envelope > Noise Generator > Delay
SynthDef("Grey Noise", {

// Arguments
arg midiPitch = 50; //input

// Variables
var burstEnv, noise, delay, att = 0.00001, dec = 0.001, out,
delayDecay = 10, trigRate = 1;

// Envelope
burstEnv = EnvGen.kr(
envelope: Env.perc(att, dec),
doneAction: 0
);

// Noise Generator
noise = GrayNoise.ar(
mul: burstEnv
);

// Delay
delay = CombL.ar(
in: noise,
maxdelaytime: midiPitch.midicps.reciprocal,
delaytime: midiPitch.midicps.reciprocal,
decaytime: delayDecay,
add: noise
);

// Output
Out.ar(
bus: 0,
channelsArray: delay.dup
);

}).send(s);

//BROWN NOISE SYNTH
// Delayed Noise Generator - Envelope > Noise Generator > Delay
SynthDef("Brown Noise", {

// Arguments
arg midiPitch = 50; //input

// Variables
var burstEnv, noise, delay, att = 0.00001, dec = 0.001, out,
delayDecay = 10, trigRate = 1;

// Envelope
burstEnv = EnvGen.kr(
envelope: Env.perc(att, dec),
doneAction: 0
);

// Noise Generator
noise = BrownNoise.ar(
mul: burstEnv
);

// Delay
delay = CombL.ar(
in: noise,
maxdelaytime: midiPitch.midicps.reciprocal,
delaytime: midiPitch.midicps.reciprocal,
decaytime: delayDecay,
add: noise
);

// Output
Out.ar(
bus: 0,
channelsArray: delay.dup
);

}).send(s);
)

// GUI INTERFACE

(
//GUI
var w, b, line, titleBox;
var popper; //pop-up

~notes = Pseq([1, 12, 5, 7, 11], inf).asStream;

w = GUI.window.new( "WEIMER".scramble, Rect( 128, 64, 258, 150 )); //window size

w.view.decorator = FlowLayout( w.view.bounds );
w.view.background = Color( 0.0,0.714,0.96 );

//heading
titleBox = SCStaticText(
parent: w,
bounds: Rect(20, 100, 412, 65)
);
titleBox.stringColor_(Color.white);
titleBox.background_(Color(0.0,0.714,0.96));
titleBox.string_("STRINGZ¨");
titleBox.font_(Font("Arial Black", 25));

//button 1
SCButton(w, Rect(20,20,80,26))
.states_([["Play", Color.black, Color.white]])
.mouseDownAction_({
(
Pbind(
\dur, Prand([0.1,0.1,0.2,0.3,0.5,0.8,], inf), // [0.5, 1.0, 1.5]
\instrument, \++t.at(popper.value)
).play
);
});

//pop-up menu
t = [
"White Noise",
"Brown Noise",
"Pink Noise",
"Grey Noise"
];
popper = SCPopUpMenu(w,Rect(10,10,166,26));
popper.items = t;
popper.background_(Color.white);
popper.action = { arg popper;
t.at(popper.value).postln; //post selection
};

//slider
e = EZSlider(w, // window
250 @ 24, // dimensions
"MIDI Note:", // label
ControlSpec(0, 127, \lin, 1.0), // control spec
{|slid| Synth( \++t.at(popper.value), \midiPitch, 0)},// slid.value.asInteger.postln
50 // initVal
);


//a = SCSlider(w, Rect(20, 80, 100, 40))
// .focusColor_(Color.white)
// .step_(1)
// .action_({
// Synth(\++t.at(popper.value), \midiPitch, (a.value * 100).round(1)) //a.value (a.value * 100)
// });

w.front;

)

wksix.mp3 (788 kB)
| letsgetphysical.rtf (12 kB)

.sources.

Haines, Christian 04.09.08, “Physical Modelling (1),” Lecture of EMU, Adelaide University.


No comments: