Skip to content

Instantly share code, notes, and snippets.

@dndrks
Last active July 27, 2024 04:39
Show Gist options
  • Save dndrks/e5ec1f6af0cf1477953cf6f61dbd9b7b to your computer and use it in GitHub Desktop.
Save dndrks/e5ec1f6af0cf1477953cf6f61dbd9b7b to your computer and use it in GitHub Desktop.
W/Tape: clocked looping
-- W/Tape: clocked looping
-- as shown in https://youtu.be/2RUHr-iX1VE?si=Ibf7IRycZX5VoLng&t=667
-- requires crow
-- patch crow output 1 to an oscillator's v/8
-- patch crow output 2 to an envelope generator
-- set THIS & THAT to 'loop'
-- tap 'play' to get things rolling
-- tap 'record' to arm recording
-- execute 'capture_loop()' to start recording on next beat
-- execute 'capture_loop()' to stop recording on next beat
-- W/ will automatically start playback once recording has ended
function init()
notes = sequins{0,4,7,9,11}
clock.run(play_note)
clock.run(trigger_envelope)
end
function play_note()
while true do
clock.sync(1 / 3)
output[1].volts = notes() / 12
end
end
function trigger_envelope()
while true do
clock.sync(1/2)
state = state == 10 and 0 or 10
output[2].volts = state
end
end
function capture_loop()
clock.run(
function()
clock.sync(1)
output[4](pulse())
end
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment