HI, everyone! I’m new to the community and SC as a whole, it’s incredibly nice to meet all of you and I hope you’re all having a great day.
[What is this chunk of code supposed to do?]
This is supposed to read midi messages from my hardware to software.
One part is a functional polyphonic synthesizer whose function depends on MIDI input called \bm, and the other part/instrument is a reverb unit that simply process’s \bm, but my MIDI params aren’t able to change or connect to \rev’s arguments, which is where my problem arises.
[Is there an area or topic I would like specific feedback on?]
I’m primarily having an issue with applying the MIDI CC7 (otherwise known as Mididef.cc(/ccT6 and boo in my code), to the reverb instrument instance /rev. The problem is that I can read the messages from the MIDI instance using postln, and I can see that it is reading CC7 properly in the post window, but I can’t seem to connect the param ~boo or boo to /rev’s params.
I understand that the polyphonic synthesizer part works, because with every note press it is applying a new iteration of params and Synths with each note on, and turns them off(free’s) as soon as the end of their cycles have been met. but why can’t I get ~boo / boo or CC7 to work with /rev? I know I don’t want to keep recreating reverb units every time I turn a knob or adjust a param, (like the polyphonic synthesizer) so how do I make sure /rev understands what ~boo,\boo or CC7 is doing without issue?
CC7/boo is supposed to manipulate inputbandwidth of the Gverb reverb unit, \rev.
Thank you too, whomever takes a look at this, I’ve been furiously trying to get this to work over the last few days.
<3
MIDIClient.init;
MIDIIn.connectAll;
(
MIDIdef.cc(\ccT, {
arg val, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\atk, ~atk);
~atk = val.linlin(0, 127, 0.0, 1.0);
});
},1);
MIDIdef.cc(\ccT1, {
arg val, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\dec, ~dec);
~dec = val.linlin(0, 127, 0.0, 1.0);
});
},2);
MIDIdef.cc(\ccT2, {
arg val, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\sus, ~sus);
~sus = val.linlin(0, 127, 0.0, 1.0);
});
},3);
MIDIdef.cc(\ccT3, {
arg val, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\rel, ~rel);
~rel = val.linlin(0, 127, 0.0, 1.0);
});
},4);
MIDIdef.cc(\ccT4, {
arg val, conv, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\cut, ~cut);
~cut=val.linlin(0, 127, 20, 10000);
});
},5);
MIDIdef.cc(\ccT5, {
arg val, cc, chan, src;
[val, cc].postln;
~notes.do ({ arg synth;
synth.set(\q, ~q);
~q = val.linlin(0, 127, 0.15, 1.0);
});
},6);
/*MIDIdef.cc(\ccT6, {
arg val, cc, chan, src;
[val, cc].postln;
Synth(\rev,{ arg synth;
synth.set(\boo,~boo);
~boo = val.linlin(0, 127, 0.0, 1.0);
});
~boo.postln;
},7);*/
MIDIdef.noteOn(\noteOnTest, {
arg vel, nn, chan, src;
[vel, nn].postln;
~notes[nn] = Synth.new(
\bm, [
\freq, nn.midicps,
\amp, vel.linexp(1, 127, 0.01, 0.5),
\gate, 1.0,
\atk, ~atk,
\dec, ~dec,
\sus, ~sus,
\rel, ~rel,
\cut, ~cut,
\q, ~q
]);
});
MIDIdef.noteOff(\noteOffTest, {
arg vel, nn, chan, src;
[vel, nn].postln;
~notes[nn].set(\gate, 0);
~notes[nn] = nil;
});
)
(
x=SynthDef.new(\bm, {
arg out=4, freq = 440.0, amp=0.1, gate=0.0, atk=1.0, dec=0.8, sus=0.8, rel=0.8, cut=1.0, q=0.0;
var sig, env, vern;
sig = LFSaw.ar(freq)!2;
vern = RLPF.ar(sig,cut,q,1.0);
env = EnvGen.kr(Env.adsr(atk,dec,sus,rel), gate,timeScale:5, doneAction:2);
sig = vern * env * amp;
Out.ar(out, sig);
}).add;
SynthDef.new(\rev, {
arg in=4, out=0, boo=0.0;
var sig;
sig = In.ar(in, 2);
sig = sig+(GVerb.ar(sig, 1, 0.5, 0.0, boo, taillevel:0.7, maxroomsize:300) * 0.2);
Out.ar(out, sig);
}).add;
)
x = Synth(\bm);
x.free;
Synth.new(\rev, [\in, 4, \out, 0], x, \addAfter);
s.options.numAudioBusChannels;
~notes = Array.newClear(128);
~atk = 0.0;
~dec = 0.0;
~sus = 0.0;
~rel = 0.0;
~cut = 1.0;
~q = 0.0;
~boo = 0.0;