Advertisement
lachjs

Untitled

Oct 16th, 2023
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (
  2. ~rios = Buffer.read(s, "C:/Users/tania/Documents/Naciente/Rendered/
  3.                         Naciente Edit 1 Export 1.wav");
  4.  
  5. SynthDef(\riofilto,{|out, bufnum, gate = 1, amp = 0.70, rate1 = 1,rate2 = 2, rever = 0.9,filterBin = 0|
  6.    var in, chain,phaseA,phaseB,env , inA, chainA, inB, chainB,   
  7.        chainC,salida;
  8.    phaseA = Phasor.ar(0, BufRateScale.kr(~rios) * rate1, 0, 
  9.             BufFrames.kr(~rios));
  10.    phaseB = Phasor.ar(0, BufRateScale.kr(~rios) * rate2, 0,             
  11.             BufFrames.kr(~rios));
  12.    inA = BufRd.ar(2, ~rios,phaseA);
  13.    inB = BufRd.ar(2, ~rios,phaseB);
  14.    chainA = FFT(LocalBuf(2048), inA);
  15.    chainB = FFT(LocalBuf(2048), inB);
  16.    chain = PV_Add(chainA, chainB);
  17.    chain = PV_BrickWall(chain,filterBin);
  18.    salida = IFFT(chain).dup;
  19.    2.do{
  20.      salida = AllpassN.ar(salida,0.3,[0.091.rand,0.091.rand],rever)
  21.    };
  22.    env = EnvGen.kr(Env.asr(1,1,4),gate, doneAction:2);
  23.    Out.ar(0,salida*env)*amp
  24. }).add
  25. )
  26.  
  27. ~synFiltRio = Synth(\riofilto)
  28. ~synFiltRio.set(\rate1,0.12,\rate2,212.25)
  29. ~synFiltRio.set(\gate,0)
  30.  
  31. (
  32. ~w = Window.new("Ventana", Rect(110,110,700,600),true,true).front;
  33. ~w.layout = HLayout(~w1 =CompositeView(~w).background_(Color.black));
  34. ~b = {Button(~w)}!1;
  35. ~d= {Slider(~w)}!4;
  36. ~f = { StaticText (~w)}!4;
  37.  
  38. ~w1.layout = VLayout(HLayout(*~b),HLayout(*~d),HLayout(*~f));
  39. ~b[0].states_([
  40.     ["Rio", Color.red,Color.black],
  41.     ["stop", Color.black,Color.green],
  42. ]);
  43. ~b[0].action_({ arg butt;
  44.     switch( butt.value,
  45.       1, {~synFiltRio = Synth(\riofilto)},
  46.       0,{~synFiltRio.set(\gate,0)}
  47.       )
  48. });
  49. //--------sliders---------------------------
  50. ~d[0].action_({ arg sl;
  51.     ~synFiltRio.set(\rate1, sl.value.linlin(0,1,0.1,150).postln)
  52. });
  53. ~d[1].action_({ arg sl;
  54.     ~synFiltRio.set(\rate2, sl.value.linlin(0,1,0.1,150).postln)
  55. });
  56. ~d[2].action_({ arg sl;
  57.     ~synFiltRio.set(\filterBin, sl.value.linlin(0,1,-1.0,1.0).postln)
  58. });
  59. ~d[3].action_({ arg sl;
  60.     ~synFiltRio.set(\rever, sl.value.linlin(0,1,0.9,3.0).postln)
  61. });
  62. ~d[4].action_({ arg sl;
  63.     ~wavT5.set(\amp, sl.value.linlin(0.0,1.0, 0.0,4.0)) 
  64. });
  65. ~f[0].string = "rate 1";
  66. ~f[0].background = Color.white;
  67. ~f[1].string = " rate 2";
  68. ~f[1].background = Color.white;
  69. ~f[2].string = " filtro Low-High";
  70. ~f[2].background = Color.white;
  71. ~f[3].string = " rever";
  72. ~f[3].background = Color.white;
  73.  
  74. )
  75. ´
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement