Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

a trigger switching an int from 1 to 0 and then to 1 again

For general discussion related FlowStone

a trigger switching an int from 1 to 0 and then to 1 again

Postby aombk » Thu Jun 02, 2016 11:01 pm

ok i need help with that.

i want to press a button(trigger) that mutes the signal chain for three seconds

i am thinking of doing it with a button, a timer component, ruby code that changes an int (or bool) output when triggered and a selector component. (does this make sense or shall i attach a flowstone module?)

i dont know how to do that in ruby. is this doable? can someone help with that?

also, is there a better way to do this?

thanks
User avatar
aombk
 
Posts: 34
Joined: Tue May 24, 2016 2:44 pm
Location: athens, greece

Re: a trigger switching an int from 1 to 0 and then to 1 aga

Postby Tronic » Fri Jun 03, 2016 1:23 am

this audio code crude mute the input for an N samples,
any new value in the trig input active the mute.

Code: Select all
streamin in;
streamin trig; // any new value generate un trig
streamin nSample; // mute the in for nr sample
streamout out;

float mute= 0;
float wait = 0;
float oldtrig=0;

wait = wait - (wait & (oldtrig!=trig));
wait = wait + (1 & (wait<nSample));
mute = (wait >= nSample);
out = in & mute;
oldtrig = trig;
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: a trigger switching an int from 1 to 0 and then to 1 aga

Postby aombk » Fri Jun 03, 2016 3:00 am

thanks.
i seem to have a problem though.
i cannot connect the output of a trigger to the dsp input. should they be connectable?
User avatar
aombk
 
Posts: 34
Joined: Tue May 24, 2016 2:44 pm
Location: athens, greece

Re: a trigger switching an int from 1 to 0 and then to 1 aga

Postby tulamide » Fri Jun 03, 2016 3:19 am

As Tronic explained in the code, the trig is generated from a value change. So just input a float, int or boolean. Everytime you change their value, the code mutes audio and starts the timer to unmute after N samples. The 'counter'-prim would be a good start.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: a trigger switching an int from 1 to 0 and then to 1 aga

Postby aombk » Fri Jun 03, 2016 4:47 am

ok thanks.
meanwhile i figured how to do it with ruby too by using this code:

Code: Select all
def event i,v
     if i=="tr1" then output 0 end
     if i=="tr2" then output 1 end
end


and then multiply the ruby output with the stream.

i also tried the tronics code with a counter and it works
shall i use dsp code instead of ruby? is it better?
User avatar
aombk
 
Posts: 34
Joined: Tue May 24, 2016 2:44 pm
Location: athens, greece


Return to General

Who is online

Users browsing this forum: Google [Bot] and 81 guests