Skip to content

Instantly share code, notes, and snippets.

@hsitz
Last active April 27, 2020 16:21
Show Gist options
  • Save hsitz/3fcaa8586d731095e99dadb3eb714d02 to your computer and use it in GitHub Desktop.
Save hsitz/3fcaa8586d731095e99dadb3eb714d02 to your computer and use it in GitHub Desktop.
tapseq
@OnLoad
// one more time
// is his here now?
// another change
// and anoher
// change this to the note of the paired Hardware Controller (Drum Pads optional)
// picking notes on a Keyboard works just fine too. But it's create for tapping out sequenced rhythms
Controller_Note = 36 // change this to the note of the paired Hardware Controller (Drum Pads optional)
Base_Note = 60
knob1 = 0
knob2 = 1
knob3 = 2
knob4 = 3
Sequence = [1,5,8,5,1,5,9,8,1,5,8,5,8,5,2,3]
//Scale = [1,3,4,6,8,10,11,13,15,16,18,20,22,23,25]
Length = 4
// Sequence = [1,2,3,5,7,8,6,5,4,5,2,3,5,4,3,2]
Octave = 3
loop = 0
delay = 200
ShowLayout 2
@End
@OnKnobChange
if LastKnob = knob1 // scale type
new_scale_num = div (GetKnobValue knob1), 8
if new_scale_num <> current_scale
call @SetUpScale
endif
elseif LastKnob = knob2 // root note
newroot = div (GetKnobValue knob2), 12
if newroot <> rootnote
SetRootNote newroot
SetKnobLabel knob2, RootNoteName
endif
endif
@END
@SetUpScale
scaletype = new_scale_num
PreSetScale = {scaletype}
SetKnobLabel knob1, ScaleName
// fill scalenotes with scale notenums
fillarray scale, 0, 128
fillarray scalendx, 0, 128
count = 0
for i = 0 to 127
if i = scalequantize i
scale[count] = i
scalendx[i] = count
inc count
endif
endfor
@END
@OnMidiInput
if MIDICommand = 144 and MIDINote = Base_Note
if MIDIVelocity = 0
exit
endif
if loop = Length
loop = 0
endif
Sequence_Note = Sequence[loop]
Note = RootNote + Scale[Sequence_Note - 1] + (Octave * 12) - 1
Log {Note: }, Note
Inc loop
SetPadLabel 0, (NoteName Note, YES)
FlashPad 0
SendMIDIOut MIDICommand, Note, MIDIVelocity
SendMIDIOut MIDICommand, Note, 0, delay
endif
@End€
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment