File: FitzHughNagumo.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.7.1~repack-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,332 kB
  • ctags: 11,704
  • sloc: cpp: 140,180; lisp: 14,746; ansic: 2,133; xml: 86; makefile: 82; haskell: 21; sh: 8
file content (111 lines) | stat: -rw-r--r-- 2,953 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
class::FitzHughNagumo			
summary::Neuron Firing Model Oscillator
related:: Classes/TermanWang
categories:: UGens>Generators>Chaotic
//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html
keyword:: SLUGens


Description::
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.

classmethods::

method::ar

argument::reset
input
argument::rateu
update rate for u
argument::ratew
update rate for w 
argument::b0
equation constant
argument::b1
equation constant
argument::initu
reset value for u
argument::initw
reset value for w


Examples::

code::
//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
)

::