Csound Csound-dev Csound-tekno Search About

problems with loops at i-rate

Date2016-02-06 09:05
FromKarin Daum
Subjectproblems with loops at i-rate
yesterday I encountered a problems with counting correctly in loops (at i-rate) when the length of the loops is determined from random numbers. I've striped off (almost - except the tables at the beginning) everything from my code not necessary for testing the behaviour of different possibilities of looping:
loop_lt
if - goto 
until - do
The code for verifying is attached.
it happens from time to time that the loop stops not at the maximum value but at maximum+1. this is the case for loop_lt and if-goto. In the case that this happens it happens simultaneously for these two ways of looping and in this case until-do will not come to an end. this is why I put it to comments in the example.

if, however, the variable for the maximum value is fixed the different types of loops behave as expected
 
cheers,

Karin 

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

Date2016-02-06 11:06
FromVictor Lazzarini
SubjectRe: problems with loops at i-rate
Can't check your code right now, but I had a thought: can you try making the random var an int before using it?
As in int(.) in the UDO xout?
There could be a rounding issue there maybe.

> On 6 Feb 2016, at 09:05, Karin Daum  wrote:
> 
> yesterday I encountered a problems with counting correctly in loops (at i-rate) when the length of the loops is determined from random numbers. I've striped off (almost - except the tables at the beginning) everything from my code not necessary for testing the behaviour of different possibilities of looping:
> loop_lt
> if - goto 
> until - do
> The code for verifying is attached.
> it happens from time to time that the loop stops not at the maximum value but at maximum+1. this is the case for loop_lt and if-goto. In the case that this happens it happens simultaneously for these two ways of looping and in this case until-do will not come to an end. this is why I put it to comments in the example.
> 
> if, however, the variable for the maximum value is fixed the different types of loops behave as expected
> 
> cheers,
> 
> Karin 
> 
> 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

Date2016-02-06 11:27
FromKarin Daum
SubjectRe: problems with loops at i-rate
I have it in the UDO just after throwing a dice, because I need it as an index for an array in the UDO so I thought it’s also int for xout. But I added to the random index an offset from a table (which is written as integer, but apparently is real) which obviously results in a non-integer value. xout int(indx+ioffset+1) or ioffset=int(ioffset) solves the  problem.

thanks,

Karin



> On 6 Feb 2016, at 12:06, Victor Lazzarini  wrote:
> 
> Can't check your code right now, but I had a thought: can you try making the random var an int before using it?
> As in int(.) in the UDO xout?
> There could be a rounding issue there maybe.
> 
>> On 6 Feb 2016, at 09:05, Karin Daum  wrote:
>> 
>> yesterday I encountered a problems with counting correctly in loops (at i-rate) when the length of the loops is determined from random numbers. I've striped off (almost - except the tables at the beginning) everything from my code not necessary for testing the behaviour of different possibilities of looping:
>> loop_lt
>> if - goto 
>> until - do
>> The code for verifying is attached.
>> it happens from time to time that the loop stops not at the maximum value but at maximum+1. this is the case for loop_lt and if-goto. In the case that this happens it happens simultaneously for these two ways of looping and in this case until-do will not come to an end. this is why I put it to comments in the example.
>> 
>> if, however, the variable for the maximum value is fixed the different types of loops behave as expected
>> 
>> cheers,
>> 
>> Karin 
>> 
>> 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