Hi everyone,

I'm working on an application for smartphone or tablet, it's an audio
recorder based on the rwtable function. I started this work following the
example illustrated in the Faust Kadenze Course (session 5):
*https://www.kadenze.com/courses/real-time-audio-signal-processing-in-faust/sessions/sound-synthesis-and-processing-ii-filters-echo-basic-physical-modeling-sampling-and-granular-synthesis
<https://www.kadenze.com/courses/real-time-audio-signal-processing-in-faust/sessions/sound-synthesis-and-processing-ii-filters-echo-basic-physical-modeling-sampling-and-granular-synthesis>*

After, I've added some effects and the possibility to play the sound
recorded without looping it. I did this in a "handmade" way: basically, I
transformed "rec_Index" and "read_Index" in two counters ("counter_rec" and
"counter_read"), and using the function ba.if I allowed them to count only
till 1. In this way, rec_Index and read_Index arrive till the end of the
tableSize and then they stop.

I have no errors in the code, but the "noloop option" doesn't work at all.
I think the problem is related to the select2 in the process function: if I
change the position of "looper_final" and "noloop_final", the noloop option
works good and the other doesn't work.

What am I doing wrong? Is there a more efficient way to implement the
"noloop" function?

Thanks a lot in advance!

Matteo

import("stdfaust.lib");
//================= RECORDER =====================//
//Loop
looper = rwtable(tableSize, 0.0, recIndex, _, readIndex)
with {
    recIndex = (+(1) : %(tableSize)) ~ *(startrecord);
    readIndex = (readSpeed/tableSize : (+ : ma.decimal) ~ _ :
*(float(tableSize)) : int) * startread;
};
readSpeed = hslider ("Read Speed", 1, 0.001, 10, 0.001);
startrecord = button("[3]RECORD") : int;
startread = button("[4]READ") : int;
tableSize = 4*48000; //4 seconds loop

//No Loop
noloop = rwtable(tableSize, 0.0, ba.if (limiter_cycle_rec <=1, rec_Index,
0), _, ba.if (limiter_cycle_read <=1, read_Index, 0))
with {
    //Read_Index_noloop
    read_Index = (readSpeed/tableSize : (+ : ma.decimal) ~ _ :
*(float(tableSize)) : int) * startread;
    counter_read = ba.if (read_Index == (tableSize-1), 1, 0);
    limiter_cycle_read = counter_read : ba.pulse_countup (startread); //It
limits the function to one cycle / reset when button "startread" is
released

    //Rec_Index_noloop
    rec_Index = (+(1) : %(tableSize)) ~ *(startrecord);
    counter_rec = ba.if (rec_Index == (tableSize-1), 1, 0);
    limiter_cycle_rec = counter_rec : ba.pulse_countup (startrecord);
};
//================= EFFECTS =====================//
//Echo
echo(duration,feedback) = hgroup ("[5]Echo",
+~de.delay(50000,del)*(feedback))
with{
  del = duration*ma.SR;
};
duration = hslider("duration echo",0.25,0,1,0.01);
feedback = hslider("feedback",0.5,0,1,0.01);
//Vocoder
gainvoc = 0.95;
select_effect = hslider ("[2]ECHO / VOCODER", 0, 0, 1, 1);

//================= PROCESS =====================//
selectinput = hslider ("[1]LOOP  /  NO LOOP", 0, 0, 1, 1);

looper_final = (((looper : echo (duration, feedback)), (ve.vocoder
(8,0.0005,0.003,0.1, looper, (os.lf_imptrain (120) * gainvoc)))) :
select2(select_effect));

noloop_final = (((noloop : echo (duration, feedback)), (ve.vocoder
(8,0.0005,0.003,0.1, noloop, (os.lf_imptrain (120) * gainvoc)))) :
select2(select_effect));

process = ((looper_final, noloop_final) : select2 (selectinput));

Attachment: Enregistreur_Tablet.dsp
Description: Binary data

_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to