Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2023
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. s.options.hardwareBufferSize = 256;
  2. s.recHeaderFormat = "wav";
  3. s.options.memSize = 65536*4;
  4. s.boot;
  5.  
  6. (
  7. ~tempo.value();
  8. ~patches.value();
  9. ~synthdefs.value();
  10. ~buffers.value();
  11. ~patterns.value();
  12. )
  13.  
  14. (
  15. (
  16. ~tempo = {(
  17. t = TempoClock.new(137/60, queueSize: 2048 * 128);
  18. t.tempo_(137/60);
  19. )};
  20. );
  21. ~tempo.value();
  22. )
  23.  
  24. (
  25. (
  26. ~patches = {(
  27. ~sources = Group.head;
  28. ~mixer = Group.tail;
  29. ~patch1 = Bus.audio(s, 2);
  30. ~patch4 = Bus.audio(s, 2);
  31. ~channel1 = Group.tail(~mixer);
  32. ~master = Group.tail(~mixer);
  33. )};
  34. );
  35. ~patches.value();
  36. )
  37.  
  38. (
  39. (
  40. ~synthdefs = {(
  41. ~s = Scale.minor.degrees.midiratio;
  42. ~d = Scale.major.degrees.midiratio;
  43. SynthDef.new(\mainbuf, {
  44. arg amp = 1, pan = 0, rate = 1, pos = 0, bank, atk = 0.01, rel = 1, loop = 1, gate = 1, fader = 1, patch = 22, bufrate = 44100, smoothing = 0.5;
  45. var sig, env, z;
  46. env = EnvGen.kr(Env.perc(atk, rel), gate, doneAction: 2);
  47. sig = PlayBuf.ar(1, bank, BufRateScale.kr(bank) * rate, 1, pos, loop) * env;
  48. sig = Pan2.ar(sig, pan);
  49. sig = Out.ar(patch, sig * amp);
  50. }).add;
  51. ~channel1 = (
  52. SynthDef(\ch1mix, {
  53. arg moogcut = 21000, gain = 0, highcut = 22, lowcut = 22, fader = 1, crossfader = 1, maxdelaytime = 0.2, delaytime = 0.2, decaytime = 1.0, mul = 1, pitchRatio = 1, pitchDispersion = 0, timeDispersion = 0;
  54. var sig;
  55. sig = In.ar(~patch1, 2);
  56. //sig = MoogFF.ar(sig, moogcut, gain);
  57. //sig = AllpassC.ar(sig, maxdelaytime, delaytime, decaytime, mul);
  58. //sig = HPF.ar(sig, highcut);
  59. //sig = PitchShift.ar(sig, delaytime, pitchRatio, pitchDispersion, timeDispersion);
  60. sig = Out.ar(~patch4, sig);
  61. }).play(~channel1);
  62. );
  63. ~master = (
  64. SynthDef(\mastermix, {
  65. arg moogcut = 29000, gain = 0, highcut = 22, mix = 0.33, room = 0.5, damp = 0.5;
  66. var sig;
  67. sig = In.ar(~patch4, 2);
  68. sig = FreeVerb.ar(sig, mix, room, damp);
  69. sig = Compander.ar(sig);
  70. sig = Limiter.ar(sig);
  71. sig = Out.ar(0, sig);
  72. }).play(~master);
  73. );
  74. )};
  75. );
  76. ~synthdefs.value();
  77. )
  78.  
  79. (
  80. (
  81. ~buffers = {(
  82. Buffer.freeAll;
  83. ~bufbank = Array.newClear(30);
  84. 30.do({ arg i;
  85. ~bufbank[i] = Buffer.readChannel(s, "/Users/spyridonpallis/Documents/SuperCollider/Samples/D7X/untitled" ++ (i+1).asString ++ ".wav", channels: [0]);
  86. });
  87. 8.do({ arg i;
  88. ~bufbank.add(Buffer.alloc(s, s.sampleRate * 4.0, 1));
  89. });
  90. );
  91. };
  92. );
  93. ~buffers.value();
  94. )
  95.  
  96. (
  97. (
  98. ~patterns = {(
  99.  
  100. x = CSVFileReader.read("/Users/spyridonpallis/Desktop/CsvDemo.csv", true).postcs;
  101.  
  102. (
  103. Routine {
  104. var i = 0;
  105. loop {
  106. ~csvdata = x[i];
  107. ~csvdata.postln;
  108. i = i + 1;
  109. 1.wait;
  110. };
  111. }.play;
  112. );
  113.  
  114. (
  115. Pdef(\a1, Pbind(
  116. \instrument, \mainbuf, \group, ~sources,
  117. \patch, ~patch1,
  118. \amp, Pseq([
  119. 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
  120. 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0,
  121. 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0,
  122. 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
  123. ] * 0.6, inf),
  124. \dur, 1/4,
  125. \atk, 0.1,
  126. \rel, 0.1,
  127. \rate, Pfunc({~csvdata.asInteger}),
  128. \pos, Pseq([0, 100], inf),
  129. \bank, Pseq([1, 2, 3].stutter(4), inf),
  130. )).quant_(4);
  131. );
  132. Pdef(\a1).play(t, quant:4);
  133. //Pdef(\a1).stop(t, quant:4);
  134. );
  135. };
  136. );
  137. ~patterns.value();
  138. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement