load "tap-detect.sal" load "instr.sal" load "clipsoften" function tapsList() return extract-taps("./tapping.wav") variable *pitches1* = list(d4, f4, gs4, b4, d5) variable *pitches2* = list(c4, e4, a4, c5, e5) function translateTaps(cscore, pitches) begin ;set cscore = nil set durs = list(.5, 1) loop with start, vels, duration, event, pitchs, cscore for elem in tapsList() set start = nth(0, elem) set pitchs = nth(random(length(pitches)), pitches) set vels = linear-to-vel(nth(1, elem)) set duration = nth(random(length(durs)), durs) set event = list(start, duration, list(quote(simple-note), :pitch, pitchs, :vel, vels)) set cscore &= event finally set result = cscore end return result end variable *tapscore* = translateTaps(*tapscore*, *pitches1*) ; play timed-seq(*myscore*) function F4() play timed-seq(score-append(translateTaps(*tapscore*, *pitches1*), translateTaps(*tapscore*, *pitches2*))) function F5() begin set score1 = translateTaps(*tapscore*, *pitches1*) set score2 = translateTaps(*tapscore*, *pitches2*) set score1dub = score-merge(translateTaps(*tapscore*, *pitches1*), score-transpose(score1, :pitch, 12)) set score2dub = score-merge(translateTaps(*tapscore*, *pitches2*), score-transpose(score2, :pitch, 12)) set score4 = score-append(score1dub, score2dub) set score5 = score-merge(translateTaps(*tapscore*, *pitches1*), score-transpose(score1dub, :pitch, -12)) set score6 = score-merge(translateTaps(*tapscore*, *pitches2*), score-transpose(score2dub, :pitch, -12)) set score7 = score-append(score5, score6) set score8 = score-append(score4, score7) play soften-clipping(timed-seq(score8), 2000) end