Hello, everyone
This might be a dumb question, but I am really falling to see what I am doing wrong. This is still preliminary.
When I run this:
instr 1
kCnt init 0
if metro(1) == 1 then
schedulek(2,0,1,kCnt)
kCnt += 1
endif
endin
instr 2
iGate[] = fillarray(0,0,0,1,0,1,0,0)
iChordsArr[][] init 2,4
iChordsArr[][] = fillarray(51,54,61,65,49,53,60,65)
iCnt = (p4%2)
print(iNote)
indx init 0
while indx < 4 do
iNote = iChordsArr[iCnt][indx]
indx += 1
od
endin
schedule(1,0,3600)
I get the error: array-variable dimensions do not match
The idea is to use multi-dimensional arrays to play 4-note chords, where each chord will be on a line, and each column will give a note to the a schedule of a different instrument.
Am I missing something?
Thanks for the help.
Respectfully,
Gabriel
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
joachim
(joachim heintz)
April 14, 2025, 5:59pm
2
hi gabriel -
when i run your code with csound 7 develop, i had to move the print(iNote) after the line
iNote = iChordsArr[iCnt][indx]
then it worked; the output is:
new alloc (instance 1) for instr 1:
T 0.003 TT 0.003 M: 0.00000 0.00000
new alloc (instance 2) for instr 2:
instr 2: iNote = 51.000
instr 2: iNote = 54.000
instr 2: iNote = 61.000
instr 2: iNote = 65.000
T 1.004 TT 1.004 M: 0.00000 0.00000
instr 2: iNote = 49.000
instr 2: iNote = 53.000
instr 2: iNote = 60.000
instr 2: iNote = 65.000
T 2.006 TT 2.006 M: 0.00000 0.00000
instr 2: iNote = 51.000
instr 2: iNote = 54.000
instr 2: iNote = 61.000
instr 2: iNote = 65.000
T 3.004 TT 3.004 M: 0.00000 0.00000
new alloc (instance 3) for instr 2:
instr 2: iNote = 49.000
instr 2: iNote = 53.000
instr 2: iNote = 60.000
instr 2: iNote = 65.000
best -
joachim
Hi, Mr. Heintz
Even after moving it, it still doesn’t work. Do you think it has to do with Csound 6.18?
–Gabriel
hey gabriel -
i think the problem is with functional coding in csound 6.18 with two dimensions array, because when i change line 35:
iChordsArr[][] = fillarray(51,54,61,65,49,53,60,65) to:
iChordsArr fillarray 51,54,61,65,49,53,60,65
it works. so i guess with csound 7 you don’t have to use traditional way. parham
Aha! That did it!
I guess it is the same with other opcodes that take more than one variable (like, pan2). It just didn’t occur to me that it would be the case here.
Thanks!
– Gabriel
joachim
(joachim heintz)
April 14, 2025, 7:48pm
6
actually here are not more than one output variables.
i think parham pointed to an inconsistency of the code:
in csound you declare the array with brackets only once; then you refer to the array without brackets.
does it work when you write
iChordsArr = fillarray(51,54,61,65,49,53,60,65)
?
yes that’s what i tried first but didn’t work for me. then i used the traditional way. maybe it would work for gabriel (?) im interested to know
Hi, Mr. Heintz
Running like that iChordsArr = fillarray(51,54,61,65,49,53,60,65) does not work.
–Gabriel
joachim
(joachim heintz)
April 14, 2025, 8:13pm
9
ok, thanks.
then one more reason to look forward to csound 7 =)
joachim