//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html
FitzHughNagumo Neuron Firing Model Oscillator
FitzHughNagumo.ar(reset, rateu, ratew, b0, b1, initu, initw, mul, add)
Naive Euler ODE solver implementation of the FitzHugh-Nagumo neuronal 2-dimensional model for oscillatory firing.
du/dt= rateu*(u-0.3333*u^3 - w)
dw/dt= ratew*(b0+b1*u - w)
All inputs can have .kr rate UGens plugged in.
reset- input
rateu- update rate for u
ratew- update rate for w
b0- equation constant
b1- equation constant
initu- reset value for u
initw- reset value for w
//Can be very noisy, high pitched and aliases badly- ie great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following
//defaults, high pitched! WARNING
{Out.ar(0,Pan2.ar(0.05*FitzHughNagumo.ar(0,0.01,0.01,1,1),0.0))}.play
//updates too fast, nice noise
{Out.ar(0,Pan2.ar(0.02*FitzHughNagumo.ar(0,1,1,1,1),0.0))}.play
//modulate constants to mess with noise
{Out.ar(0,Pan2.ar(0.01*FitzHughNagumo.ar(0,1,1,LFNoise0.kr(1,0.48,0.5),LFNoise0.kr(1,0.9,1)),0.0))}.play
//retrigger
{Out.ar(0,Pan2.ar(0.1*FitzHughNagumo.ar(Impulse.kr(10),0.0001,0.001,1,0.000001,LFNoise0.kr(10),LFNoise0.kr(10)),0.0))}.play
//more retriggering with mouse exploration
{Out.ar(0,Pan2.ar(0.05*FitzHughNagumo.ar(Impulse.kr(10),MouseX.kr(0.0001,0.1,'exponential'),MouseY.kr(0.0001,0.1,'exponential'),0.5,0.1,LFNoise0.kr(10,0.3),LFNoise0.kr(10,0.2)),0.0))}.play
//right of the screen is most amusing
{Out.ar(0,Pan2.ar(0.1*FitzHughNagumo.ar(Impulse.kr(100),MouseX.kr(0.0001,1,'exponential'),MouseY.kr(0.0001,1,'exponential'),0.5,0.1,SinOsc.kr(10,0,0.3),SinOsc.kr(10,0,0.8)),0.0))}.play
//explore
(
{Out.ar(0,Pan2.ar(
CombN.ar(
Resonz.ar(FitzHughNagumo.ar(Impulse.kr(LFNoise1.kr(1,10,50)),MouseX.kr(0.0001,100,'exponential'),MouseY.kr(0.0001,1,'exponential'),MouseY.kr(0.1,3),MouseX.kr(0.1,3),SinOsc.kr(20,0,0.7),SinOsc.kr(21,0,0.8)),LFNoise1.kr(LFNoise1.kr(0.2,0.05,0.07),400,600),0.1),
0.05,0.05,2
)
,0.0))}.play
)
//surprise! (wait for it)
(
SynthDef("FHN-surprise",{Out.ar(0,Pan2.ar(
CombN.ar(RLPF.ar(FitzHughNagumo.ar(0,0.00001,0.00001, mul:0.1),1000,0.01),0.1,0.1,10)
,0.0))
}).play
)
//controlled surprise
(
SynthDef("FHN-surprise",{Out.ar(0,Pan2.ar(
CombN.ar(RLPF.ar(FitzHughNagumo.ar(0,0.00001,MouseY.kr(0.00001,1,'exponential'),1, mul:0.1),1000,0.01),0.1,0.1,10)
,0.0))
}).play
)
//feedback pair
(
SynthDef("FHN-surprise",{
var fn1, fn2, retrigger;
retrigger= Impulse.kr(15);
fn1= MouseX.kr(0.0,1.0)*FitzHughNagumo.ar(retrigger,0.001,0.001,LocalIn.ar(1),1);
fn2= MouseY.kr(0.0,1.0)*FitzHughNagumo.ar(retrigger,0.001,0.001,fn1,1);
LocalOut.ar(fn2);
Out.ar(0,Pan2.ar((fn1+fn2),0.0))
}).play
)