Csound Csound-dev Csound-tekno Search About

[Csnd] Help with loop and ctrl7

Date2018-01-09 18:18
Fromchronopolis
Subject[Csnd] Help with loop and ctrl7
I am currently trying to load a bank of 48 pots with this loop that puts the
ctrl7 into an array. It is basically iterating between CCs 13-24 on channel
1, then doing the same on channel 2 up through channel 4.

It prints out the correct values but the 'printk2 gklfo[0]' isn't printing
anything when the knob is turned. 

gklfo[] init 48
index init 0
ichn init 1
imaxchan = 4 ;max channel to count
iccmin = 13 ;min pot cc number
iccmax = 24 ; max pot cc number
loadchn:
if (ichn <= imaxchan) then
	icc = iccmin 
		loadcc:
		if (icc <= iccmax)then
			initc7	ichn, icc, 0	
			gklfo[index] ctrl7 ichn, icc, 0, 1
			icc += 1	
			index +=1
			goto loadcc
		endif
ichn += 1
goto loadchn
endif

printk2 gklfo[0]


However, if I simply put 

gklfo[0] ctrl7 1, 13, 0, 1
printk2 gklfo[0]

it prints fine when the knob is turned. Is an array the wrong way to
approach this?

Thanks



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2018-01-09 19:38
Fromjpff
SubjectRe: [Csnd] Help with loop and ctrl7
Your loop is an itime loop but ctrl7 is a perf-time action

On Tue, 9 Jan 2018, chronopolis wrote:

> I am currently trying to load a bank of 48 pots with this loop that puts the
> ctrl7 into an array. It is basically iterating between CCs 13-24 on channel
> 1, then doing the same on channel 2 up through channel 4.
>
> It prints out the correct values but the 'printk2 gklfo[0]' isn't printing
> anything when the knob is turned.
>
> gklfo[] init 48
> index init 0
> ichn init 1
> imaxchan = 4 ;max channel to count
> iccmin = 13 ;min pot cc number
> iccmax = 24 ; max pot cc number
> loadchn:
> if (ichn <= imaxchan) then
> 	icc = iccmin
> 		loadcc:
> 		if (icc <= iccmax)then
> 			initc7	ichn, icc, 0
> 			gklfo[index] ctrl7 ichn, icc, 0, 1
> 			icc += 1
> 			index +=1
> 			goto loadcc
> 		endif
> ichn += 1
> goto loadchn
> endif
>
> printk2 gklfo[0]
>
>
> However, if I simply put
>
> gklfo[0] ctrl7 1, 13, 0, 1
> printk2 gklfo[0]
>
> it prints fine when the knob is turned. Is an array the wrong way to
> approach this?
>
> Thanks
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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
>

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

Date2018-01-09 19:48
FromSteven Yi
SubjectRe: [Csnd] Help with loop and ctrl7
One way to address the issue is making a simple instrument that
processes one channel, but initialize many instances from a separate
UDO or instrument, something like:

=====

instr CCProc
  index = p4
  ichn = p5
  icc = p6
  initc7  ichn, icc, 0
  gklfo[index] ctrl7 ichn, icc, 0, 1
endin

opcode StartCCProc
  index init 0
  ichn init 1
  imaxchan = 4 ;max channel to count
  iccmin = 13 ;min pot cc number
  iccmax = 24 ; max pot cc number

  while(ichn < imaxchan) do
    icc = iccmin

    while(icc < iccmax) do
      schedule("CCProc", 0, -1, index, ichn, icc)
       icc += 1
       index += 1
    od
    ichn += 1
  od
endop

StartCCProc()

=====

(Haven't tested above, but I think something like that would work)

steven


On Tue, Jan 9, 2018 at 2:38 PM, jpff  wrote:
> Your loop is an itime loop but ctrl7 is a perf-time action
>
>
> On Tue, 9 Jan 2018, chronopolis wrote:
>
>> I am currently trying to load a bank of 48 pots with this loop that puts
>> the
>> ctrl7 into an array. It is basically iterating between CCs 13-24 on
>> channel
>> 1, then doing the same on channel 2 up through channel 4.
>>
>> It prints out the correct values but the 'printk2 gklfo[0]' isn't printing
>> anything when the knob is turned.
>>
>> gklfo[] init 48
>> index init 0
>> ichn init 1
>> imaxchan = 4 ;max channel to count
>> iccmin = 13 ;min pot cc number
>> iccmax = 24 ; max pot cc number
>> loadchn:
>> if (ichn <= imaxchan) then
>>         icc = iccmin
>>                 loadcc:
>>                 if (icc <= iccmax)then
>>                         initc7  ichn, icc, 0
>>                         gklfo[index] ctrl7 ichn, icc, 0, 1
>>                         icc += 1
>>                         index +=1
>>                         goto loadcc
>>                 endif
>> ichn += 1
>> goto loadchn
>> endif
>>
>> printk2 gklfo[0]
>>
>>
>> However, if I simply put
>>
>> gklfo[0] ctrl7 1, 13, 0, 1
>> printk2 gklfo[0]
>>
>> it prints fine when the knob is turned. Is an array the wrong way to
>> approach this?
>>
>> Thanks
>>
>>
>>
>> --
>> Sent from:
>> http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>>
>> 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
>>
>
> 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

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