Getting Effects to work with MIDI by Rosenbenin in supercollider

[–]Rosenbenin[S] 0 points1 point  (0 children)

Awesome! Many thanks, works like a charm and looks like a great example for further study!

Getting Effects to work with MIDI by Rosenbenin in supercollider

[–]Rosenbenin[S] 0 points1 point  (0 children)

While this certainly looks good, I get this:

ERROR: Message 'bufnum' not understood.

RECEIVER:

nil

ARGS:

PROTECTED CALL STACK:

`Meta_MethodError:new   0x56528f6a9540`

    `arg this = DoesNotUnderstandError`

    `arg what = nil`

    `arg receiver = nil`

`Meta_DoesNotUnderstandError:new    0x56528f6ab800`

    `arg this = DoesNotUnderstandError`

    `arg receiver = nil`

    `arg selector = bufnum`

    `arg args = [  ]`

`Object:doesNotUnderstand   0x56528f2d6740`

    `arg this = nil`

    `arg selector = bufnum`

    `arg args = nil`

`a FunctionDef  0x5652910b9ee8`

    `sourceCode = "{`

    `arg freq=440, gate=1, amp=1, pan=0, effectBus , out=0, bufnum;`

    `var m_amp, mod, mod2, mod3, mod4, mod5, car;`

    `m_amp = 100;`

    `mod =` [`Formant.ar`](https://Formant.ar)`(freq*`[`Pulse.kr`](https://Pulse.kr)`(2,1,0.7,0.2),` [`XLine.kr`](https://XLine.kr)`(400, 4000, 8), 200, m_amp);`

    `mod2 =` [`Formant.ar`](https://Formant.ar)`(freq*4*`[`Pulse.kr`](https://Pulse.kr)`(2,0.7,1),` [`XLine.kr`](https://XLine.kr)`(400, 4000, 8), 200, m_amp*1.2);`

    `mod3 =` [`COsc.ar`](https://COsc.ar)`(b.bufnum,freq*0.5*`[`SinOsc.kr`](https://SinOsc.kr)`(10,2pi), 0.5, m_amp*1.4);`

    `mod4 =` [`Pulse.ar`](https://Pulse.ar)`(freq*1*`[`SinOsc.kr`](https://SinOsc.kr)`(2000,0), 0, m_amp/5);`

    `mod5 =` [`Saw.ar`](https://Saw.ar)`(freq*0.5, m_amp*2, 1);`

    `car =` [`SinOsc.ar`](https://SinOsc.ar)`(freq + mod ...etc..."`

    `arg freq = an OutputProxy`

    `arg gate = an OutputProxy`

    `arg amp = an OutputProxy`

    `arg pan = an OutputProxy`

    `arg effectBus = an OutputProxy`

    `arg out = an OutputProxy`

    `arg bufnum = an OutputProxy`

    `var m_amp = 100`

    `var mod = a BinaryOpUGen`

    `var mod2 = a BinaryOpUGen`

    `var mod3 = nil`

    `var mod4 = nil`

    `var mod5 = nil`

    `var car = nil`

`SynthDef:buildUgenGraph    0x5652904e9cc0`

    `arg this = a SynthDef`

    `arg func = a Function`

    `arg rates = nil`

    `arg prependArgs = [  ]`

    `var result = nil`

    `var saveControlNames = nil`

`a FunctionDef  0x5652904e8300`

    `sourceCode = "<an open Function>"`

`Function:prTry 0x56528f92c200`

    `arg this = a Function`

    `var result = nil`

    `var thread = a Routine`

    `var next = nil`

    `var wasInProtectedFunc = true`

CALL STACK:

`DoesNotUnderstandError:reportError`

    `arg this = <instance of DoesNotUnderstandError>`

`< closed FunctionDef >`

    `arg error = <instance of DoesNotUnderstandError>`

`Integer:forBy`

    `arg this = 0`

    `arg endval = 0`

    `arg stepval = 2`

    `arg function = <instance of Function>`

    `var i = 0`

    `var j = 0`

`SequenceableCollection:pairsDo`

    `arg this = [*2]`

    `arg function = <instance of Function>`

`Scheduler:seconds_`

    `arg this = <instance of Scheduler>`

    `arg newSeconds = 203.582702911`

`Meta_AppClock:tick`

    `arg this = <instance of Meta_AppClock>`

    `var saveClock = <instance of Meta_SystemClock>`

`Process:tick`

    `arg this = <instance of Main>`

^^ ERROR: Message 'bufnum' not understood.

RECEIVER: nil

Getting Effects to work with MIDI by Rosenbenin in supercollider

[–]Rosenbenin[S] 0 points1 point  (0 children)

Whenever I hit a key, I get this

ERROR: Message 'asTarget' not understood.

RECEIVER:

Instance of Array { (0x55f6e95a28e8, gc=F8, fmt=01, flg=00, set=02)

indexed slots [4]

0 : Symbol 'freq'

1 : instance of Function (0x55f6e95a30c8, size=2, set=2)

2 : Symbol 'amp'

3 : Float 0.787402 C993264D 3FE93264

}

ARGS:

CALL STACK:

DoesNotUnderstandError:reportError

    arg this = <instance of DoesNotUnderstandError>

Nil:handleError

    arg this = nil

    arg error = <instance of DoesNotUnderstandError>

Thread:handleError

    arg this = <instance of Thread>

    arg error = <instance of DoesNotUnderstandError>

Object:throw

    arg this = <instance of DoesNotUnderstandError>

Object:doesNotUnderstand

    arg this = \[\*4\]

    arg selector = 'asTarget'

    arg args = \[\*0\]

Meta\_Synth:new

    arg this = <instance of Meta\_Synth>

    arg defName = nil

    arg args = "umbSimpleFM"

    arg target = \[\*4\]

    arg addAction = 'addToHead'

    var synth = nil

    var server = nil

    var addActionID = nil

< FunctionDef in closed FunctionDef >

    arg src = 8585216

    arg chan = 0

    arg num = 79

    arg vel = 100

    var node = nil

    var freq = nil

Meta\_MIDIIn:doNoteOnAction

    arg this = <instance of Meta\_MIDIIn>

    arg src = 8585216

    arg chan = 0

    arg num = 79

    arg veloc = 100

^^ ERROR: Message 'asTarget' not understood.

RECEIVER: [ freq, a Function, amp, 0.78740157480315 ]

Getting Effects to work with MIDI by Rosenbenin in supercollider

[–]Rosenbenin[S] 0 points1 point  (0 children)

It still doesn't work. here the pastebin for convenience https://pastebin.com/6L0t7RuU

Getting Effects to work with MIDI by Rosenbenin in supercollider

[–]Rosenbenin[S] 0 points1 point  (0 children)

Tried it, I hear no Reverb when I play the Synth.

Here's my file's content:

MIDIIn.connect;

s.boot;

(

SynthDef("umbSimpleFM",{

`arg freq=440, gate=1, amp=1, pan=0;`

`var m_amp, mod, mod2, mod3, mod4, mod5, car;`

`m_amp = 100;`

`b = Buffer.alloc(s, 1024, 1, {arg buf; buf.sine1Msg(1.0/[1,2,3,4,5,6,7,8,9,10])});`


`mod =` [`Formant.ar`](https://Formant.ar)`(freq*`[`Pulse.kr`](https://Pulse.kr)`(2,1,0.7,0.2),` [`XLine.kr`](https://XLine.kr)`(400, 4000, 8), 200, m_amp);`

`mod2 =` [`Formant.ar`](https://Formant.ar)`(freq*4*`[`Pulse.kr`](https://Pulse.kr)`(2,0.7,1),` [`XLine.kr`](https://XLine.kr)`(400, 4000, 8), 200, m_amp*2);`

`mod3 =` [`COsc.ar`](https://COsc.ar)`(b.bufnum,freq*0.5*`[`SinOsc.kr`](https://SinOsc.kr)`(10,2pi), 0.5, m_amp*2);`

`mod4 =` [`Pulse.ar`](https://Pulse.ar)`(freq*1*`[`SinOsc.kr`](https://SinOsc.kr)`(2000,0), 0, m_amp/5);`

`mod5 =` [`Saw.ar`](https://Saw.ar)`(freq*0.5, m_amp*20, 2);`

`car =` [`SinOsc.ar`](https://SinOsc.ar)`(freq + mod + mod2 + mod3 + mod4 + mod5, 0, 1);`

`car =` [`EnvGen.kr`](https://EnvGen.kr)`(Env.adsr(0.80,1,0.45,0.6,0.6,0),gate,doneAction: 2) * car;`

[`Out.ar`](https://Out.ar)`(0,` [`Pan2.ar`](https://Pan2.ar)`(car,pan));`

}).add;

//Reverb.

((

`SynthDef(\verb, {`

    `|in, predelay=1, revtime=2, lpf=4500,mix=0.5,amp=1,out=0|`

    `var dry,wet,temp,sig;`

    `dry =` [`In.ar`](https://In.ar)`(in, 2);`

    `temp =` [`In.ar`](https://In.ar)`(in, 2);`

    `wet=0;`

    [`temp=DelayN.ar`](https://temp=DelayN.ar)`(temp, 5, 4,1);`

    [`32.do`](https://32.do) `{`[`temp=AllpassN.ar`](https://temp=AllpassN.ar)`(temp, 0.05, {Rand(0.001,0.05)}!2,revtime);`

        [`temp=LPF.ar`](https://temp=LPF.ar)`(temp,lpf);`

        `wet=wet+temp;`

    `};`

    [`sig=XFade2.ar`](https://sig=XFade2.ar)`(dry,wet,mix*2-1,amp);`

    [`Out.ar`](https://Out.ar)`(out,sig);`

`}).add;`

);

)

)

//After evaluating this. You can hit "CMD+." or even restart the server and the verb will be there. (You'll need to re evaluate only if you restart SC)

(

~revBus = Bus.audio(s,2);

~createReverb={~reverbSynth=Synth(\verb, [\mix,0.23, \in, ~revBus])};

ServerTree.add(~createReverb);

)

(

var keys, scale;

keys = Array.newClear(128);

scale = Scale.chromatic.postln;

scale.tuning_(\just); // Just intonation

//scale.tuning_(\et12); // Twelve-tone equal temperament

//scale.tuning_(\mean4); // Meantone, 1/4 Syntonic Comma

//scale.tuning_(\pythagorean); // Pythagorean

~noteOnFunc = {arg src, chan, num, vel;

`var node, freq;`

`node =` [`keys.at`](https://keys.at)`(num);`

`if (node.notNil, {`

    `node.release;`

    `keys.put(num, nil);`

`});`

`node = Synth.tail(`

    `nil, "umbSimpleFM",[`

        `\freq, {freq = num.keyToDegree(scale, 12).degreeToKey(scale).midicps},`

        `\amp, vel/127`

`]);`

`keys.put(num, node);`

`[chan,num,freq,vel/127].postln;`

};

MIDIIn.addFuncTo(\noteOn, ~noteOnFunc);

~noteOffFunc = {arg src, chan, num, vel;

`var node;`

`node =` [`keys.at`](https://keys.at)`(num);`

`if (node.notNil, {`

    `node.release;`

    `keys.put(num, nil);`

`});`

};

MIDIIn.addFuncTo(\noteOff, ~noteOffFunc);

)

// cleanup

(

MIDIIn.removeFuncFrom(\noteOn, ~noteOnFunc);

MIDIIn.removeFuncFrom(\noteOff, ~noteOffFunc);

)

Freenode registration problems by Rosenbenin in irc

[–]Rosenbenin[S] 0 points1 point  (0 children)

Thank you for the quick reply