Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record by MIDI #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion compass.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Compass (3.1)
-- Compass (3.2)
-- Command-based looper
-- llllllll.co/t/compass/25192
-- @olivier w/ contributions
Expand Down Expand Up @@ -144,6 +144,20 @@ function rndPanL() params:set("Pan (L)",math.random(0,8)/-10) end
function rndPanR() params:set("Pan (R)",math.random(0,8)/10) end
function toggleRec() recLevel = 1 - recLevel end

-- Record
function recordP()
if recLevel == 0 then
sc.buffer_clear()
sPosStart()
loopEnd = loopLength
recLevel = 1
else
recLevel = 0
sPosStart()
loopEnd = math.floor(positions[1])
end
end

-- Crow
function crowTrig() crow.output[1].execute() end
function crowRnd() crow.output[2].volts = math.random(10) end
Expand Down Expand Up @@ -211,6 +225,8 @@ function init()
params:set_action("Record Level", function(x) for i=1,2 do sc.rec_level(i,x) end end)
params:add_control("Overdub","Overdub",controlspec.new(0,1,'lin',0.01,1))
params:set_action("Overdub", function(x) end) --pre = x
params:add_control("Rec", "Rec", controlspec.new(0,1,'lin',0.01,1))
params:set_action("Rec", function() recordP() end)

params:add_separator("BUFFERS")
params:add{id="Rate (coarse)", name="Rate (coarse)", type="control",
Expand Down