Welcome to %s forums

BrainModular Users Forum

Login Register

hold event

Tell us what you'd like Usine to do
Post Reply
gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 22 Sep 2010, 09:28

I have many good uses for an events control module similar to the way the smooth module timer works that would take the last input value and hold it for a set amount of time , then when the value 'hold' has timed out the module would send a user definable 'reset value'.

One more option for the module could be to reset the timer every time a new value was received or else play the entire 'last value', ignoring any new input values untill timed out.

I'm sure this is patchable but I think this function in a single module would be very usefull.

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 22 Sep 2010, 09:39

maybe a script or a user module...? ( do you hear the call , gurus..? :-)) )

ethnix73
Member
Posts: 604
Location: France, Caen
Contact:

Unread post by ethnix73 » 22 Sep 2010, 10:07

hehe!

This would be really useful gurulogic, agree with you...for myself, It's the main difficulty with monome and launchpad.
Seb.Dub

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 22 Sep 2010, 10:59

Something like this?

Code: Select all

VAR pInValue, pOutValue, pResetValue, pHoldTime, pIgnoreWhileHold : tParameter;
VAR lastTime : Single;
VAR holding : Boolean;

PROCEDURE Init;
BEGIN
   pInValue := CreateParam('value in', ptDataField); SetIsOutput(pInValue, FALSE);
   pOutValue := CreateParam('value out', ptDataField); SetIsInput(pOutValue, FALSE);
   pResetValue := CreateParam('reset value', ptDataField); SetIsOutput(pResetValue, FALSE);
   
   pHoldTime := CreateParam('hold time', ptDataFader); SetIsOutput(pHoldTime, FALSE);
   SetSymbol(pHoldTime, 'ms');
   SetMin(pHoldTime, 0); SetMax(pHoldTime, 10000);

   pIgnoreWhileHold := CreateParam('ignore new', ptSwitch); SetIsOutput(pIgnoreWhileHold, FALSE);

   holding := FALSE;
END; // Init

PROCEDURE Callback(n : Integer);
BEGIN
   IF (n = pInvalue) THEN BEGIN
      IF ((GetValue(pIgnoreWhileHold) = 0) OR (NOT holding)) THEN BEGIN
         SetValue(pOutValue, GetValue(pInValue));
         lastTime := TimeMs;

         holding := TRUE;
      END;
   END;
END; // Callback

PROCEDURE Process;
BEGIN
   IF ((holding) AND ((TimeMs - lastTime) >= GetValue(pHoldTime))) THEN BEGIN
      SetValue(pOutValue, GetValue(pResetValue));
      holding := FALSE;
   END;
END; // Process
Bjørn S

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 22 Sep 2010, 11:24

Ask and ye shall receive! Seems to work fine, thanks!
Not to look a gift horse in the mouth but would a version that worked with midi be too hard to adapt from this? I presume the reset value would be a midi note off for the current note out, or alternativly a 'stop' outlet that could trigger a create midi module.

Either way, this is going in my 'very usefull' folder ~:>)

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 22 Sep 2010, 11:36

Shouldn't be too hard to implement for MIDI, but IIRC there's already something similar (at least for note messages) in the MIDI Utility pack. Check it out, I don't have time now.
Bjørn S

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 22 Sep 2010, 11:44

Cool, will check...
I think the above script should definately be bundled with the next usine update. So very usefull!!!

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 22 Sep 2010, 12:48

great ! thanks sir bsork !
I've yet found utility to this one too !

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Sep 2010, 12:56

sorry im not at all questionning the utility of this, im sur there are plenty.

but just by curiosity, any exemple application?

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 22 Sep 2010, 13:25

I'm also a bit curious as to what you're using it for... :)

Enlighten us!
Bjørn S

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 22 Sep 2010, 15:54

i know i can do the same with pass and others but it's the first idea i've had :
a slow random generator for drone or pads..

Image

noise2sine
Member
Posts: 458
Contact:

Unread post by noise2sine » 22 Sep 2010, 16:45

I 've heard : slow random generator for drones ?!!? i want to test it !!!!!!!!!!

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 22 Sep 2010, 16:53

mm oh yeah i see the idea thanks nay, the fact to ' ignore new ' provide kind of quantized/reduce/stepped data out of the box,
othewise yes a pass with clock would do about the same, btw more handy on on only one module.
curious about guru and ethnix uses also...i guess they were after the reset value too, but what for??

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 22 Sep 2010, 23:35

Hmmm... my mind goes blank when looking for examples ;) Lets see.... how about modulating individual step durations or creating random evolving value mutations...?

Generally I see being able to hold values open in a 'gate' fashion as a utilty kind of thing.
One example that I have put into immediate use is that when I send Usine a SAVE_PATCH command, I need to ensure the patch is saved with a audio bus names that aren't in use when the patch loads, so when I press save, the bus names change to 'x', the patch saves and then after the set duration the bus names are set back to normal. If I like I could use the reset value to trigger the next patch to save using the same conditions... Probably coulda patched this some other way but this was nice n' easy.

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 23 Sep 2010, 00:13

yeah that make sense thanks. indeed that avoid the use of several counters, pass, affect or freez event things, having two values and timer directly, ill have to remember that ;)

ethnix73
Member
Posts: 604
Location: France, Caen
Contact:

Unread post by ethnix73 » 23 Sep 2010, 21:07

After testing you script bsork, it was [not] totally what i had in mind.

Maybe i'had read the first guru message too fast :rolleyes:

Anyway, may be usefull, thanks!
Seb.Dub

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 23 Sep 2010, 21:24

great job bsork!!!

for info the 'math/variable' and 'math/multipleVariable' are kind of 'hold event' but without time management.

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 23 Sep 2010, 22:08

Yes - I don't htink it would be hard to patch the same thing.
Bjørn S

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 23 Sep 2010, 22:31

a script version will always be more efficient in CPU.
the main drawback of scrips is that it generally take more memory than it should.
That's why I prepare the concept of 'compiled script'. It will be a script but without any possible modification. Much more light...

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 23 Sep 2010, 23:08

wow that sound cool that!!

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 24 Sep 2010, 00:02

More efficient?!? Wow - things have changed more than I thought!
Bjørn S

multiphone
Member
Posts: 303
Contact:

Unread post by multiphone » 24 Sep 2010, 14:12

After scratching my head a few minutes wondering what Guru was doing with this script... and afer Nay patch inspiration...I found an application to move the sounds in space.

The movement are quite interesting and unexpected.

Image

Not to bad

Best...
HB

Lines / Points / Squares

http://www.hervebirolini.com/

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 24 Sep 2010, 16:59

bsork wrote:More efficient?!? Wow - things have changed more than I thought!
Yes especially if most of the code is in the Callback procedure.
Actually there is a bottle neck, in multicore CPU: only one script can be executed at the same time. but will disappear in the 5.30

multiphone
Member
Posts: 303
Contact:

Unread post by multiphone » 24 Sep 2010, 17:52

First words is :

"Ho ! My God ! "

This 5.3 are dream !

Best
HB

Lines / Points / Squares

http://www.hervebirolini.com/

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 24 Sep 2010, 18:01

wow wow 5.3 seems raising even higher levels..can't wait..

Post Reply

Who is online

Users browsing this forum: No registered users and 63 guests