I’m trying to build an instrument for getting all the values from MIDI controller on every channel. I tried using a nested loop, something like this:
loop_i:
loop_j:
If i put the code in an instrument the loop only runs once. I would need the instrument to keep upgrading the array based on the current values of the controller. What am I missing?
one reason is that you use a loop at i-rate.
this means that the loop is only executed once, at initialization of the
instrument.
what you might try is to call this instrument at every k-cycle, like
Thank you for the answer.
So far I haven’t managed to make a nested loop work, so now my goal is to get all the controller values from a single channel. But I ran into problems with that as well.
The problem is with the ctrl7 opcode, because it works only with i-rate variables as the channel number. I tried using the i() opcode in the loop for getting the current index value as an i-rate variable, but that doesn’t work . I also tried the version you have provided, but I couldn’t make it work.
Is there an opcode that listens to MIDI controllers and takes k-rate variables as channel number arguments?
What is the usual solution to the original problem (storing and updating all the MIDI controller values dynamically in a global array)? I think it would be convenient to store the controller values like this, , because getting the controller values one-by one takes a lot of redundant code. So I guess there must be a usual solution for this in Csound that I don’t know of.