At 11:14 PM 4/24/2014, Timo Westkämper wrote:
I'd prefer a real fix to this issue. Piping
signals into rand is also tricky because they
also need to be unique otherwise pure function invocations are optimized.
Did you consider delaying each noise usage differently?:
import("music.lib");
N = 1024; // whatever is sufficient for the application
fn(i) = noise@(i*N);
process = par(i,4,fn(i));
That's what I normally do.
- Julius
Having just pure functions and functions with side effects would be easier.
On Fri, Apr 25, 2014 at 12:15 AM, Julius Smith
<<mailto:[email protected]>[email protected]> wrote:
Well it IS being called at the sampling rate,
but it's apparently assumed to have the same
value/side-effects at any given time
instant. Therefore, it's called only once per
sample no matter how many places it is used in the block diagram.
It should work to give your rand function a
signal argument (that it ignores) and pass
different signals through different instances:
 ...
 fn = ffunction(int rand(float), <math.h>, "")/RAND_MAX;
 process = fn,fn,fn,fn;
I suppose this is a bit of a hack, making the
faust2firefox block-diagrams unnecessarily messy.
- Julius
At 01:31 PM 4/24/2014, Timo Westkämper wrote:
Hi.
Based on the Faust documentation it should be
treated as a function with side effects:
"Foreign functions with input parameters are
considered pure math functions. They are
therefore considered free of side effects and
called only when their parameters change (that
is at the rate of the fastest parameter).
Exceptions are functions with no input
parameters. A typical example is the CÃ
rand()Ã function. In this case the compiler
generate code to call the function at sample rate."
<http://faust.grame.fr/index.php/documentation/references/12-documentation/reference/48-faust-syntax-reference-art#tth_sEc3.4.5>http://faust.grame.fr/index.php/documentation/references/12-documentation/reference/48-faust-syntax-reference-art#tth_sEc3.4.5
So it looks like it shouldn't be optimized as it
is now. While it is called at sample rate, the
parallel execution is not treated correctly.
Timo
On Thu, Apr 24, 2014 at 11:23 PM, Julius Smith
<<mailto:[email protected]>[email protected] > wrote:
Maybe it should be possible declare "volatile"
foreign functions that are not optimized in this way?
At 03:26 AM 4/24/2014, Timo WestkÃÆÃ¤mper wrote:
Hi.
Could I get a clarification concerning parameterless functions?
I tried this code
// stateless random generator
rand = fn / RAND_MAX
with {
ÃÃÂ fn = ffunction(int rand(), <math..h>, "");
ÃÃÂ RAND_MAX = fconstant(int RAND_MAX, <math.h>);
};
process = rand, rand, rand, rand;
and got the following result
ÃÃÂ ÃÃÂ virtirtual void compute (int
count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
FAUSTFLOAT* output0 = output[0];
FAUSTFLOAT* output1 = output[1];
FAUSTFLOAT* output2 = output[2];
FAUSTFLOAT* output3 = output[3];
for (int i=0; i<count; i++) {
float fTemp0 = (float(rand()) / float(RAND_MAX));
output0[i] = (FAUSTFLOAT)fTemp0;
output1[i] = (FAUSTFLOAT)fTemp0;
output2[i] = (FAUSTFLOAT)fTemp0;
output3[i] = (FAUSTFLOAT)fTemp0;
}
}
I expected four random numbers in parallel.
What is the right way to call rand() from Faust?
Br,
Timo
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
<http://p.sf.net/sfu/ExoPlatform>http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Faudiostream-users mailing list
<mailto:[email protected]>[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Julius O. Smith III <<mailto:[email protected]>[email protected] >
Professor of Music and, by courtesy, Electrical Engineering
CCRMA, Stanford University
<http://ccrma.stanford.edu/~jos/>http://ccrma.stanford.edu/~jos/
Julius O. Smith III <<mailto:[email protected]>[email protected]>
Professor of Music and, by courtesy, Electrical Engineering
CCRMA, Stanford University
<http://ccrma.stanford.edu/~jos/>http://ccrma.stanford.edu/~jos/
Julius O. Smith III <[email protected]>
Professor of Music and, by courtesy, Electrical Engineering
CCRMA, Stanford University
http://ccrma.stanford.edu/~jos/
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users