Hi Dario,
thanks a lot! It is exactly what I needed.
To go further with the looper, here is the code so far:
import("stdfaust.lib");
sampleRate = 48000;
maxTime = 4;
maxSamples = sampleRate * maxTime;
btn = button("[4]trigger");
readSpeed = hslider("[3]read_speed", 1, -3, 3, 0.1) : si.smoo;
loopSize = ba.sAndH(btn, fi.pole(btn, btn)) : hbargraph("[0]loop_size",
0, maxSamples);
readIndex = readSpeed/float(sampleRate) : (+ : ma.decimal) ~ _ :
*(float(loopSize)) : int : hbargraph("[1]read_index", 0, maxSamples);
recIndex = (+(1) : %(maxSamples)) ~ *(btn) : hbargraph("[2]rec_index",
0, maxSamples);
// doesn't compile
// looper = rwtable(maxSamples,0.0,recIndex,_,readIndex);
// compiles
looper = rwtable(maxSamples,0.0,0,_,readIndex);
process = looper;
the read and write indexes are from the example I found on the
documentation:
https://faustdoc.grame.fr/manual/syntax/#rwtable-primitive
I get this error for the recIndex and I can't understand its meaning:
ERROR inferring write table type, wrong write index type : RSESN interval()
Can you please point me anywhere I can figuring out what does it mean?
Sorry, my knowledge of the platform is quite small and also functional
programming syntax is not always clear to me...
Thanks,
Daniele
Il 21/12/20 15:34, Dario Sanfilippo ha scritto:
Hi, Daniele.
Perhaps something like this?
import("stdfaust.lib");
btn = button("trigger");
down_samples = ba.sAndH(btn, fi.pole(btn, btn));
process = down_samples;
Ciao,
Dario
On Mon, 21 Dec 2020 at 14:56, Daniele Pagliero
<daniele.pagli...@gmail.com <mailto:daniele.pagli...@gmail.com>> wrote:
Hello,
I need help understanding how to get the elapsed time or samples
between
2 clicks on a button.
Let's say I have a button like:
btn = button("trigger");
I need to know for how long the button was pressed.
Then use the value to control a rwtable to create a variable
length looper.
I've searched in the docs but I didn't find any clue...
Thanks,
Daniele
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
<mailto:Faudiostream-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/faudiostream-users
--
Dr Dario Sanfilippo
http://dariosanfilippo.com
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users