Csound Csound-dev Csound-tekno Search About

[Csnd] % confusion

Date2011-09-11 17:05
FromSi Mills
Subject[Csnd] % confusion
Hi

I'm using a counter in a metro that gets fed an increment or decrement value by a p-field from the score. So if the instrument receives a 1, the statement would be kindex = kindex + 1. Likewise if a -1 is received the statement is kindex=kindex + -1 and the counter starts decrementing

I'm using modulus to keep the numbers within a range, in this case governed by the size of the table it is indexing. However I'm getting unexpected results when the number goes negative. Eg, -3 % 5 i would expect to result in 2, but I'm just getting -3

Am I missing something about % in csound as it doesn't seem to work as it does in other environments.

Many thanks
Si

Date2011-09-11 17:55
Fromjoachim heintz
SubjectRe: [Csnd] % confusion
hi si -
what about using abs() in this context?
in your example, abs(-3) % 5?
best -
	joachim

Am 11.09.2011 18:05, schrieb Si Mills:
> Hi
> 
> I'm using a counter in a metro that gets fed an increment or decrement
> value by a p-field from the score. So if the instrument receives a 1,
> the statement would be kindex = kindex + 1. Likewise if a -1 is received
> the statement is kindex=kindex + -1 and the counter starts decrementing
> 
> I'm using modulus to keep the numbers within a range, in this case
> governed by the size of the table it is indexing. However I'm getting
> unexpected results when the number goes negative. Eg, -3 % 5 i would
> expect to result in 2, but I'm just getting -3
> 
> Am I missing something about % in csound as it doesn't seem to work as
> it does in other environments.
> 
> Many thanks
> Si


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-09-11 19:29
FromSi Mills
SubjectRe: [Csnd] % confusion
Hi Joachim

THanks for your reply. I did that but there still seems to be weird behaviour. The result only alternates between 0 and 1. Here is the instrument - can you spot anything?


     instr 2 ;trigger the pluckers

kindex init 0

kint = p4

krandl = p5

krandh = p6

kdirection = p7

krate init 6

kfreq table kindex, 4 ;frequncy

kamp unirand 0.4

kplk random 0.2, 0.99

kpick random 0.8, 0.9

krefl random 0.2, 0.9


; fire!

ktrig metro krate

if ktrig == 1 then

event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl

krate random krandl, krandh

kindex = abs(kindex + -1) % ftlen(4)

printk2 kindex

endif


     endin


thanks again


On 11 September 2011 17:55, joachim heintz <jh@joachimheintz.de> wrote:
hi si -
what about using abs() in this context?
in your example, abs(-3) % 5?
best -
       joachim

Am 11.09.2011 18:05, schrieb Si Mills:
> Hi
>
> I'm using a counter in a metro that gets fed an increment or decrement
> value by a p-field from the score. So if the instrument receives a 1,
> the statement would be kindex = kindex + 1. Likewise if a -1 is received
> the statement is kindex=kindex + -1 and the counter starts decrementing
>
> I'm using modulus to keep the numbers within a range, in this case
> governed by the size of the table it is indexing. However I'm getting
> unexpected results when the number goes negative. Eg, -3 % 5 i would
> expect to result in 2, but I'm just getting -3
>
> Am I missing something about % in csound as it doesn't seem to work as
> it does in other environments.
>
> Many thanks
> Si


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-09-11 19:40
Fromjoachim heintz
SubjectRe: [Csnd] % confusion
can you post or attach the whole csd? then i can have a look.
best -
	joachim

Am 11.09.2011 20:29, schrieb Si Mills:
> Hi Joachim
> 
> THanks for your reply. I did that but there still seems to be weird
> behaviour. The result only alternates between 0 and 1. Here is the
> instrument - can you spot anything?
> 
> 
>      instr 2 ;trigger the pluckers
> 
> kindex init 0
> 
> kint = p4
> 
> krandl = p5
> 
> krandh = p6
> 
> kdirection = p7
> 
> krate init 6
> 
> kfreq table kindex, 4 ;frequncy
> 
> kamp unirand 0.4
> 
> kplk random 0.2, 0.99
> 
> kpick random 0.8, 0.9
> 
> krefl random 0.2, 0.9
> 
> 
> ; fire!
> 
> ktrig metro krate
> 
> if ktrig == 1 then
> 
> event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
> 
> krate random krandl, krandh
> 
> kindex = abs(kindex + -1) % ftlen(4)
> 
> printk2 kindex
> 
> endif
> 
> 
>      endin
> 
> 
> thanks again
> 
> 
> On 11 September 2011 17:55, joachim heintz  > wrote:
> 
>     hi si -
>     what about using abs() in this context?
>     in your example, abs(-3) % 5?
>     best -
>            joachim
> 
>     Am 11.09.2011 18:05, schrieb Si Mills:
>     > Hi
>     >
>     > I'm using a counter in a metro that gets fed an increment or decrement
>     > value by a p-field from the score. So if the instrument receives a 1,
>     > the statement would be kindex = kindex + 1. Likewise if a -1 is
>     received
>     > the statement is kindex=kindex + -1 and the counter starts
>     decrementing
>     >
>     > I'm using modulus to keep the numbers within a range, in this case
>     > governed by the size of the table it is indexing. However I'm getting
>     > unexpected results when the number goes negative. Eg, -3 % 5 i would
>     > expect to result in 2, but I'm just getting -3
>     >
>     > Am I missing something about % in csound as it doesn't seem to work as
>     > it does in other environments.
>     >
>     > Many thanks
>     > Si
> 
> 
>     Send bugs reports to the Sourceforge bug tracker
>              
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>      with body "unsubscribe csound"
> 
> 


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-09-11 19:45
FromSi Mills
SubjectRe: [Csnd] % confusion
Attachmentswaveform shapes 02.csd  
Hi, 

Yep i've attached it

cheers

On 11 September 2011 19:40, joachim heintz <jh@joachimheintz.de> wrote:
can you post or attach the whole csd? then i can have a look.
best -
       joachim

Am 11.09.2011 20:29, schrieb Si Mills:
> Hi Joachim
>
> THanks for your reply. I did that but there still seems to be weird
> behaviour. The result only alternates between 0 and 1. Here is the
> instrument - can you spot anything?
>
>
>      instr 2 ;trigger the pluckers
>
> kindex init 0
>
> kint = p4
>
> krandl = p5
>
> krandh = p6
>
> kdirection = p7
>
> krate init 6
>
> kfreq table kindex, 4 ;frequncy
>
> kamp unirand 0.4
>
> kplk random 0.2, 0.99
>
> kpick random 0.8, 0.9
>
> krefl random 0.2, 0.9
>
>
> ; fire!
>
> ktrig metro krate
>
> if ktrig == 1 then
>
> event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
>
> krate random krandl, krandh
>
> kindex = abs(kindex + -1) % ftlen(4)
>
> printk2 kindex
>
> endif
>
>
>      endin
>
>
> thanks again
>
>
> On 11 September 2011 17:55, joachim heintz <jh@joachimheintz.de
> <mailto:jh@joachimheintz.de>> wrote:
>
>     hi si -
>     what about using abs() in this context?
>     in your example, abs(-3) % 5?
>     best -
>            joachim
>
>     Am 11.09.2011 18:05, schrieb Si Mills:
>     > Hi
>     >
>     > I'm using a counter in a metro that gets fed an increment or decrement
>     > value by a p-field from the score. So if the instrument receives a 1,
>     > the statement would be kindex = kindex + 1. Likewise if a -1 is
>     received
>     > the statement is kindex=kindex + -1 and the counter starts
>     decrementing
>     >
>     > I'm using modulus to keep the numbers within a range, in this case
>     > governed by the size of the table it is indexing. However I'm getting
>     > unexpected results when the number goes negative. Eg, -3 % 5 i would
>     > expect to result in 2, but I'm just getting -3
>     >
>     > Am I missing something about % in csound as it doesn't seem to work as
>     > it does in other environments.
>     >
>     > Many thanks
>     > Si
>
>
>     Send bugs reports to the Sourceforge bug tracker
>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-09-11 19:47
FromSi Mills
SubjectRe: [Csnd] % confusion
Attachmentswaveform shapes 02.csd  
oops sorry could you ignore that last attachment, i broke something

heres a new one

On 11 September 2011 19:45, Si Mills <smills@rootsix.net> wrote:
Hi, 

Yep i've attached it

cheers


On 11 September 2011 19:40, joachim heintz <jh@joachimheintz.de> wrote:
can you post or attach the whole csd? then i can have a look.
best -
       joachim

Am 11.09.2011 20:29, schrieb Si Mills:
> Hi Joachim
>
> THanks for your reply. I did that but there still seems to be weird
> behaviour. The result only alternates between 0 and 1. Here is the
> instrument - can you spot anything?
>
>
>      instr 2 ;trigger the pluckers
>
> kindex init 0
>
> kint = p4
>
> krandl = p5
>
> krandh = p6
>
> kdirection = p7
>
> krate init 6
>
> kfreq table kindex, 4 ;frequncy
>
> kamp unirand 0.4
>
> kplk random 0.2, 0.99
>
> kpick random 0.8, 0.9
>
> krefl random 0.2, 0.9
>
>
> ; fire!
>
> ktrig metro krate
>
> if ktrig == 1 then
>
> event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
>
> krate random krandl, krandh
>
> kindex = abs(kindex + -1) % ftlen(4)
>
> printk2 kindex
>
> endif
>
>
>      endin
>
>
> thanks again
>
>
> On 11 September 2011 17:55, joachim heintz <jh@joachimheintz.de
> <mailto:jh@joachimheintz.de>> wrote:
>
>     hi si -
>     what about using abs() in this context?
>     in your example, abs(-3) % 5?
>     best -
>            joachim
>
>     Am 11.09.2011 18:05, schrieb Si Mills:
>     > Hi
>     >
>     > I'm using a counter in a metro that gets fed an increment or decrement
>     > value by a p-field from the score. So if the instrument receives a 1,
>     > the statement would be kindex = kindex + 1. Likewise if a -1 is
>     received
>     > the statement is kindex=kindex + -1 and the counter starts
>     decrementing
>     >
>     > I'm using modulus to keep the numbers within a range, in this case
>     > governed by the size of the table it is indexing. However I'm getting
>     > unexpected results when the number goes negative. Eg, -3 % 5 i would
>     > expect to result in 2, but I'm just getting -3
>     >
>     > Am I missing something about % in csound as it doesn't seem to work as
>     > it does in other environments.
>     >
>     > Many thanks
>     > Si
>
>
>     Send bugs reports to the Sourceforge bug tracker
>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2011-09-11 20:25
Fromjoachim heintz
SubjectRe: [Csnd] % confusion
Attachmentswaveform shapes 02.csd  
nice instrument, thanks.
i have changed the boundary check to these expressions:
a)		kindex = (kindex == ftlen(4) ? 0 : kindex)
b)		kindex = (kindex < 0 ? ftlen(4) - 1 : kindex)
actually you could skip a), because table can be set to wrap. but i
think just in the case that the indices are larger than allowed.
negative indices are set to zero, so you need b) for the decrementing.

it should be possible to do this with modulo, but i think this solution
is very simple.

i have put the table reading in the if clause, because this needs just
to be done if your trigger is on, and not at each k-cycle.

hope it works for you, best -

	joachim



Am 11.09.2011 20:47, schrieb Si Mills:
> oops sorry could you ignore that last attachment, i broke something
> 
> heres a new one
> 
> On 11 September 2011 19:45, Si Mills  > wrote:
> 
>     Hi, 
> 
>     Yep i've attached it
> 
>     cheers
> 
> 
>     On 11 September 2011 19:40, joachim heintz      > wrote:
> 
>         can you post or attach the whole csd? then i can have a look.
>         best -
>                joachim
> 
>         Am 11.09.2011 20:29, schrieb Si Mills:
>         > Hi Joachim
>         >
>         > THanks for your reply. I did that but there still seems to be
>         weird
>         > behaviour. The result only alternates between 0 and 1. Here is the
>         > instrument - can you spot anything?
>         >
>         >
>         >      instr 2 ;trigger the pluckers
>         >
>         > kindex init 0
>         >
>         > kint = p4
>         >
>         > krandl = p5
>         >
>         > krandh = p6
>         >
>         > kdirection = p7
>         >
>         > krate init 6
>         >
>         > kfreq table kindex, 4 ;frequncy
>         >
>         > kamp unirand 0.4
>         >
>         > kplk random 0.2, 0.99
>         >
>         > kpick random 0.8, 0.9
>         >
>         > krefl random 0.2, 0.9
>         >
>         >
>         > ; fire!
>         >
>         > ktrig metro krate
>         >
>         > if ktrig == 1 then
>         >
>         > event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
>         >
>         > krate random krandl, krandh
>         >
>         > kindex = abs(kindex + -1) % ftlen(4)
>         >
>         > printk2 kindex
>         >
>         > endif
>         >
>         >
>         >      endin
>         >
>         >
>         > thanks again
>         >
>         >
>         > On 11 September 2011 17:55, joachim heintz
>         
>         > >> wrote:
>         >
>         >     hi si -
>         >     what about using abs() in this context?
>         >     in your example, abs(-3) % 5?
>         >     best -
>         >            joachim
>         >
>         >     Am 11.09.2011 18:05, schrieb Si Mills:
>         >     > Hi
>         >     >
>         >     > I'm using a counter in a metro that gets fed an
>         increment or decrement
>         >     > value by a p-field from the score. So if the instrument
>         receives a 1,
>         >     > the statement would be kindex = kindex + 1. Likewise if
>         a -1 is
>         >     received
>         >     > the statement is kindex=kindex + -1 and the counter starts
>         >     decrementing
>         >     >
>         >     > I'm using modulus to keep the numbers within a range, in
>         this case
>         >     > governed by the size of the table it is indexing.
>         However I'm getting
>         >     > unexpected results when the number goes negative. Eg, -3
>         % 5 i would
>         >     > expect to result in 2, but I'm just getting -3
>         >     >
>         >     > Am I missing something about % in csound as it doesn't
>         seem to work as
>         >     > it does in other environments.
>         >     >
>         >     > Many thanks
>         >     > Si
>         >
>         >
>         >     Send bugs reports to the Sourceforge bug tracker
>         >
>         >    
>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>         
>         >    
>                  >
>         >     Discussions of bugs and features can be posted here
>         >     To unsubscribe, send email sympa@lists.bath.ac.uk
>         
>         >              > with body "unsubscribe csound"
>         >
>         >
> 
> 
>         Send bugs reports to the Sourceforge bug tracker
>                  
>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>         
>         Discussions of bugs and features can be posted here
>         To unsubscribe, send email sympa@lists.bath.ac.uk
>          with body "unsubscribe csound"
> 
> 
> 

Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-09-11 20:27
FromSi Mills
SubjectRe: [Csnd] % confusion
I think I may have solved it! 

The table opcode has a wraparound argument - very nice :)

Still the modulus does appear to be behaving a little oddly

thanks again

On 11 September 2011 19:47, Si Mills <smills@rootsix.net> wrote:
oops sorry could you ignore that last attachment, i broke something

heres a new one


On 11 September 2011 19:45, Si Mills <smills@rootsix.net> wrote:
Hi, 

Yep i've attached it

cheers


On 11 September 2011 19:40, joachim heintz <jh@joachimheintz.de> wrote:
can you post or attach the whole csd? then i can have a look.
best -
       joachim

Am 11.09.2011 20:29, schrieb Si Mills:
> Hi Joachim
>
> THanks for your reply. I did that but there still seems to be weird
> behaviour. The result only alternates between 0 and 1. Here is the
> instrument - can you spot anything?
>
>
>      instr 2 ;trigger the pluckers
>
> kindex init 0
>
> kint = p4
>
> krandl = p5
>
> krandh = p6
>
> kdirection = p7
>
> krate init 6
>
> kfreq table kindex, 4 ;frequncy
>
> kamp unirand 0.4
>
> kplk random 0.2, 0.99
>
> kpick random 0.8, 0.9
>
> krefl random 0.2, 0.9
>
>
> ; fire!
>
> ktrig metro krate
>
> if ktrig == 1 then
>
> event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
>
> krate random krandl, krandh
>
> kindex = abs(kindex + -1) % ftlen(4)
>
> printk2 kindex
>
> endif
>
>
>      endin
>
>
> thanks again
>
>
> On 11 September 2011 17:55, joachim heintz <jh@joachimheintz.de
> <mailto:jh@joachimheintz.de>> wrote:
>
>     hi si -
>     what about using abs() in this context?
>     in your example, abs(-3) % 5?
>     best -
>            joachim
>
>     Am 11.09.2011 18:05, schrieb Si Mills:
>     > Hi
>     >
>     > I'm using a counter in a metro that gets fed an increment or decrement
>     > value by a p-field from the score. So if the instrument receives a 1,
>     > the statement would be kindex = kindex + 1. Likewise if a -1 is
>     received
>     > the statement is kindex=kindex + -1 and the counter starts
>     decrementing
>     >
>     > I'm using modulus to keep the numbers within a range, in this case
>     > governed by the size of the table it is indexing. However I'm getting
>     > unexpected results when the number goes negative. Eg, -3 % 5 i would
>     > expect to result in 2, but I'm just getting -3
>     >
>     > Am I missing something about % in csound as it doesn't seem to work as
>     > it does in other environments.
>     >
>     > Many thanks
>     > Si
>
>
>     Send bugs reports to the Sourceforge bug tracker
>
>      https://sourceforge.net/tracker/?group_id=81968&atid=564599
>     <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>     <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>
>


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2011-09-11 20:50
FromSi Mills
SubjectRe: [Csnd] % confusion
Smashing thanks for taking a look. Hmm for some reason your attachment has not worked for me

S

On 11 September 2011 20:25, joachim heintz <jh@joachimheintz.de> wrote:
This is a multi-part message in MIME format.
--------------030405030708000509090603
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

nice instrument, thanks.
i have changed the boundary check to these expressions:
a)              kindex = (kindex == ftlen(4) ? 0 : kindex)
b)              kindex = (kindex < 0 ? ftlen(4) - 1 : kindex)
actually you could skip a), because table can be set to wrap. but i
think just in the case that the indices are larger than allowed.
negative indices are set to zero, so you need b) for the decrementing.

it should be possible to do this with modulo, but i think this solution
is very simple.

i have put the table reading in the if clause, because this needs just
to be done if your trigger is on, and not at each k-cycle.

hope it works for you, best -

       joachim



Am 11.09.2011 20:47, schrieb Si Mills:
> oops sorry could you ignore that last attachment, i broke something
>
> heres a new one
>
> On 11 September 2011 19:45, Si Mills <smills@rootsix.net
> <mailto:smills@rootsix.net>> wrote:
>
>     Hi,
>
>     Yep i've attached it
>
>     cheers
>
>
>     On 11 September 2011 19:40, joachim heintz <jh@joachimheintz.de
>     <mailto:jh@joachimheintz.de>> wrote:
>
>         can you post or attach the whole csd? then i can have a look.
>         best -
>                joachim
>
>         Am 11.09.2011 20:29, schrieb Si Mills:
>         > Hi Joachim
>         >
>         > THanks for your reply. I did that but there still seems to be
>         weird
>         > behaviour. The result only alternates between 0 and 1. Here is the
>         > instrument - can you spot anything?
>         >
>         >
>         >      instr 2 ;trigger the pluckers
>         >
>         > kindex init 0
>         >
>         > kint = p4
>         >
>         > krandl = p5
>         >
>         > krandh = p6
>         >
>         > kdirection = p7
>         >
>         > krate init 6
>         >
>         > kfreq table kindex, 4 ;frequncy
>         >
>         > kamp unirand 0.4
>         >
>         > kplk random 0.2, 0.99
>         >
>         > kpick random 0.8, 0.9
>         >
>         > krefl random 0.2, 0.9
>         >
>         >
>         > ; fire!
>         >
>         > ktrig metro krate
>         >
>         > if ktrig == 1 then
>         >
>         > event "i", 3, 0, 1, kplk, kamp, cpspch(kfreq+kint), kpick, krefl
>         >
>         > krate random krandl, krandh
>         >
>         > kindex = abs(kindex + -1) % ftlen(4)
>         >
>         > printk2 kindex
>         >
>         > endif
>         >
>         >
>         >      endin
>         >
>         >
>         > thanks again
>         >
>         >
>         > On 11 September 2011 17:55, joachim heintz
>         <jh@joachimheintz.de <mailto:jh@joachimheintz.de>
>         > <mailto:jh@joachimheintz.de <mailto:jh@joachimheintz.de>>> wrote:
>         >
>         >     hi si -
>         >     what about using abs() in this context?
>         >     in your example, abs(-3) % 5?
>         >     best -
>         >            joachim
>         >
>         >     Am 11.09.2011 18:05, schrieb Si Mills:
>         >     > Hi
>         >     >
>         >     > I'm using a counter in a metro that gets fed an
>         increment or decrement
>         >     > value by a p-field from the score. So if the instrument
>         receives a 1,
>         >     > the statement would be kindex = kindex + 1. Likewise if
>         a -1 is
>         >     received
>         >     > the statement is kindex=kindex + -1 and the counter starts
>         >     decrementing
>         >     >
>         >     > I'm using modulus to keep the numbers within a range, in
>         this case
>         >     > governed by the size of the table it is indexing.
>         However I'm getting
>         >     > unexpected results when the number goes negative. Eg, -3
>         % 5 i would
>         >     > expect to result in 2, but I'm just getting -3
>         >     >
>         >     > Am I missing something about % in csound as it doesn't
>         seem to work as
>         >     > it does in other environments.
>         >     >
>         >     > Many thanks
>         >     > Si
>         >
>         >
>         >     Send bugs reports to the Sourceforge bug tracker
>         >
>         >
>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>         >
>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599
>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>>
>         >     Discussions of bugs and features can be posted here
>         >     To unsubscribe, send email sympa@lists.bath.ac.uk
>         <mailto:sympa@lists.bath.ac.uk>
>         >     <mailto:sympa@lists.bath.ac.uk
>         <mailto:sympa@lists.bath.ac.uk>> with body "unsubscribe csound"
>         >
>         >
>
>
>         Send bugs reports to the Sourceforge bug tracker
>
>          https://sourceforge.net/tracker/?group_id=81968&atid=564599
>         <https://sourceforge.net/tracker/?group_id=81968&atid=564599>
>         Discussions of bugs and features can be posted here
>         To unsubscribe, send email sympa@lists.bath.ac.uk
>         <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"
>
>
>

Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


--------------030405030708000509090603
Content-Type: audio/csound;
 name="waveform shapes 02.csd"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="waveform shapes 02.csd"

PENzb3VuZFN5bnRoZXNpemVyPgo8Q3NPcHRpb25zPgotbTAKPC9Dc09wdGlv
bnM+CjxDc0luc3RydW1lbnRzPgpzciA9IDQ0MTAwCmtzbXBzID0gMzIKbmNo
bmxzID0gMgowZGJmcyA9IDEuMApzZWVkCTAKCmdpV2F2ZSA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R0aD4KIDwvYnNiT2JqZWN0Pgo8L2JzYlBhbmVsPgo8YnNiUHJl
c2V0cz4KPC9ic2JQcmVzZXRzPgo8RXZlbnRQYW5lbCBuYW1lPSIiIHRlbXBv
PSI2MC4wMDAwMDAwMCIgbG9vcD0iOC4wMDAwMDAwMCIgeD0iNjg2IiB5PSIx
MzkiIHdpZHRoPSI2NTUiIGhlaWdodD0iMzQ2IiB2aXNpYmxlPSJmYWxzZSIg
bG9vcFN0YXJ0PSItMi4xNDc0OGUrMDkiIGxvb3BFbmQ9IjAiPmkgMgkwCTI0
CS0yIAkyCTMJLTEgPC9FdmVudFBhbmVsPgo=

--------------030405030708000509090603--



Date2011-09-11 20:56
FromMark Van Peteghem
SubjectRe: [Csnd] % confusion
Actually the modulus operator behaves like that in every programming 
language that I know, because the CPU does it like that. I suppose the 
CSound developers kept this behavior for performance reasons (or simply 
didn't know it).

If necessary it can be solved as follows:

if kindex>=0 then
  kindex = kindex % 5
else
  kindex = kindex % 5 + 5
endif

or shorter but weirder:

kindex = (kindex%5+5)%5

Mark

Si Mills wrote:
> I think I may have solved it! 
>
> The table opcode has a wraparound argument - very nice :)
>
> Still the modulus does appear to be behaving a little oddly
>
> thanks again



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-09-11 21:36
FromSi Mills
SubjectRe: [Csnd] % confusion
OK right, its nice to have a context to these things. So I guess that the other environments I mentioned (SC, Pd) have this addition you stated below?...

Thanks for the help folks. I'm pretty new to Csound but really encouraged by it. I have to say; I've been far more productive in rendering ideas than I have with the others in a short space of time. I really see the merits of its use as a tool to assist in the music making process; it doesn't discriminate between making nice sounds for your sampler, or full-blown composition environment. It invites you to record and archive the sounds that you make, and that makes it different IMO

On 11 September 2011 20:56, Mark Van Peteghem <Mark.Van.Peteghem@telenet.be> wrote:
Actually the modulus operator behaves like that in every programming language that I know, because the CPU does it like that. I suppose the CSound developers kept this behavior for performance reasons (or simply didn't know it).

If necessary it can be solved as follows:

if kindex>=0 then
 kindex = kindex % 5
else
 kindex = kindex % 5 + 5
endif

or shorter but weirder:

kindex = (kindex%5+5)%5

Mark


Si Mills wrote:
I think I may have solved it!
The table opcode has a wraparound argument - very nice :)

Still the modulus does appear to be behaving a little oddly

thanks again



Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-09-12 19:27
FromMark Van Peteghem
SubjectRe: [Csnd] % confusion
I don't know, I never used SC or Pd.

Si Mills wrote:
> OK right, its nice to have a context to these things. So I guess that 
> the other environments I mentioned (SC, Pd) have this addition you 
> stated below?...



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"