load "tap-detect.sal" load "instr.sal" exec taptest() set taps = extract-taps("./tapping.wav", plot-flag: #t) function build-sound-expr(amp) begin return list(quote(simple-note), keyword(pitch), 60 + random(24), keyword(vel), linear-to-vel(amp)) end function build-sound-event(start-time, amp) begin return list(start-time, 0.25, build-sound-expr(amp)) end function taps-to-score(taps, tapscore) begin loop for i from 0 to length(taps) - 1 set time = nth(0, nth(i, taps)) set amp = nth(1, nth(i, taps)) set sound-expr = build-sound-expr(amp) set sound-event = build-sound-event(time, amp) set tapscore ^= append(list(sound-event)) end return tapscore end set *tapscore* = taps-to-score(taps, list(list(0, 0, list(quote(score-begin-end), 0, 10)))) exec score-print(*tapscore*) function F4() play timed-seq(*tapscore*) set echo-score = score-append(*tapscore*, score-merge(*tapscore*, score-shift(*tapscore*, 0.1), score-shift(*tapscore*, 0.2))) set comp = score-append(echo-score, score-transpose(echo-score, keyword(pitch), 2)) function F5() play timed-seq(comp)