Csound Csound-dev Csound-tekno Search About

[Csnd] segfault possibility in GEN42

Date2009-05-23 11:00
FromAndy Fillebrown
Subject[Csnd] segfault possibility in GEN42
Hello,

I've been working on Qt wrappers for Csound's table system and I ran into a subtle segfault in GEN42.  As it turned out, the total value probability was causing the issue.  For unit-testing I was using a total value probability of 100 but after looking at fgens.c I realized it's expecting the total to be 1.0.  Normally I would use 1.0 automatically but the docs for GEN42 say the total value probability should be a "percentage" for readability, which is why I aimed for 100 -- so I'd figured I should post it in case someone else runs into the same problem.

Regards,
-andy.f


Date2009-05-23 13:04
FromAndres Cabrera
Subject[Csnd] Re: segfault possibility in GEN42
Hi Andy,

I wrote this for the manual entry, is it OK?

The first number of each group is a the minimum value of the range,
the second is the maximum value and the third is the probability of
that an element belonging to that range of values can be chosen by a
random algorithm. Probabilities for a range should be a fraction of 1,
and the sum of the probabilities for all the ranges should total 1.0.

Also, I'm very curious, what do you mean by Qt wrappers?

Cheers,
Andrés

On Sat, May 23, 2009 at 5:00 AM, Andy Fillebrown
 wrote:
> Hello,
>
> I've been working on Qt wrappers for Csound's table system and I ran into a
> subtle segfault in GEN42.  As it turned out, the total value probability was
> causing the issue.  For unit-testing I was using a total value probability
> of 100 but after looking at fgens.c I realized it's expecting the total to
> be 1.0.  Normally I would use 1.0 automatically but the docs for GEN42 say
> the total value probability should be a "percentage" for readability, which
> is why I aimed for 100 -- so I'd figured I should post it in case someone
> else runs into the same problem.
>
> Regards,
> -andy.f
>
>



-- 


Andrés


Date2009-05-23 19:21
FromAndy Fillebrown
Subject[Csnd] Re: Re: segfault possibility in GEN42
Hi Andres,

The docs are "probably" fine =) It just threw me off a little because I'm not familiar with the terminology.

---

The wrappers are Qt based C++ classes I put together to poke around in the Csound api using Qt's object model and api style.  I started with table wrappers because I'm expecting to use them heavily in AudioCarver.

So something like the following snippet automates GEN42...

QObject *root = new QObject;
QCsound *rootCsd = new QCsound(root);
...
{
QCsoundTable42 *fn = new QCsoundTable42(rootCsd, 1024);
fn->addArgs(0,     0,    .2);
fn->addArgs(0.125, 0.25, .2);
fn->addArgs(0.375, 0.5,  .2);
fn->addArgs(0.625, 0.75, .2);
fn->addArgs(0.875, 1,    .2);
}

---

Cheers,
-andy.f




----- "Andres Cabrera"  wrote:
> Hi Andy,
> 
> I wrote this for the manual entry, is it OK?
> 
> The first number of each group is a the minimum value of the range,
> the second is the maximum value and the third is the probability of
> that an element belonging to that range of values can be chosen by a
> random algorithm. Probabilities for a range should be a fraction of 1,
> and the sum of the probabilities for all the ranges should total 1.0.
> 
> Also, I'm very curious, what do you mean by Qt wrappers?
> 
> Cheers,
> Andrés
> 
> On Sat, May 23, 2009 at 5:00 AM, Andy Fillebrown
>  wrote:
> > Hello,
> >
> > I've been working on Qt wrappers for Csound's table system and I ran
> into a
> > subtle segfault in GEN42.  As it turned out, the total value
> probability was
> > causing the issue.  For unit-testing I was using a total value
> probability
> > of 100 but after looking at fgens.c I realized it's expecting the
> total to
> > be 1.0.  Normally I would use 1.0 automatically but the docs for
> GEN42 say
> > the total value probability should be a "percentage" for
> readability, which
> > is why I aimed for 100 -- so I'd figured I should post it in case
> someone
> > else runs into the same problem.
> >
> > Regards,
> > -andy.f
> >
> >
> 
> 
> 
> --
> 
> 
> Andrés
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"