Welcome to %s forums

BrainModular Users Forum

Login Register

I need a script to filter CC number out.

I need help on a Patch
Post Reply
moody33
Member
Posts: 338
Contact:

Unread post by moody33 » 28 Feb 2011, 17:35

Hi !

I need a script that stops defined control change messages. I know it's possible with patches but, I've a huge list to edit and several copy of the patch itself cause a too important cpu load. i don't know anything in scripting so I guess if one of you could build one easily?

So:

-1 midi input:
-several inlets (user defined internally) to set the control messages number to filter.
-1midi ouput to pass defined control messages
-1midi output to pass other control messages.

Thanks !

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 28 Feb 2011, 20:27

hi moody, i can try to have a look for this
just wondering the best way to enter CCs, as i think this way the script will have a predefined fixed nb of pins, (althougt it can be edited as a variable in the script, then recompiled for more pins/ccs, but not sure a query is possible to define nb of in/outs of scripts without loosing pre-entered datas, i feel not if correctly remember.. )

so would some array or commatext input do the job for you?, might be more modular and optimized... then just have to plug an array editor as input and enter desired CCs, or a listbox , but second way will hit a bit more cpu, but maybe more user friendly too.
will investigate booth and let you know anyway..

aaah, back to what i missed the most, my beloved usine :P

moody33
Member
Posts: 338
Contact:

Unread post by moody33 » 28 Feb 2011, 21:23

Nice to help me ! :)

The best solution for me is to have modularity regarding the number of entry pin and of course, to have the best friendly CPU script as possible, so I think enter value with a set of array values is a very good idea !

I'm also happy to come back to usine ! I didn't found any equivalent software !

Thanks you very much for your help ! :D

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 28 Feb 2011, 22:39

moody, have a boo at the pizmidi collection. Usine can usually do almost anything with some work but sometimes it's easier to have some specific tools on hand for the job and it sounds like these might be usefull for you.
http://www.thepiz.org/plugins/?p=pizmidi

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 28 Feb 2011, 23:03

yup pizmidi is a nice set.

i ve made a first try with usine script, not perfect yet as it seems i got a pb with polyphony if sub-bloc rates, but works for slow changes, enter CC in an array of any size,(using 0...127 values) on input and then it splits into two midi outs.
will try to fix it and post new version later..

Code: Select all

///////////////////////////////////
// SPLIT CCS ____23FX_08/2K11     
//////////////////////////////////////////////////////////
// splits CCs according to a list Array to 2 midi outputs.
// if incoming midi contain a cc existing in the list, 
// it goes to reject_midi out, all other ccs go to pass_midi out.
// list can be an array of any size, but use 0-127 integers.
////////////////////////////////////////////////////////////
var MIDI_IN, MIDI_PASS, MIDI_REJECT : Tparameter;
var CCS_IN : Tparameter;
var nbOfMemoMidi : integer;
var MemoMidi : array of TMidi;
var nbOfMidi    : integer;
var Miditmp      : TMidi;
var i,j            : integer;
var send, reject : boolean;
////////////////////////
procedure init;
begin  
MIDI_IN:= CreateParam('Midi_IN',PtMidi); setisOutput(MIDI_IN,false);
CCS_IN := CreateParam('CCS_IN',PtArray); setisOUTput(CCS_IN,false);
setMin(CCS_IN,0); setMax(CCS_IN,127);
MIDI_PASS  := CreateParam('Midi_PASS',PtMidi); setisINput(MIDI_PASS,false);
MIDI_REJECT:= CreateParam('Midi_REJECT',PtMidi); setisINput(MIDI_REJECT,false);
 nbOfMemoMidi := 0;
 setArraylength(MemoMidi,128);
end;
//////////////////////////
// Callback procedure
Procedure Callback(N:integer); 
begin
  if (n= MIDI_IN) then begin
 SetLength(MIDI_PASS,0);
 SetLength(MIDI_REJECT,0);
     nbOfMidi := GetLength(MIDI_IN);
     if (nbOfMidi > 0) then begin
        for i := 0 to nbOfMidi-1  do begin
            GetMidiArrayValue(MIDI_IN,i,Miditmp);  
            MemoMidi[nbOfMemoMidi+i] := Miditmp;
        end;
     nbOfMemoMidi :=  nbOfMemoMidi + NbOfMidi;
    end;
  end;

 if (nbOfMemoMidi > 0) then begin
    GetMidiArrayValue(MIDI_IN,nbOfMemoMidi-1,Miditmp); 
      for i := 0 to nbOfMidi-1 do begin
      send:=TRUE;
            for j :=0 to getLength(CCs_IN)-1 do begin
            if getDataArrayValue(CCs_IN,j)= midiTmp.data1 then begin
            send:=FALSE;
            end;
       end;
    if send=true then begin
       SetMidiArrayValue(MIDI_PASS,i,Miditmp); 
       SetLength(MIDI_PASS,nbOfMidi); 
      end else begin
       SetMidiArrayValue(MIDI_REJECT,i,Miditmp);
       SetLength(MIDI_REJECT,nbOfMidi);  
     end;
 end;
    nbOfMemoMidi := nbOfMemoMidi-1;
 end;

END;//CB
/////////////

moody33
Member
Posts: 338
Contact:

Unread post by moody33 » 28 Feb 2011, 23:05

Thanks you guru!

But, there is three reasons that I prefer to avoid using external vst or extra stuff:

The first one, is creativity , challenging, and community. So, why not having another useful script/patch for the addon collection if somebody can do it ? ( I know , I can't do the job with script ! :). If usine can do it, so do it , share it and make usine an all in one audio/midi software with all the tools needed !

The second reason: I don't no more want to deal with external stuff. I want a clear setup , just using usine and my hardware. This point concern only what I have in mind regarding my setup and I actually use usine only for midi (but I plan to use it for audio in a near future ).

The third reason, is simply because I'm also thinking about the future. senso has talk about a mac version, so, I don't want in a near or far future having to deal with incompatibility. Just want to open the project, press play, and say, wow ! "It sounds good, let's have some fun playing with this workspace ! " Time is precious, and each time you are in a situation where you have technical problems, it's a time where inspiration go far away and never appear again. So, I want to resolve technical problems now ! :P

However thanks you for your help ;)

@23fx23 Thanks a lot !!!!!!!! I test your script in a minute and give you my feedback !

moody33
Member
Posts: 338
Contact:

Unread post by moody33 » 28 Feb 2011, 23:21

@23fx23

You are a master !

I've try it and it seems to work like a charm when I send a controller snapshot. Just have to activated the "unpack" midi switch, and , yep ! Great , great , great , great ! I don't made test with the poly mode however.

Thanks you a lot !!!

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 28 Feb 2011, 23:29

ok cool, :)
yup unpack will force the data to be send bloc after bloc so it will work cool as a workaround with actual version and should be
ok in most cases i think.

will let you know if i can improve the poly stuff, i know it's weird actually but a bit more brainy than it seems for me ;)
i don't master midi in script yet as bsork or few others but i want to study back the question...

Post Reply

Who is online

Users browsing this forum: No registered users and 75 guests