forked from ryan-hodgman1/meadowphysics
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpolyperc.lua
More file actions
executable file
·104 lines (81 loc) · 1.82 KB
/
Copy pathpolyperc.lua
File metadata and controls
executable file
·104 lines (81 loc) · 1.82 KB
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
--
-- m e a d o w p h y s i c s
--
-- a grid-enabled
-- rhizomatic
-- cascading counter
--
--
-- *----
-- *-----
-- *---
-- *-----
--
--
local meadowphysics = include("lib/mp/core")()
local hs = include('lib/halfsecond')
g = grid.connect()
engine.name = 'PolyPerc'
-- voicing
function trigger(note_num, hz, voice)
engine.hz(hz)
end
function gate_high(note_num, hz, voice)
engine.hz(hz)
end
function gate_low(note_num, hz, voice)
engine.hz(hz)
end
function init_engine ()
params:add_separator()
cs_AMP = controlspec.new(0,1,'lin',0,0.5,'')
params:add{
type="control",id="amp",controlspec=cs_AMP,
action=function(x) engine.amp(x) end
}
cs_PW = controlspec.new(0,100,'lin',0,50,'%')
params:add{
type="control",id="pw",controlspec=cs_PW,
action=function(x) engine.pw(x/100) end
}
cs_REL = controlspec.new(0.1,3.2,'lin',0,1.2,'s')
params:add{
type="control",id="release",controlspec=cs_REL,
action=function(x) engine.release(x) end
}
cs_CUT = controlspec.new(50,5000,'exp',0,800,'hz')
params:add{
type="control",id="cutoff",controlspec=cs_CUT,
action=function(x) engine.cutoff(x) end
}
cs_GAIN = controlspec.new(0,4,'lin',0,1,'')
params:add{
type="control",id="gain",controlspec=cs_GAIN,
action=function(x) engine.gain(x) end
}
cs_PAN = controlspec.new(-1,1, 'lin',0,0,'')
params:add{
type="control",id="pan",controlspec=cs_PAN,
action=function(x) engine.pan(x) end
}
hs.init()
end
-- core stuff
function init()
meadowphysics.init()
init_engine()
end
function key(n,z)
meadowphysics:handle_key(n,z)
end
function g.key(x, y, z)
meadowphysics:handle_grid_input(x, y, z)
end
function redraw()
screen.clear()
meadowphysics:draw()
screen.update()
end
function cleanup()
meadowphysics:all_notes_off()
end