Csound Csound-dev Csound-tekno Search About

[Csnd] Looping array index on i-time

Date2014-02-05 21:53
Fromhlolli
Subject[Csnd] Looping array index on i-time
Im trying to make an loop with arrays in such a way that I could change
"irytm" value and the flow of score events will not come to halt. For
example irytm = 8 will make indx exceed the array index of 8 and start to
produce silence. I don't care if the array is not finished when new section
starts after repeat, I just want continuous flow of sounds by changing only
irytm parameter. As seen in the code I tried to reinitialise but it didn't
work. Maybe there's some fundamental problem or an easy solution. I'm hoping
to build tools for live codeing.







sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1.0


instr 1 
iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
ininstr = 8 ;number of called instances
indx = 0

loop:
irytm = .5
event_i "i", 2, indx*irytm, irytm, iArr[indx]
if indx == 8 then
   reinit loop
endif
loop_lt indx, 1, ininstr, loop

endin



instr 2
ifreq = cpsmidinn(p4)
a1 oscils .1, ifreq, 0

outs a1, a1

endin



r1000
i 1 0 8






--
View this message in context: http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-02-05 21:55
Fromhlolli
Subject[Csnd] Re: Looping array index on i-time
sorry irytm=0.5 will make array index higher than 8(-1) not irytm=8
hope it's understandable.



--
View this message in context: http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732339.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-02-06 08:03
Fromjoachim heintz
SubjectRe: [Csnd] Looping array index on i-time
if you want to build something for live coding, you should probably work 
at k-rate. something like this for instr 1 may work (not tested):

instr 1
kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67

krythm linseg .5, p3, 2
kTick metro 1
kninstr = 8 ;number of called instances

if kTick == 1 then
kndx = 0
loop:
event "i", 2, kndx*krytm, krytm, kArr[kndx]
loop_lt kndx, 1, kninstr, loop
endif
endin

and in the score for instance:
i 1 0 10

	joachim


Am 05.02.2014 22:53, schrieb hlolli:
> Im trying to make an loop with arrays in such a way that I could change
> "irytm" value and the flow of score events will not come to halt. For
> example irytm = 8 will make indx exceed the array index of 8 and start to
> produce silence. I don't care if the array is not finished when new section
> starts after repeat, I just want continuous flow of sounds by changing only
> irytm parameter. As seen in the code I tried to reinitialise but it didn't
> work. Maybe there's some fundamental problem or an easy solution. I'm hoping
> to build tools for live codeing.
>
>
> 
> 
> 
> 
>
> sr = 44100
> ksmps = 128
> nchnls = 2
> 0dbfs = 1.0
>
>
> instr 1
> iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
> ininstr = 8 ;number of called instances
> indx = 0
>
> loop:
> irytm = .5
> event_i "i", 2, indx*irytm, irytm, iArr[indx]
> if indx == 8 then
>     reinit loop
> endif
> loop_lt indx, 1, ininstr, loop
>
> endin
>
>
>
> instr 2
> ifreq = cpsmidinn(p4)
> a1 oscils .1, ifreq, 0
>
> outs a1, a1
>
> endin
>
> 
> 
> r1000
> i 1 0 8
>
> 
> 
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>              https://sourceforge.net/p/csound/tickets/
> csound5:
>              https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>

Date2014-02-06 17:46
Fromhlolli
Subject[Csnd] Re: Looping array index on i-time
Hi and thanks for the answer. It's now playing continuously but the reading of array index is wrong.
It's reading index:
kArr[0] then kArr[2].... kArr[7] but instead of reading kArr[0] again it's repeating 6 and 7.
I want a loop 
0, 1, 2, 3, 4, 5, 6,  7
0, 1, 2, 3, 4, 5, 6,  7
over and over irrelevant of speed.


not
0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7

hope you understand, thanks !

instr 1

kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67


;krytm linseg .5, p3, 2

krytm = .5

kTick metro 1


kninstr = 8 ;number of called instances


if kTick == 1 then

kndx = 0

loop:

event "i", 2, kndx*krytm, krytm, kArr[kndx]

loop_lt kndx, 1, kninstr, loop

endif

endin



instr 2

ifreq = cpsmidinn(p4)

a1 oscils .1, ifreq, 0


outs a1, a1


endin


</CsInstruments>

<CsScore>

r1000

i 1 0 8



2014-02-06 joachim-3 [via Csound] <[hidden email]>:
if you want to build something for live coding, you should probably work
at k-rate. something like this for instr 1 may work (not tested):

instr 1
kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67

krythm linseg .5, p3, 2
kTick metro 1
kninstr = 8 ;number of called instances

if kTick == 1 then
kndx = 0
loop:
event "i", 2, kndx*krytm, krytm, kArr[kndx]
loop_lt kndx, 1, kninstr, loop
endif
endin

and in the score for instance:
i 1 0 10

        joachim


Am 05.02.2014 22:53, schrieb hlolli:

> Im trying to make an loop with arrays in such a way that I could change

> "irytm" value and the flow of score events will not come to halt. For
> example irytm = 8 will make indx exceed the array index of 8 and start to
> produce silence. I don't care if the array is not finished when new section
> starts after repeat, I just want continuous flow of sounds by changing only
> irytm parameter. As seen in the code I tried to reinitialise but it didn't
> work. Maybe there's some fundamental problem or an easy solution. I'm hoping
> to build tools for live codeing.
>
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 128
> nchnls = 2
> 0dbfs = 1.0
>
>
> instr 1
> iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
> ininstr = 8 ;number of called instances
> indx = 0
>
> loop:
> irytm = .5
> event_i "i", 2, indx*irytm, irytm, iArr[indx]
> if indx == 8 then
>     reinit loop
> endif
> loop_lt indx, 1, ininstr, loop
>
> endin
>
>
>
> instr 2
> ifreq = cpsmidinn(p4)
> a1 oscils .1, ifreq, 0
>
> outs a1, a1
>
> endin
>
> </CsInstruments>
> <CsScore>
> r1000
> i 1 0 8
>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>              https://sourceforge.net/p/csound/tickets/
> csound5:
>              https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email [hidden email] with body "unsubscribe csound"
>
>
>


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email [hidden email] with body "unsubscribe csound"





If you reply to this email, your message will be added to the discussion below:
http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732360.html
To unsubscribe from Looping array index on i-time, click here.
NAML



--
Hlöðver Sigurðsson


View this message in context: Re: Looping array index on i-time
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-02-06 21:12
Fromjoachim heintz
SubjectRe: [Csnd] Re: Looping array index on i-time
ok - in this case you don't need the loop at all. try this:




sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
kndx init 0
;krytm linseg .5, p3, 2
krytm = .5
kninstr = 8 ;number of called instances
kTick metro 1/krytm
if kTick == 1 then
event "i", 2, 0, krytm, kArr[kndx%kninstr]
kndx += 1
endif
endin

instr 2
print p4
ifreq = cpsmidinn(p4)
a1 oscils .1, ifreq, 0
a1 linen a1, .01, p3, .01
outs a1, a1
endin



i 1 0 16



best -
	j


Am 06.02.2014 18:46, schrieb hlolli:
> Hi and thanks for the answer. It's now playing continuously but the
> reading of array index is wrong.
> It's reading index:
> kArr[0] then kArr[2].... kArr[7] but instead of reading kArr[0] again
> it's repeating 6 and 7.
> I want a loop
> 0, 1, 2, 3, 4, 5, 6,  7
> 0, 1, 2, 3, 4, 5, 6,  7
> over and over irrelevant of speed.
>
>
> not
> 0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7
>
> hope you understand, thanks !
>
> instr 1
>
> kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
>
>
> ;krytm linseg .5, p3, 2
>
> krytm = .5
>
> kTick metro 1
>
>
> kninstr = 8 ;number of called instances
>
>
> if kTick == 1 then
>
> kndx = 0
>
> loop:
>
> event "i", 2, kndx*krytm, krytm, kArr[kndx]
>
> loop_lt kndx, 1, kninstr, loop
>
> endif
>
> endin
>
>
>
> instr 2
>
> ifreq = cpsmidinn(p4)
>
> a1 oscils .1, ifreq, 0
>
>
> outs a1, a1
>
>
> endin
>
>
> 
>
> 
>
> r1000
>
> i 1 0 8
>
>
>
> 2014-02-06 joachim-3 [via Csound] <[hidden email]
> >:
>
>     if you want to build something for live coding, you should probably
>     work
>     at k-rate. something like this for instr 1 may work (not tested):
>
>     instr 1
>     kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>
>     krythm linseg .5, p3, 2
>     kTick metro 1
>     kninstr = 8 ;number of called instances
>
>     if kTick == 1 then
>     kndx = 0
>     loop:
>     event "i", 2, kndx*krytm, krytm, kArr[kndx]
>     loop_lt kndx, 1, kninstr, loop
>     endif
>     endin
>
>     and in the score for instance:
>     i 1 0 10
>
>              joachim
>
>
>     Am 05.02.2014 22:53, schrieb hlolli:
>
>      > Im trying to make an loop with arrays in such a way that I could
>     change
>
>      > "irytm" value and the flow of score events will not come to halt.
>     For
>      > example irytm = 8 will make indx exceed the array index of 8 and
>     start to
>      > produce silence. I don't care if the array is not finished when
>     new section
>      > starts after repeat, I just want continuous flow of sounds by
>     changing only
>      > irytm parameter. As seen in the code I tried to reinitialise but
>     it didn't
>      > work. Maybe there's some fundamental problem or an easy solution.
>     I'm hoping
>      > to build tools for live codeing.
>      >
>      >
>      > 
>      > 
>      > 
>      > 
>      >
>      > sr = 44100
>      > ksmps = 128
>      > nchnls = 2
>      > 0dbfs = 1.0
>      >
>      >
>      > instr 1
>      > iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>      > ininstr = 8 ;number of called instances
>      > indx = 0
>      >
>      > loop:
>      > irytm = .5
>      > event_i "i", 2, indx*irytm, irytm, iArr[indx]
>      > if indx == 8 then
>      >     reinit loop
>      > endif
>      > loop_lt indx, 1, ininstr, loop
>      >
>      > endin
>      >
>      >
>      >
>      > instr 2
>      > ifreq = cpsmidinn(p4)
>      > a1 oscils .1, ifreq, 0
>      >
>      > outs a1, a1
>      >
>      > endin
>      >
>      > 
>      > 
>      > r1000
>      > i 1 0 8
>      >
>      > 
>      > 
>      >
>      >
>      >
>      > --
>      > View this message in context:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
>      > Sent from the Csound - General mailing list archive at Nabble.com.
>      >
>      >
>      > Send bugs reports to the Sourceforge bug trackers
>      > csound6:
>      > https://sourceforge.net/p/csound/tickets/
>      > csound5:
>      > https://sourceforge.net/p/csound/bugs/
>      > Discussions of bugs and features can be posted here
>      > To unsubscribe, send email [hidden email]
>      with body
>     "unsubscribe csound"
>      >
>      >
>      >
>
>
>     Send bugs reports to the Sourceforge bug trackers
>     csound6:
>     https://sourceforge.net/p/csound/tickets/
>     csound5:
>     https://sourceforge.net/p/csound/bugs/
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email [hidden email]
>      with body
>     "unsubscribe csound"
>
>
>
>
>     ------------------------------------------------------------------------
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732360.html
>
>     To unsubscribe from Looping array index on i-time, click here.
>     NAML
>     
>
>
>
>
>
> --
> Hlöðver Sigurðsson
>
> ------------------------------------------------------------------------
> View this message in context: Re: Looping array index on i-time
> 
> Sent from the Csound - General mailing list archive
>  at
> Nabble.com.

Date2014-02-06 23:12
Fromhlolli
Subject[Csnd] Re: Looping array index on i-time
Just need to get more cleaver in flow control and mathematics

it works perfectly now, thanks!



2014-02-06 joachim-3 [via Csound] <[hidden email]>:
ok - in this case you don't need the loop at all. try this:

<CsoundSynthesizer>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
kndx init 0
;krytm linseg .5, p3, 2
krytm = .5
kninstr = 8 ;number of called instances
kTick metro 1/krytm
if kTick == 1 then
event "i", 2, 0, krytm, kArr[kndx%kninstr]
kndx += 1
endif
endin

instr 2
print p4
ifreq = cpsmidinn(p4)
a1 oscils .1, ifreq, 0
a1 linen a1, .01, p3, .01
outs a1, a1
endin
</CsInstruments>

<CsScore>
i 1 0 16
</CsScore>
</CsoundSynthesizer>

best -
        j


Am 06.02.2014 18:46, schrieb hlolli:

> Hi and thanks for the answer. It's now playing continuously but the

> reading of array index is wrong.
> It's reading index:
> kArr[0] then kArr[2].... kArr[7] but instead of reading kArr[0] again
> it's repeating 6 and 7.
> I want a loop
> 0, 1, 2, 3, 4, 5, 6,  7
> 0, 1, 2, 3, 4, 5, 6,  7
> over and over irrelevant of speed.
>
>
> not
> 0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7
>
> hope you understand, thanks !
>
> instr 1
>
> kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
>
>
> ;krytm linseg .5, p3, 2
>
> krytm = .5
>
> kTick metro 1
>
>
> kninstr = 8 ;number of called instances
>
>
> if kTick == 1 then
>
> kndx = 0
>
> loop:
>
> event "i", 2, kndx*krytm, krytm, kArr[kndx]
>
> loop_lt kndx, 1, kninstr, loop
>
> endif
>
> endin
>
>
>
> instr 2
>
> ifreq = cpsmidinn(p4)
>
> a1 oscils .1, ifreq, 0
>
>
> outs a1, a1
>
>
> endin
>
>
> </CsInstruments>
>
> <CsScore>
>
> r1000
>
> i 1 0 8
>
>
>
> 2014-02-06 joachim-3 [via Csound] <[hidden email]
> </user/SendEmail.jtp?type=node&node=5732399&i=0>>:
>

>     if you want to build something for live coding, you should probably
>     work
>     at k-rate. something like this for instr 1 may work (not tested):
>
>     instr 1
>     kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>
>     krythm linseg .5, p3, 2
>     kTick metro 1
>     kninstr = 8 ;number of called instances
>
>     if kTick == 1 then
>     kndx = 0
>     loop:
>     event "i", 2, kndx*krytm, krytm, kArr[kndx]
>     loop_lt kndx, 1, kninstr, loop
>     endif
>     endin
>
>     and in the score for instance:
>     i 1 0 10
>
>              joachim
>
>
>     Am 05.02.2014 22:53, schrieb hlolli:
>
>      > Im trying to make an loop with arrays in such a way that I could
>     change
>
>      > "irytm" value and the flow of score events will not come to halt.
>     For
>      > example irytm = 8 will make indx exceed the array index of 8 and
>     start to
>      > produce silence. I don't care if the array is not finished when
>     new section
>      > starts after repeat, I just want continuous flow of sounds by
>     changing only
>      > irytm parameter. As seen in the code I tried to reinitialise but
>     it didn't
>      > work. Maybe there's some fundamental problem or an easy solution.
>     I'm hoping
>      > to build tools for live codeing.
>      >
>      >
>      > <CsoundSynthesizer>
>      > <CsOptions>
>      > </CsOptions>
>      > <CsInstruments>
>      >
>      > sr = 44100
>      > ksmps = 128
>      > nchnls = 2
>      > 0dbfs = 1.0
>      >
>      >
>      > instr 1
>      > iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>      > ininstr = 8 ;number of called instances
>      > indx = 0
>      >
>      > loop:
>      > irytm = .5
>      > event_i "i", 2, indx*irytm, irytm, iArr[indx]
>      > if indx == 8 then
>      >     reinit loop
>      > endif
>      > loop_lt indx, 1, ininstr, loop
>      >
>      > endin
>      >
>      >
>      >
>      > instr 2
>      > ifreq = cpsmidinn(p4)
>      > a1 oscils .1, ifreq, 0
>      >
>      > outs a1, a1
>      >
>      > endin
>      >
>      > </CsInstruments>
>      > <CsScore>
>      > r1000
>      > i 1 0 8
>      >
>      > </CsScore>
>      > </CsoundSynthesizer>
>      >
>      >
>      >
>      > --
>      > View this message in context:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
>      > Sent from the Csound - General mailing list archive at Nabble.com.
>      >
>      >
>      > Send bugs reports to the Sourceforge bug trackers
>      > csound6:
>      > https://sourceforge.net/p/csound/tickets/
>      > csound5:
>      > https://sourceforge.net/p/csound/bugs/
>      > Discussions of bugs and features can be posted here
>      > To unsubscribe, send email [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=5732360&i=0> with body
>     "unsubscribe csound"

>      >
>      >
>      >
>
>
>     Send bugs reports to the Sourceforge bug trackers
>     csound6:
>     https://sourceforge.net/p/csound/tickets/
>     csound5:
>     https://sourceforge.net/p/csound/bugs/
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=5732360&i=1> with body
>     "unsubscribe csound"
>
>
>
>
>     ------------------------------------------------------------------------
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732360.html
>
>     To unsubscribe from Looping array index on i-time, click here.
>     NAML
> Sent from the Csound - General mailing list archive
> <http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html> at
> Nabble.com.


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email [hidden email] with body "unsubscribe csound"





If you reply to this email, your message will be added to the discussion below:
http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732409.html
To unsubscribe from Looping array index on i-time, click here.
NAML



--
Hlöðver Sigurðsson


View this message in context: Re: Looping array index on i-time
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-02-06 23:27
FromHlöðver Sigurðsson
SubjectRe: [Csnd] Re: Looping array index on i-time
So to get this right the "%" mark limits the value to 8? 

[kndx%kninstr]


(just wondering why this works)



2014-02-06 hlolli <hlolli@gmail.com>:
Just need to get more cleaver in flow control and mathematics

it works perfectly now, thanks!



2014-02-06 joachim-3 [via Csound] <[hidden email]>:
ok - in this case you don't need the loop at all. try this:

<CsoundSynthesizer>
<CsInstruments>

sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1

instr 1
kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
kndx init 0
;krytm linseg .5, p3, 2
krytm = .5
kninstr = 8 ;number of called instances
kTick metro 1/krytm
if kTick == 1 then
event "i", 2, 0, krytm, kArr[kndx%kninstr]
kndx += 1
endif
endin

instr 2
print p4
ifreq = cpsmidinn(p4)
a1 oscils .1, ifreq, 0
a1 linen a1, .01, p3, .01
outs a1, a1
endin
</CsInstruments>

<CsScore>
i 1 0 16
</CsScore>
</CsoundSynthesizer>

best -
        j


Am 06.02.2014 18:46, schrieb hlolli:

> Hi and thanks for the answer. It's now playing continuously but the

> reading of array index is wrong.
> It's reading index:
> kArr[0] then kArr[2].... kArr[7] but instead of reading kArr[0] again
> it's repeating 6 and 7.
> I want a loop
> 0, 1, 2, 3, 4, 5, 6,  7
> 0, 1, 2, 3, 4, 5, 6,  7
> over and over irrelevant of speed.
>
>
> not
> 0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7
>
> hope you understand, thanks !
>
> instr 1
>
> kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
>
>
> ;krytm linseg .5, p3, 2
>
> krytm = .5
>
> kTick metro 1
>
>
> kninstr = 8 ;number of called instances
>
>
> if kTick == 1 then
>
> kndx = 0
>
> loop:
>
> event "i", 2, kndx*krytm, krytm, kArr[kndx]
>
> loop_lt kndx, 1, kninstr, loop
>
> endif
>
> endin
>
>
>
> instr 2
>
> ifreq = cpsmidinn(p4)
>
> a1 oscils .1, ifreq, 0
>
>
> outs a1, a1
>
>
> endin
>
>
> </CsInstruments>
>
> <CsScore>
>
> r1000
>
> i 1 0 8
>
>
>
> 2014-02-06 joachim-3 [via Csound] <[hidden email]
> </user/SendEmail.jtp?type=node&node=5732399&i=0>>:
>

>     if you want to build something for live coding, you should probably
>     work
>     at k-rate. something like this for instr 1 may work (not tested):
>
>     instr 1
>     kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>
>     krythm linseg .5, p3, 2
>     kTick metro 1
>     kninstr = 8 ;number of called instances
>
>     if kTick == 1 then
>     kndx = 0
>     loop:
>     event "i", 2, kndx*krytm, krytm, kArr[kndx]
>     loop_lt kndx, 1, kninstr, loop
>     endif
>     endin
>
>     and in the score for instance:
>     i 1 0 10
>
>              joachim
>
>
>     Am 05.02.2014 22:53, schrieb hlolli:
>
>      > Im trying to make an loop with arrays in such a way that I could
>     change
>
>      > "irytm" value and the flow of score events will not come to halt.
>     For
>      > example irytm = 8 will make indx exceed the array index of 8 and
>     start to
>      > produce silence. I don't care if the array is not finished when
>     new section
>      > starts after repeat, I just want continuous flow of sounds by
>     changing only
>      > irytm parameter. As seen in the code I tried to reinitialise but
>     it didn't
>      > work. Maybe there's some fundamental problem or an easy solution.
>     I'm hoping
>      > to build tools for live codeing.
>      >
>      >
>      > <CsoundSynthesizer>
>      > <CsOptions>
>      > </CsOptions>
>      > <CsInstruments>
>      >
>      > sr = 44100
>      > ksmps = 128
>      > nchnls = 2
>      > 0dbfs = 1.0
>      >
>      >
>      > instr 1
>      > iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>      > ininstr = 8 ;number of called instances
>      > indx = 0
>      >
>      > loop:
>      > irytm = .5
>      > event_i "i", 2, indx*irytm, irytm, iArr[indx]
>      > if indx == 8 then
>      >     reinit loop
>      > endif
>      > loop_lt indx, 1, ininstr, loop
>      >
>      > endin
>      >
>      >
>      >
>      > instr 2
>      > ifreq = cpsmidinn(p4)
>      > a1 oscils .1, ifreq, 0
>      >
>      > outs a1, a1
>      >
>      > endin
>      >
>      > </CsInstruments>
>      > <CsScore>
>      > r1000
>      > i 1 0 8
>      >
>      > </CsScore>
>      > </CsoundSynthesizer>
>      >
>      >
>      >
>      > --
>      > View this message in context:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
>      > Sent from the Csound - General mailing list archive at Nabble.com.
>      >
>      >
>      > Send bugs reports to the Sourceforge bug trackers
>      > csound6:
>      > https://sourceforge.net/p/csound/tickets/
>      > csound5:
>      > https://sourceforge.net/p/csound/bugs/
>      > Discussions of bugs and features can be posted here
>      > To unsubscribe, send email [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=5732360&i=0> with body
>     "unsubscribe csound"

>      >
>      >
>      >
>
>
>     Send bugs reports to the Sourceforge bug trackers
>     csound6:
>     https://sourceforge.net/p/csound/tickets/
>     csound5:
>     https://sourceforge.net/p/csound/bugs/
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=5732360&i=1> with body
>     "unsubscribe csound"
>
>
>
>
>     ------------------------------------------------------------------------
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732360.html
>
>     To unsubscribe from Looping array index on i-time, click here.
>     NAML
> Sent from the Csound - General mailing list archive
> <http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html> at
> Nabble.com.


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email [hidden email] with body "unsubscribe csound"





If you reply to this email, your message will be added to the discussion below:
http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732409.html
To unsubscribe from Looping array index on i-time, click here.
NAML



--
Hlöðver Sigurðsson


View this message in context: Re: Looping array index on i-time
Sent from the Csound - General mailing list archive at Nabble.com.



--
Hlöðver Sigurðsson

Date2014-02-06 23:49
Fromjoachim heintz
SubjectRe: [Csnd] Re: Looping array index on i-time
it calculates kndx modulo kninstr, so always 0...7
(https://en.wikipedia.org/wiki/Modulo_operation)
	j


Am 07.02.2014 00:27, schrieb Hlöðver Sigurðsson:
> So to get this right the "%" mark limits the value to 8?
>
> [kndx%kninstr]
>
>
> (just wondering why this works)
>
>
>
> 2014-02-06 hlolli >:
>
>     Just need to get more cleaver in flow control and mathematics
>
>     it works perfectly now, thanks!
>
>
>
>     2014-02-06 joachim-3 [via Csound] <[hidden email]
>     >:
>
>         ok - in this case you don't need the loop at all. try this:
>
>         
>         
>
>         sr = 44100
>         ksmps = 128
>         nchnls = 2
>         0dbfs = 1
>
>         instr 1
>         kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
>         kndx init 0
>         ;krytm linseg .5, p3, 2
>         krytm = .5
>         kninstr = 8 ;number of called instances
>         kTick metro 1/krytm
>         if kTick == 1 then
>         event "i", 2, 0, krytm, kArr[kndx%kninstr]
>         kndx += 1
>         endif
>         endin
>
>         instr 2
>         print p4
>         ifreq = cpsmidinn(p4)
>         a1 oscils .1, ifreq, 0
>         a1 linen a1, .01, p3, .01
>         outs a1, a1
>         endin
>         
>
>         
>         i 1 0 16
>         
>         
>
>         best -
>                  j
>
>
>         Am 06.02.2014 18:46, schrieb hlolli:
>
>          > Hi and thanks for the answer. It's now playing continuously
>         but the
>
>          > reading of array index is wrong.
>          > It's reading index:
>          > kArr[0] then kArr[2].... kArr[7] but instead of reading
>         kArr[0] again
>          > it's repeating 6 and 7.
>          > I want a loop
>          > 0, 1, 2, 3, 4, 5, 6,  7
>          > 0, 1, 2, 3, 4, 5, 6,  7
>          > over and over irrelevant of speed.
>          >
>          >
>          > not
>          > 0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7
>          >
>          > hope you understand, thanks !
>          >
>          > instr 1
>          >
>          > kArr[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
>          >
>          >
>          > ;krytm linseg .5, p3, 2
>          >
>          > krytm = .5
>          >
>          > kTick metro 1
>          >
>          >
>          > kninstr = 8 ;number of called instances
>          >
>          >
>          > if kTick == 1 then
>          >
>          > kndx = 0
>          >
>          > loop:
>          >
>          > event "i", 2, kndx*krytm, krytm, kArr[kndx]
>          >
>          > loop_lt kndx, 1, kninstr, loop
>          >
>          > endif
>          >
>          > endin
>          >
>          >
>          >
>          > instr 2
>          >
>          > ifreq = cpsmidinn(p4)
>          >
>          > a1 oscils .1, ifreq, 0
>          >
>          >
>          > outs a1, a1
>          >
>          >
>          > endin
>          >
>          >
>          > 
>          >
>          > 
>          >
>          > r1000
>          >
>          > i 1 0 8
>          >
>          >
>          >
>          > 2014-02-06 joachim-3 [via Csound] <[hidden email]
>          > >:
>          >
>
>          >     if you want to build something for live coding, you
>         should probably
>          >     work
>          >     at k-rate. something like this for instr 1 may work (not
>         tested):
>          >
>          >     instr 1
>          >     kArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>          >
>          >     krythm linseg .5, p3, 2
>          >     kTick metro 1
>          >     kninstr = 8 ;number of called instances
>          >
>          >     if kTick == 1 then
>          >     kndx = 0
>          >     loop:
>          >     event "i", 2, kndx*krytm, krytm, kArr[kndx]
>          >     loop_lt kndx, 1, kninstr, loop
>          >     endif
>          >     endin
>          >
>          >     and in the score for instance:
>          >     i 1 0 10
>          >
>          >              joachim
>          >
>          >
>          >     Am 05.02.2014 22:53, schrieb hlolli:
>          >
>          >      > Im trying to make an loop with arrays in such a way
>         that I could
>          >     change
>          >
>          >      > "irytm" value and the flow of score events will not
>         come to halt.
>          >     For
>          >      > example irytm = 8 will make indx exceed the array
>         index of 8 and
>          >     start to
>          >      > produce silence. I don't care if the array is not
>         finished when
>          >     new section
>          >      > starts after repeat, I just want continuous flow of
>         sounds by
>          >     changing only
>          >      > irytm parameter. As seen in the code I tried to
>         reinitialise but
>          >     it didn't
>          >      > work. Maybe there's some fundamental problem or an
>         easy solution.
>          >     I'm hoping
>          >      > to build tools for live codeing.
>          >      >
>          >      >
>          >      > 
>          >      > 
>          >      > 
>          >      > 
>          >      >
>          >      > sr = 44100
>          >      > ksmps = 128
>          >      > nchnls = 2
>          >      > 0dbfs = 1.0
>          >      >
>          >      >
>          >      > instr 1
>          >      > iArr[]   fillarray    60, 61, 62, 63, 64, 65, 66, 67
>          >      > ininstr = 8 ;number of called instances
>          >      > indx = 0
>          >      >
>          >      > loop:
>          >      > irytm = .5
>          >      > event_i "i", 2, indx*irytm, irytm, iArr[indx]
>          >      > if indx == 8 then
>          >      >     reinit loop
>          >      > endif
>          >      > loop_lt indx, 1, ininstr, loop
>          >      >
>          >      > endin
>          >      >
>          >      >
>          >      >
>          >      > instr 2
>          >      > ifreq = cpsmidinn(p4)
>          >      > a1 oscils .1, ifreq, 0
>          >      >
>          >      > outs a1, a1
>          >      >
>          >      > endin
>          >      >
>          >      > 
>          >      > 
>          >      > r1000
>          >      > i 1 0 8
>          >      >
>          >      > 
>          >      > 
>          >      >
>          >      >
>          >      >
>          >      > --
>          >      > View this message in context:
>          >
>         http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338.html
>          >      > Sent from the Csound - General mailing list archive at
>         Nabble.com.
>          >      >
>          >      >
>          >      > Send bugs reports to the Sourceforge bug trackers
>          >      > csound6:
>          >      > https://sourceforge.net/p/csound/tickets/
>          >      > csound5:
>          >      > https://sourceforge.net/p/csound/bugs/
>          >      > Discussions of bugs and features can be posted here
>          >      > To unsubscribe, send email [hidden email]
>          >     
>         with body
>          >     "unsubscribe csound"
>
>          >      >
>          >      >
>          >      >
>          >
>          >
>          >     Send bugs reports to the Sourceforge bug trackers
>          >     csound6:
>          > https://sourceforge.net/p/csound/tickets/
>          >     csound5:
>          > https://sourceforge.net/p/csound/bugs/
>          >     Discussions of bugs and features can be posted here
>          >     To unsubscribe, send email [hidden email]
>          >     
>         with body
>          >     "unsubscribe csound"
>          >
>          >
>          >
>          >
>          >
>         ------------------------------------------------------------------------
>
>          >     If you reply to this email, your message will be added to
>         the
>          >     discussion below:
>          >
>         http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732360.html
>          >
>          >     To unsubscribe from Looping array index on i-time, click
>         here.
>          >     NAML
>          >
>         
>
>
>          >
>          >
>          >
>          >
>          >
>          > --
>          > Hlöðver Sigurðsson
>          >
>          >
>         ------------------------------------------------------------------------
>
>          > View this message in context: Re: Looping array index on i-time
>          >
>         
>
>          > Sent from the Csound - General mailing list archive
>          >
>         
>         at
>          > Nabble.com.
>
>
>         Send bugs reports to the Sourceforge bug trackers
>         csound6:
>         https://sourceforge.net/p/csound/tickets/
>         csound5:
>         https://sourceforge.net/p/csound/bugs/
>         Discussions of bugs and features can be posted here
>         To unsubscribe, send email [hidden email]
>          with body
>         "unsubscribe csound"
>
>
>
>
>         ------------------------------------------------------------------------
>         If you reply to this email, your message will be added to the
>         discussion below:
>         http://csound.1045644.n5.nabble.com/Looping-array-index-on-i-time-tp5732338p5732409.html
>
>         To unsubscribe from Looping array index on i-time, click here.
>         NAML
>         
>
>
>
>
>
>     --
>     Hlöðver Sigurðsson
>
>     ------------------------------------------------------------------------
>     View this message in context: Re: Looping array index on i-time
>     
>     Sent from the Csound - General mailing list archive
>     
>     at Nabble.com.
>
>
>
>
> --
> Hlöðver Sigurðsson