HI All, Regarding Dave Akbari's new opcodes (very much enjoying logcurve, btw!), I have just gotten around to working with them and had a couple suggestions for changes: 1)the gainslider opcode documentation mentions: "There is no bounds in the source code so you can for example give higher than 127 values for extra amplitude but possibly clipped audio." but the code given does seem to have bounds and also a possible bug situation: int gainslider_init(CSOUND *csound, gainslider *p) { *p->koutsig = GAINSLIDER((MYFLT) *p->kindex); return OK; } int gainslider_perf(CSOUND *csound, gainslider *p) { if (*p->kindex >= FL(0.0) && *p->kindex <= FL(152.0)) { *p->koutsig = GAINSLIDER((MYFLT) *p->kindex); } return OK; } For the init method, it does an initialization of the value against a kindex, but kindex may not be initialized at i-time. If this happens, and kindex later at k-time is a value below 0 or above 152, the koutsig is always going to return the value from the init. Now, this is a question I don't know the answer to: is a k-rate variable initialized to 0 when the pointer is allocated or is it just allocated? I'd like to propose the init function be removed and the performance function be changed to: int gainslider_perf(CSOUND *csound, gainslider *p) { if(*p->kindex <= FL(0.0)) { *p->koutsig = FL(0.0); } else { *p->koutsig = GAINSLIDER((MYFLT) *p->kindex); } return OK; } This will also alleviate if ksmps is high and ksig happens to jump from a valid value to an invalid value (in the old code) that the last value from gainslider isn't being returned. 2)the logcurve, expcurve, and scale init functions also don't seem necessary as they're operating on a kval which may not be initialized. These could probably removed as they're not doing any initial precalculations of state data or anything like that, and the thread for the OENTRY can be changed to 2. 3)The documentation to logcurve mentions ksteepness should not be <= 1, but doesn't mention much in regards to how that value affects the generated curve. I had to look at the formula and run some data through using different steepness values to figure out that values closer to 1 make it steeper while higher values flatten out the curve (is that right?). If so, I think adding a little more text to describe that parameter will make it a little more intuitive to those first coming across the opcode (which, btw, has become my favorite opcode of the day! Thanks Dave!). Also, should we add the formula for this opcode into the documentation? I imagine some users who are mathematically savvy but aren't interested to dig into the code might want to know what the formula is to plot out curves for themselves to find what they're looking for. 4)Same general comments as 3 but for expcurve (with the info flipped for suggested values for steepness) 5)expcurve code seems to be wrong to me! This is the macro defined in ugakbari: #define EXPCURVE(x,y) (exp(x * log(y))-1/(y-1)) while the UDO code is: kout = (exp(kfloat * log(ksteep)) - 1)/(ksteep - 1) I only noticed just now when trying to plot some values and I used the values from the macro. It seems it is missing some parentheses and should be: #define EXPCURVE(x,y) ((exp(x * log(y))-1)/(y-1)) Just wanted to note that I hope these comments are taken purely as constructive and that I'm very happy these opcodes are in! (Thanks Dave!) steven ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net