form caption("Sequencer-sf2player"), size(300, 200)
-n -d -m0d
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
gisf1 sfload "sf_GMbank.sf2"
gisf2 sfload "HS_Boss_DR-550_Drums.sf2"
;sfilist gisf2
instr ROW_SEQUENCER
;each Row will take one of these notes and use it when a beat is enabled
;notes - modifiable by Layer control script (MainController)
;C major scale by default
kNoteValues[] fillarray 60, 62, 64, 65, 67, 69, 70, 72
;amps - 0 by default. changed by cube state
kNotesAmps[] fillarray 0, 0, 0, 0, 0, 0, 0, 0
;run through note amps array and trigger note if amp is set to 1/on
kBeat init 0
kTempo chnget "tempo"
kInst chnget "inst"
kSeqLength chnget "seqLength"
kDur chnget "duration"
kOffset chnget "noteOffset"
kNoteList chnget "noteRowList"
if metro(kTempo) != 0 then
;if amplitude/vel is greater than 0, set event
if kBeat > 7 then
kNotesAmps[kBeat]=0
endif
if kNotesAmps[kBeat] != 0 then
if kInst == 0 then
event "i", "inst0", 0, kDur, kNoteValues[p4-1]+kOffset
elseif kInst == 1 then
event "i", "inst1", 0, kDur, kNoteValues[p4-1]+kOffset
elseif kInst == 2 then
event "i", "inst2", 0, kDur, kNoteValues[p4-1]+kOffset,80
elseif kInst == 3 then
event "i", "inst3", 0, kDur, kNoteValues[p4-1]+kOffset,80
elseif kInst == 4 then
event "i", "inst4", 0, kDur, kNoteValues[p4-1]+kOffset,80
elseif kInst == 5 then
event "i", "inst5", 0, kDur, kNoteValues[p4-1]+kOffset,80
elseif kInst == 6 then
event "i", "inst6", 0, kDur, kNoteValues[p4-1]+kOffset,80
elseif kInst == 7 then
event "i", "inst7", 0, kDur, kNoteValues[p4-1]+kOffset,80
endif
endif
;set next beat if less than seqLength
chnset kBeat, "beat"
;advance kBeat if less than seqLength - otherwise reset count
kBeat = (kBeat
f100 0 8 2 0 10 0 0 8 0 0 0
i"ROW_SEQUENCER" 0 [3600*12] 1
i"ROW_SEQUENCER" 0 [3600*12] 2
i"ROW_SEQUENCER" 0 [3600*12] 3
i"ROW_SEQUENCER" 0 [3600*12] 4
i"ROW_SEQUENCER" 0 [3600*12] 5
i"ROW_SEQUENCER" 0 [3600*12] 6
i"ROW_SEQUENCER" 0 [3600*12] 7
i"ROW_SEQUENCER" 0 [3600*12] 8