So I’ve read that we can’t pass arrays in p-fields to instruments (is this still the case?)
I want to be able to pass a single instrument an argument to change it’s sequence, or rather have one sequencer instrument that is dynamic to different arrays (of different lengths). I’ve come up with a workaround (as suggested) using a udo that converts an array to and f-table, returning the table number that I can pass into the event, whereupon the instr converts it back to an array. It all seems very inefficient and long winded! I wonder whether there any benefit to using an array… is there a better way to do the below?
opcode ConvArr2Ft_i, i, k[]
kArr[] xin
iTab ftgen 0, 0, lenarray(kArr), -2, 0
copya2ftab kArr, iTab
xout iTab
endop
gkArrPt1[] fillarray 1,2,3,4,5
gkArrPt2[] fillarray 1,2,3,4,5,6,7,8,9,10
giFtPt1 = ConvArr2Ft_i(gkArrPt1)
giFtPt2 = ConvArr2Ft_i(gkArrPt2)
print giFtPt1
instr 1, Seq
iTab = p4
iTrans = p5
kCnt init 0
kArr[] init ftlen(iTab)
copyf2array kArr, iTab
if metro(4) == 1 then
event("i", "Blip", 0, 0.4, 0.4, kArr[kCnt%lenarray(kArr)]+48+iTrans)
kCnt+=1
endif
endin
instr 10, Blip
pset 0.2, 1, 60
aenv expon p4, p3, 0.001
ares poscil aenv, cpsmidinn(p5)
outs ares,ares
endin
schedule(1, 0, -1, giFtPt1, 0)
schedule(1.1, 0, -1, giFtPt2, 12)