Hi!
I’m trying to make a MIDIdef using GrainBuff as a synth.
But the problem I’m facing is more technical than I can understand why.
Generaly, I’m working on making a simple midi yet when I’m running it the Post window shows:
-> MIDIdef(off, noteOff, nil, nil, nil)
while the Code is this:
(
Buffer.freeAll;
~buf1 = Buffer.read(s, "C:/Users/user/Desktop/September programming 2/Samples/GtrMono1.wav");
)
(
SynthDef(\GrainNotes,
{
arg gateE = 1,freqT = 20, phaseT = 0, mulT = 0, rt = 1, cfH = 1,
durG = 0.1, rateG = 60, pos = 0.1, pan = 0, out = 0, ampGrainNotes = 0;
var sig, env;
env = Env.adsr(releaseTime: rt);
env = EnvGen.kr(env, gateE, doneAction: 2);
sig = GrainBuf.ar(
numChannels: 2,
trigger: Impulse.ar(
freq: freqT,
phase: phaseT,
mul: mulT),
dur: durG/*{Rand(0.001,3)}*/,
sndbuf: ~buf1,
rate: rateG,
pos: 0.1,
interp: 2,
pan: LFNoise0.kr(),
envbufnum: -1,);
sig = HPF.ar(sig, cfH.clip(20, 8000));
sig = sig * env * ampGrainNotes;
Out.ar(out,sig);
}).add;
)
(
MIDIdef.noteOn(\on, {
arg vel, nn;
[vel, nn].postln;
~notes[nn] = Synth(\GrainNotes, [
\rateG, nn.midicps,
\ampGrainNotes, vel.linexp(0, 127, 0.01, 1),
\gateE, 1,
\cfH, ~cutOff,\rt,~rtl])
}).permanent_(true);
MIDIdef.noteOff(\off, {
arg vel, nn;
~notes[nn].set(\gateE, 0);
~notes[nn] = nil;
}).permanent_(true);
)