Advertisement
ameldesharnais

Problème Travail Final 2

Dec 16th, 2020
1,990
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //SECTION INSTRUMENTS
  2. (
  3. //SynthDef des buffers
  4. SynthDef(\buffsDef, {
  5.     arg out=0, bufnum=0, rate=1.0, start=0, freq=5, gate=1, pan=0.0, amp = 0.4;
  6.     var sig, env;
  7.     sig = PlayBuf.ar(
  8.         numChannels: 2,
  9.         bufnum: bufnum,
  10.         rate: rate * BufRateScale.kr(bufnum),
  11.         startPos: start,
  12.         //loop: 1,
  13.         doneAction: 2
  14.     );
  15.     Out.ar(out, sig*amp);
  16. }).add;
  17.  
  18. //noteOn juste pour les backs du couplet
  19. ~backs = nil;
  20. MIDIdef.noteOn(\backsCouplet,{
  21.     arg vel, nn;
  22.     ~backs.isNil.if({ // Si la variable ~backs est 'nil', c'est que les Synth ne jouent pas.
  23.         "Clock backCouplet démarré".postln;
  24.         //Fait jouer après 8 secondes
  25.         SystemClock.sched(8, {
  26.         ~backs = Synth(\buffsDef, [
  27.                 \rate, 1.0,
  28.                 \bufnum, ~buffs[15],
  29.                 \start, 0,
  30.             ]);
  31.         });//Fin SystemClock
  32.     }, { // Si la variable ~backs n'est pas 'nil', c'est qu'elle contient le buffer des backs.
  33.         ~backs.isNil.if({
  34.         },{
  35.             "rentré".postln;
  36.             ~backs.free;
  37.         ~backs = nil; // On redonne la valeur 'nil' à la variable ~backs.
  38.         });
  39.     });
  40. }, 68); // Ce MIDIdef ne répond qu'à la note 68.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement