[Csnd] betarand - parameter ranges and interaction issue

Hey hey,
I'm doing some work with betrand trying to shape certain random number ranges, by adjusting the alpha and beta parameters.

I noticed that with higher values for both alpha and beta there is an issue. Csound uses 100% CPU and a 2 second i-event does not stop.

With 6 for both alpha and beta it appears to work, with 7 it does not.

Is this an inherent limitation of the mahts behind betarand or a bug? I could think of ways around it, if I have to, though this feels more ellgant.

Best wishes and thanks,

Jeanette

Hi Jeanette,
FWIW I was able to somewhat replicate the issue although in this simple example with alpha/beta higher than approx. 9 or 10.

-odac

sr = 48000
ksmps = 32
nchnls = 1
0dbfs = 1

instr 1
iIdx = 64
while iIdx >= 0 do
iBeta = betarand:i(1, 14, 14)
print iBeta
iIdx -= 1
od
aSig = poscil(.3, 330)
out aSig
endin

instr 2
aSig = poscil(.5, 220)
out aSig
endin

i1 0 2 i2 0 8

Best,
Scott

Hi again,
thanks for your reply and the code Scott. I have attached my own testing code, which uses betarand at k-rate. I find that with alpha and beta = 7 the code will complete, but it takes approximately more than double the alotted 2 seconds. Alpha and Beta values are supplied in the score, but printed out for every instrument call.

Currently, the instrument runs betarand at k-rate, calculating the minimum and maximum values, to print them and the responsible alpha and beta in the last cycle of the event. This is to gain a better understanding of the relationship between the parameters and the resultant random values.

Best wishes,

Jeanette

betarand.csd (1012 Bytes)