Skip to content

Instantly share code, notes, and snippets.

@Xpktro
Last active May 24, 2022 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xpktro/39ae303e3c8ded7760a9d25133739093 to your computer and use it in GitHub Desktop.
Save Xpktro/39ae303e3c8ded7760a9d25133739093 to your computer and use it in GitHub Desktop.
My softcut studies
-- Wisher
-- voice — a play/record head. mono. each has its own parameters (ie rate, level, etc). there are 6 voices.
-- buffer — digital tape, there are 2 buffers. mono. just about 5 minutes each.
local sc = softcut
function init()
audio.level_adc_cut(1.0) -- softcut adc level.
sc.enable(1, 1) -- set voice. voice int : voice number (1-?) / state int : off/on (0,1)
sc.buffer(1, 1) -- specify buffer used by voice. i int : voice number / b int : buffer number (1,2)
sc.level(1, 1.0) -- set output level of each voice. voice int : voice index / amp number : linear amplitude
sc.loop (1, 1) -- set loop mode. voice int : voice index / state int : off/on (0,1)
sc.loop_start(1, 0.0) -- set loop start. voice int : voice index / pos number : loop start position in seconds
sc.loop_end(1, 1/20) -- set loop end. voice int : voice index / pos number : loop end position in seconds
sc.position(1, 0) -- set play position. voice / value
sc.fade_time(1, 0)
sc.level_slew_time(1, 0.0) -- slew time (attack) for level. voice, rate
sc.rate_slew_time(1, 0.0)
sc.level_input_cut(1, 1, 1.0) -- set input level to each voice/channel. ch int : ADC channel index / voice int : voice index / amp number : linear amplitude
-- softcut.level_input_cut(2, 1, 1.0)
sc.rec_level(1, 0.0) -- set record level. voice int : voice index / amp number : linear amplitude of new signal
sc.pre_level(1, 0.0) -- set pre level (overdub preserve.) voice int : voice index / amp number : linear amplitude of preserved signal
sc.rec(1, 1) -- set record state. voice int : voice number (1-?) / state int : off/on (0,1)
sc.play(1, 1) -- set play status. voice int : voice index / state int : off/on (0,1)
sc.event_phase(stop_recording)
end
function stop_recording()
print('stop rec')
sc.rec_level(1, 0.0)
sc.level(1, 1.0)
sc.poll_stop_phase()
end
function key(id,state)
-- print('key', id, state)
if id == 2 then
if state == 1 then
print('start')
sc.position(1, 0) -- set play position
sc.rec_level(1, 1.0)
sc.level(1, 0.0)
sc.loop_end(1, 1/440)
sc.phase_quant(1, 1/4)
sc.poll_start_phase()
else
print('stop')
sc.level(1, 0)
end
end
end
function enc(id,delta)
print('enc', id, delta)
end
function redraw()
screen.clear()
screen.update()
end
function cleanup()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment