Welcome to %s forums

BrainModular Users Forum

Login Register

Pass data only when 1 ?

I need help on a Patch
Post Reply
kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 01 Oct 2008, 13:27

Hi

I'm having a litle problem to which I don't find a solution.

I have a togle component, which obviously is changing between 0 and 1. At the back of the togle I want to pass only the 1 state to something else. When the output of the togle is 0, I don't want to pass that 0.

Any solutions for that ?

k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

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

Unread post by ethnix73 » 01 Oct 2008, 13:47

Could you explain more precisely what do you want to do?

If you want to pass data only when 1, perhaps you could use a pass event flow module.....
Seb.Dub

kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 01 Oct 2008, 14:04

I'm working on my bar quantisizer and most problems I've allready solved.
Only one litle detail doesn't work.

But I have perhaps complicated the problem to much....

Here is what I have :
- The mechanisme of detecting the end of bar, sends out a 1 when the end of a bar is reached. This works.
- A midi filter which filters the 'note off' messages from my keyboard to the Vsti, works

- Now the problem is that when I receive a note off from my keyboard, I want to delay this note off message until the end of the actual bar is reached.

Perhaps you have better idea to do this ?

thx
k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

moody33
Member
Posts: 338
Contact:

Unread post by moody33 » 01 Oct 2008, 17:43

Midi filter note off -- code 2 pin to a Create Midi Message(note off) module ( code2 pin ).
Then at the end of bar, send a 1 value into the create pin of the Create midi message module.
The last note off send should be sent at the end of your bar.
Of course, your midi message is MONO !

Be careful because if you don't send midi note off message, the last midi note off message will be send each time the end of bar is reach. So you have to find a solution. But I don't know what you want exactly so...it's up to you.

Sorry for my english;

kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 01 Oct 2008, 18:11

Thanks Moody
The first part I figured out.
The second part is my big problem. If i don't release a key, the last midi note off is still send at the end of the bar ! Bugger...

k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

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

Unread post by bsork » 02 Oct 2008, 07:59

What about some kind of counter? NoteOns adds 1, NoteOffs subtracts 1, and then check whether the result is 0, and which case the NoteOff is created. The best solution IMO, however, would be a small script that stores the NoteOffs until a trigger is received and the messages output. This would work with polyphonic stuff as well.

BTW, about the question of not sending a 0: The "block" switch on the math/logical modules should do just that, if I have understood things correctly. I can't really remember that I have ever used it though. When you're creating triggers (akin to buttons), the best thing in my experience is always to produce a 1 when the trigger is supposed to - ahem - trigger, immediately (ie in the next execution block) followed by a 0.
Bjørn S

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

Unread post by bsork » 02 Oct 2008, 08:54

Here's a little script that accumulates MIDI messages until a trigger is received:

Code: Select all

VAR pIn, pOut, pFlush : tParameter;
VAR tmp : tMidi;
VAR arr : ARRAY OF tMidi;
VAR len, num, i : integer;

PROCEDURE init;
BEGIN
   pIn := CreateParam('midi in', ptMidi); SetIsOutput(pIn, FALSE);
   pOut := CreateParam('midi out', ptMidi); SetIsInput(pOut, FALSE);
   pFlush := CreateParam('flush', ptButton); SetIsOutput(pFlush, FALSE);

   SetArrayLength(arr, 512);
END;

// main
BEGIN
  len := GetLength(pIn);
  FOR i := 0 TO (len - 1) DO BEGIN
     GetMidiArrayValue(pIn, i, tmp);
     arr[num] := tmp;
     num := num + 1;
  END;
  IF (GetValue(pFlush) = 1) THEN BEGIN
     SetLength(pOut, num);
     FOR i := 0 TO (num - 1) DO
       SetMidiArrayValue(pOut, i, arr[i]);
     num := 0;
     SetValue(pFlush, 0);
  END
  ELSE BEGIN
     SetLength(pOut, 0);
  END;
END.
In your case, you should only send NoteOffs to the script, and connect the end-of-bar trigger to the flush input. It has NOT been tested much...
Bjørn S

kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 02 Oct 2008, 10:34

Wow Bjorn, i'm impressed !
It works exactly as I wanted

Great, thanks !

k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

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

Unread post by bsork » 02 Oct 2008, 10:48

:cool: We aim to please... ;)
Bjørn S

kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 02 Oct 2008, 11:31

bsork wrote::cool: We aim to please... ;)
Beside the software itself, propably the best thing about Usine, the support here is great !

k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

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

Unread post by senso » 02 Oct 2008, 11:51

you're a master Bsork!

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 22 Oct 2008, 07:00

I have one question, Bsork:

How would I modify this to work with a full data stream, not just note offs? What does the test for a note-off look like??

midiIn.msg = NOTEOFF //???

Constants for the msg types would be helpful in the help file, but I can't find anywhere in the scripts where anybody is testing for it--and I would expect a test for notes in both the transpose and the splitting scripts.

Thanks for any tips!
-eric
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

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

Unread post by bsork » 22 Oct 2008, 08:02

Hi, yesterday I started on a script like that; check for missing NoteOffs and Sustain off with a trigger to send them when needed. Got into some technical problems I think is related to my Firewire port, so I didn't manage to finish it before bedtime.

I think I might have pointed you in the wrong direction when I used that script as an example. It is relatively new, it does something similar, and it's quite short and shouldn't be too hard to understand, so I thought it was a good idea to start there.
Sorry.

The script I'm doing uses arrays of booleans to keep track of the status of every note in every channel. It also keeps track of the min/max note number used per channel to reduce the CPU drain when the offs are sent. I don't have it here (at work...), or else I could've posted it in it's present state.

AFAIK, the list of constants that I'm sure is part of Usine's source code, isn't available within scripts, so either create your own constants or just use the figures. You're probably aware of this already, but tables of MIDI messages can be found at http://www.midi.org/techspecs/midimessages.php, and I guess some thousands of other places on the net.
Bjørn S

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 22 Oct 2008, 08:35

Cool. I'm curious to see your code. I've got some good basic midi routing stuff working (so much easier than cabling things together) but got a little stumped trying to keep track of noteoffs. I was trying to keep an array of outstanding notes, and search through it, but an array of booleans is a much cleaner implementation.

Didn't know if the scripting language even had booleans. That's good to know. Did figure out logic ('&' and '|' weren't compiling)

I need to search through these archives for more samples.... the examples are all really basic scripts, but don't contain much logic.

Found midi codes at the back of the Usine manual!

Thanks, as always!
-eric
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

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

Unread post by bsork » 22 Oct 2008, 23:20

@Eric: I've uploaded the script in the add-ons under Midi Tools. Couldn't find a better name than ClearMidiNotes, though. :(
Bjørn S

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 23 Oct 2008, 01:10

wow, thanks, I am very excited to check it out!!!!

-e
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 23 Oct 2008, 05:58

OKAY NOW!!!

Wow, that's a total education! Thanks SO MUCH, Bsork. Now I know how to create and call procedures, create data types, use booleans, do multiline comments, etc, etc.

I'm very excited to be able to do this kind of work in a scripting environment, and keeping the cabling from getting totally crazy ala reaktor.

Can't wait! No sleep tonight!

-e
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

Post Reply

Who is online

Users browsing this forum: No registered users and 127 guests