ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2012-06-22T17:45:05+02:00 https://brainmodular.com/forums/app.php/feed/topic/3489 2012-06-22T17:45:05+02:00 2012-06-22T17:45:05+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23727#p23727 <![CDATA[Midi Harmonizer]]> thanks a lot !

Statistics: Posted by nay-seven — 22 Jun 2012, 17:45


]]>
2012-06-22T16:46:09+02:00 2012-06-22T16:46:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23724#p23724 <![CDATA[Midi Harmonizer]]> http://www.sensomusic.com/forums/upload ... onizer.wkp

Corrected a scale mistake in the chord database.
Added a 'key feedback' switch on the note scaler.
Added a chord player and a arppegio player with modulated speed.

I'm near to upload it in the addons, so all suggestions are welcome!

Statistics: Posted by Fléau — 22 Jun 2012, 16:46


]]>
2012-06-18T15:46:22+02:00 2012-06-18T15:46:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23708#p23708 <![CDATA[Midi Harmonizer]]> Statistics: Posted by damstraversaz — 18 Jun 2012, 15:46


]]>
2012-06-18T15:18:09+02:00 2012-06-18T15:18:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23707#p23707 <![CDATA[Midi Harmonizer]]> Statistics: Posted by bsork — 18 Jun 2012, 15:18


]]>
2012-06-18T14:49:22+02:00 2012-06-18T14:49:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23706#p23706 <![CDATA[Midi Harmonizer]]> I have an issue with the dec2bin module, which is not find by usine in the modules folder. does it need a additionnal pack ?
best,
Damien

Statistics: Posted by damstraversaz — 18 Jun 2012, 14:49


]]>
2012-06-17T17:57:50+02:00 2012-06-17T17:57:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23700#p23700 <![CDATA[Midi Harmonizer]]> Here is the new version with the chord detector:

download:http://www.sensomusic.com/forums/upload ... onizer.wkp

Image

Next step is isolating chords according to a scale and play them,
vice versa, and then play arpeggio.

Statistics: Posted by Fléau — 17 Jun 2012, 17:57


]]>
2012-06-15T23:57:48+02:00 2012-06-15T23:57:48+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23695#p23695 <![CDATA[Midi Harmonizer]]>

CODE:

CONST BUFFER_SIZE = 128;// MIDI channel messagesCONST NOTEOFF = Byte&#40;128&#41;;CONST NOTEON  = Byte&#40;144&#41;;TYPE tMidiArr = ARRAY OF tMidi;TYPE tNoteOns = RECORD        origChannel &#58; Byte;        origNoteNo  &#58; Byte;        outChannel  &#58; Byte;        outNoteNo   &#58; Byte;     END;VAR pMidiIn, pMidiOut1 &#58; tParameter;VAR pTranspose, pNumNotes &#58; tParameter;VAR sentNoteOns &#58; ARRAY OF tNoteOns;VAR numIn, numSentNoteOns, numOut1 &#58; Integer;VAR transpose &#58; Integer;PROCEDURE Init;   VAR i &#58; Integer;BEGIN   pMidiIn &#58;= CreateParam&#40;'midi in', ptMidi&#41;; SetIsOutput&#40;pMidiIn, FALSE&#41;;   pMidiOut1 &#58;= CreateParam&#40;'midi out', ptMidi&#41;; SetIsInput&#40;pMidiOut1, FALSE&#41;;   pTranspose &#58;= CreateParam&#40;'transpose', ptDataFader&#41;; SetIsOutput&#40;pTranspose, FALSE&#41;;   SetMin&#40;pTranspose, -48&#41;; SetMax&#40;pTranspose, 48&#41;;   SetFormat&#40;pTranspose, '%.0f'&#41;; SetSymbol&#40;pTranspose, 'sm'&#41;;   pNumNotes &#58;= CreateParam&#40;'num notes', ptDataField&#41;; SetIsInput&#40;pNumNotes, FALSE&#41;;   SetArrayLength&#40;sentNoteOns, BUFFER_SIZE&#41;;   numSentNoteOns &#58;= 0;   numOut1 &#58;= 0;END; // InitFUNCTION IsNoteOn &#40;currMsg &#58; tMidi&#41; &#58; Boolean;BEGIN   IsNoteOn &#58;= &#40;&#40;currMsg.msg = NOTEON&#41; AND &#40;currMsg.data2 > 0&#41;&#41;;END;FUNCTION IsNoteOff &#40;currMsg &#58; tMidi&#41; &#58; Boolean;BEGIN   IsNoteOff &#58;= &#40;currMsg.msg = NOTEOFF&#41; OR &#40;&#40;currMsg.msg = NOTEON&#41; AND &#40;currMsg.data2 = 0&#41;&#41;;END;PROCEDURE CreateOut&#40;currMsg &#58; tMidi&#41;;BEGIN   SetMidiArrayValue&#40;pMidiOut1, numOut1, currMsg&#41;;   numOut1 &#58;= numOut1 + 1;END; // CreateOutPROCEDURE CreateNoteOnOut&#40;origMsg, outMsg &#58; tMidi&#41;;   VAR curr &#58; tNoteOns;BEGIN   WITH curr DO BEGIN      origChannel &#58;= origMsg.channel;      origNoteNo  &#58;= origMsg.data1;      outChannel  &#58;= outMsg.channel;      outNoteNo   &#58;= outMsg.data1;   END;   sentNoteOns&#91;numSentNoteOns&#93; &#58;= curr;   numSentNoteOns &#58;= numSentNoteOns + 1;   CreateOut&#40;outMsg&#41;;END; // CreateNoteOnOutPROCEDURE CheckSendNoteOff&#40;currMsg &#58; tMidi&#41;;   VAR i, j &#58; Integer;   VAR outMsg &#58; tMidi;   VAR curr &#58; tNoteOns;BEGIN   j &#58;= 0;   FOR i &#58;= 0 TO &#40;numSentNoteOns - 1&#41; DO BEGIN      curr &#58;= sentNoteOns&#91;i&#93;;      IF &#40;&#40;currMsg.channel = curr.origChannel&#41; AND &#40;currMsg.data1 = curr.origNoteNo&#41;&#41; THEN BEGIN         outMsg.msg     &#58;= currMsg.msg;         outMsg.channel &#58;= curr.outChannel;         outMsg.data1   &#58;= curr.outNoteNo;         outMsg.data2   &#58;= currMsg.data2;         CreateOut&#40;outMsg&#41;;         j &#58;= j + 1;      END      ELSE BEGIN         sentNoteOns&#91;i - j&#93; &#58;= curr;      END;   END;   numSentNoteOns &#58;= numSentNoteOns - j;END; // CheckSendNoteOffPROCEDURE CheckInput&#40;currMsg &#58; tMidi&#41;;   VAR newMsg &#58; tMidi;BEGIN   newMsg &#58;= currMsg;   IF &#40;IsNoteOn&#40;currMsg&#41;&#41; THEN BEGIN      newMsg.data1 &#58;= newMsg.data1 + transpose;      CreateNoteOnOut&#40;currMsg, newMsg&#41;;   END   ELSE IF &#40;IsNoteOff&#40;currMsg&#41;&#41; THEN      CheckSendNoteOff&#40;currMsg&#41;;   SetValue&#40;pNumNotes, numSentNoteOns&#41;;END; // CheckInputPROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN   CASE n OF      pMidiIn    &#58; numIn     &#58;= GetLength&#40;n&#41;;      pTranspose &#58; transpose &#58;= round&#40;GetValue&#40;n&#41;&#41;;   END;END; // CallbackPROCEDURE Process;   VAR i &#58; Integer;   VAR currMsg &#58; tMidi;BEGIN   FOR i &#58;= 0 TO &#40;numIn - 1&#41; DO BEGIN      GetMidiArrayValue&#40;pMidiIn, i, currMsg&#41;;      CheckInput&#40;currMsg&#41;;   END;   SetLength&#40;pMidiOut1, numOut1&#41;;   numOut1 &#58;= 0;END; // Process
There are still bits and pieces of the code left that could be removed.

Statistics: Posted by bsork — 15 Jun 2012, 23:57


]]>
2012-06-15T15:12:13+02:00 2012-06-15T15:12:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23692#p23692 <![CDATA[Midi Harmonizer]]>

CODE:

SetValue&#40;voices, nbOfMidi &#41;;
This will assign the value of nbOfMidi to the parameter called voices

I do not think this will not work as you hope though as nbOfMidi will only be greater than zero for the actual BLOC (e.g 64, 128 samples etc) that you receive the MIDI messages in. After that it will go back to zero. It will not give you the number of actual MIDI messages currently switched on.

Statistics: Posted by caco — 15 Jun 2012, 15:12


]]>
2012-06-15T14:50:50+02:00 2012-06-15T14:50:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23691#p23691 <![CDATA[Midi Harmonizer]]>

CODE:

var input   &#58; Tparameter;var output  &#58; Tparameter;var transpo &#58; TParameter;var voices  &#58; TParameter;procedure init;begin   Input &#58;= CreateParam&#40;'In',ptMidi&#41;; Output &#58;= CreateParam&#40;'Out',ptMidi&#41;; transpo &#58;= CreateParam&#40;'transpo',ptDataFader&#41;; voices &#58;= CreateParam&#40;'voices',ptDatafield&#41;; SetIsInput&#40;Output,false&#41;; SetIsOutPut&#40;Input,false&#41;; SetIsOutPut&#40;transpo,false&#41;; SetFormat&#40;transpo,'%.0f'&#41;; SetIsInput&#40;voices,false&#41;; SetMin&#40;transpo,-24&#41;; SetMax&#40;transpo,24&#41;;end;var i            &#58; integer;var nbOfMidi     &#58; integer;var ReceivedMidi &#58; TMidi;var TranspoVal   &#58; single;//////////////////////////////// main proc//////////////////////////////procedure Process;begin nbOfMidi &#58;= GetLength&#40;input&#41;;  // get the number of incoming midi codes  if nbOfMidi > 0  then begin    SetLength&#40;outPut,nbOfMidi&#41;;      // set the number of output codes    transpoVal &#58;= getValue&#40;transpo&#41;; // get the transpo value    for i &#58;= 0 to nbOfMidi-1         // loop for all input codes, for polyphonic data &#40;chords&#41;    do begin      GetMidiArrayValue&#40;input,i,ReceivedMidi&#41;; // get each code      ReceivedMidi.data1 &#58;= ReceivedMidi.data1+trunc&#40;transpoVal&#41;; // calculate transpo      SetMidiArrayValue&#40;output,i,ReceivedMidi&#41;; // set output value         end; end  else SetLength&#40;outPut,0&#41;; // nothing received, set out length to 0end;
I added:
var voices : TParameter;
voices := CreateParam('voices',ptDatafield);
SetIsInput(voices,false);

i'd like to get
voices := nbOfMidi; (number of note on)
tried to place this line everywhere in the process but nothing happen,
what i'm doing wrong?

Statistics: Posted by Fléau — 15 Jun 2012, 14:50


]]>
2012-06-15T12:06:17+02:00 2012-06-15T12:06:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23689#p23689 <![CDATA[Midi Harmonizer]]>

Statistics: Posted by caco — 15 Jun 2012, 12:06


]]>
2012-06-14T23:23:55+02:00 2012-06-14T23:23:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23683#p23683 <![CDATA[Midi Harmonizer]]>

Here it is:

CODE:

////////////////////////////////////////////////////////////////////////////////// ArrayFind.script// Returns the array index where array B is first found in array A, with an// optional start index for array A. If no matches, the result is -1.//// The returned index in A is the "real" index; the start offset is not // subtracted from the result.//// bSork, V2 June 2012////////////////////////////////////////////////////////////////////////////////VAR pArrA, pStartA, pArrB, pResult &#58; tParameter;PROCEDURE Init;BEGIN   pArrA &#58;= CreateParam&#40;'array A', ptArray&#41;; SetIsOutput&#40;pArrA, FALSE&#41;;   SetMin&#40;pArrA, -1000000000&#41;;    SetMax&#40;pArrA, +1000000000&#41;;   pStartA &#58;= CreateParam&#40;'start index A', ptDataFader&#41;; SetIsOutput&#40;pStartA, FALSE&#41;;   SetMin&#40;pStartA, 0&#41;; SetMax&#40;pStartA, 8191&#41;; SetFormat&#40;pStartA, '%.0f'&#41;;   SetDefaultValue&#40;pStartA, 0&#41;;   pArrB &#58;= CreateParam&#40;'array B', ptArray&#41;; SetIsOutput&#40;pArrB, FALSE&#41;;   SetMin&#40;pArrB, -1000000000&#41;;    SetMax&#40;pArrB, +1000000000&#41;;   pResult &#58;= CreateParam&#40;'result', ptDataField&#41;; SetIsInput&#40;pResult, FALSE&#41;;   SetMin&#40;pResult, -1&#41;; SetMax&#40;pResult, 8191&#41;; SetFormat&#40;pResult, '%.0f'&#41;;   SetValue&#40;pResult, 0&#41;;END; // InitPROCEDURE Find;   VAR lenA, lenB &#58; Integer;   VAR r, a, a2, b &#58; Integer;   VAR bx &#58; Single;   VAR found &#58; Boolean;BEGIN   r &#58;= -1;   lenB &#58;= GetLength&#40;pArrB&#41;;   IF &#40;lenB > 0&#41; THEN BEGIN      b &#58;= 0;      bx &#58;= GetDataArrayValue&#40;pArrB, b&#41;;      a &#58;= round&#40;GetValue&#40;pStartA&#41;&#41;;      lenA &#58;= GetLength&#40;pArrA&#41;;      WHILE &#40;&#40;r = -1&#41; AND &#40;&#40;lenA - a&#41; >= lenB&#41;&#41; DO BEGIN         found &#58;= &#40;bx = GetDataArrayValue&#40;pArrA, a&#41;&#41;;         IF &#40;found&#41; THEN BEGIN            a2 &#58;= a + 1;            b &#58;= 1;         END;         WHILE &#40;found AND &#40;b < lenB&#41;&#41; DO BEGIN            found &#58;= &#40;GetDataArrayValue&#40;pArrA, a2&#41; = GetDataArrayValue&#40;pArrB, b&#41;&#41;;            a2 &#58;= a2 + 1;            b &#58;= b + 1;         END;         IF &#40;found AND &#40;b = lenB&#41;&#41; THEN            r &#58;= a         ELSE            b &#58;= 0;         a &#58;= a + 1;      END;   END;   SetValue&#40;pResult, r&#41;;END; // FindPROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN   IF &#40;n <= pArrB&#41; THEN      Find;END; // Callback
Hope it works for you!

I'll replace the old one in the add-ons as well.

Statistics: Posted by bsork — 14 Jun 2012, 23:23


]]>
2012-06-14T11:40:53+02:00 2012-06-14T11:40:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23662#p23662 <![CDATA[Midi Harmonizer]]>
I think, however, that I can make the script somewhat more efficient by doing things in another order. Will probably do it tonight.

Statistics: Posted by bsork — 14 Jun 2012, 11:40


]]>
2012-06-14T11:21:37+02:00 2012-06-14T11:21:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23660#p23660 <![CDATA[Midi Harmonizer]]>
@Fléau - The scripting language used is based on Delphi.

Statistics: Posted by caco — 14 Jun 2012, 11:21


]]>
2012-06-14T10:19:58+02:00 2012-06-14T10:19:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23659#p23659 <![CDATA[Midi Harmonizer]]>
BEGIN
r := -1;
IF (((lenA - startA) >= lenB) AND (lenB > 0)) THEN BEGIN
b := 0;
// bx := GetDataArrayValue(pArrB, b); THIS LINE (42 i think)
FOR a := startA TO (lenA - 1) DO BEGIN
ax := GetDataArrayValue(pArrA, a);
bx := GetDataArrayValue(pArrB, b); HAD TO BE PLACED HERE
IF (ax = bx) THEN BEGIN
IF (b = 0) THEN r := a;
b := b + 1;
IF (b = lenB) THEN BREAK;
bx := GetDataArrayValue(pArrB, b);
END
ELSE BEGIN
b := 0;
r := -1;
END;
IF ((lenA - a - 1) < (lenB - b)) THEN BEGIN
r := -1;
BREAK;
END
END;
END;
SetValue(pResult, r);
doFind := FALSE;
END; // Find
Need to learn scripting,
what is the used language?

Statistics: Posted by Fléau — 14 Jun 2012, 10:19


]]>
2012-06-14T00:19:01+02:00 2012-06-14T00:19:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23657#p23657 <![CDATA[Midi Harmonizer]]>
If anyone else feels compelled to have a go at it - please do!

Statistics: Posted by bsork — 14 Jun 2012, 00:19


]]>
2012-06-13T15:56:34+02:00 2012-06-13T15:56:34+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23654#p23654 <![CDATA[Midi Harmonizer]]> I've found a better solution to compare chords, using your 'array find' script,
but it don't work with my array and i can't find why.
here is the workspace:
http://www.sensomusic.com/forums/upload ... %20bug.wkp

Statistics: Posted by Fléau — 13 Jun 2012, 15:56


]]>
2012-06-12T19:53:52+02:00 2012-06-12T19:53:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23649#p23649 <![CDATA[Midi Harmonizer]]> like "pentatonic major / chinese mongolian"=661
etc ?
Anyway thanks a lot for this work, it's gonna be a HIT among the growing Usine community!

Statistics: Posted by tanabarbier — 12 Jun 2012, 19:53


]]>
2012-06-12T18:45:31+02:00 2012-06-12T18:45:31+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23647#p23647 <![CDATA[Midi Harmonizer]]> my patch was taking 0.04% cpu
caco script 0.03%
bsork script 0.02%
need to repace them all, and then 'chord detector' will be finished (it works yet)
many thanks!

need your advice:
should i make restricted scale list or should i patch a switch to chose between restricted/educational?

Statistics: Posted by Fléau — 12 Jun 2012, 18:45


]]>
2012-06-12T14:20:51+02:00 2012-06-12T14:20:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23644#p23644 <![CDATA[Midi Harmonizer]]>
...and your post reminds me that it's about time I got into the SDK. Long time since I've done much with curly braces, though, and I've never used C++, which I must admit I find quite confusing. I'm not much of an OO programmer...

Regarding DontProcess or similar, I can't recall anything like that. I've just taken it for granted that if Process isn't declared, nothing happens. Well, maybe a couple of CPU cycles to find that there's nothing to do, but not much more. Any comments from the boss?

Statistics: Posted by bsork — 12 Jun 2012, 14:20


]]>
2012-06-12T12:58:32+02:00 2012-06-12T12:58:32+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23643#p23643 <![CDATA[Midi Harmonizer]]>

I do like the scripts though, it was very quick to create I can see myself starting to use them now in some cases instead of SDK to save time. I have been avoiding them so far but the language is pretty easy to pick up.

I didn't realize you could write to data arrays prior to resizing them, that makes things easier. In the SDK you can set DontProcess==TRUE if you do not need the audio processing to be called, maybe scripts have something similar?

Statistics: Posted by caco — 12 Jun 2012, 12:58


]]>
2012-06-12T12:17:41+02:00 2012-06-12T12:17:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23642#p23642 <![CDATA[Midi Harmonizer]]>

Your script works just fine, but could be a bit more efficient:

CODE:

Var ArrayIn, ArrayOut &#58; tparameter;// initialisation &#58; create parametersprocedure init;begin      ArrayIn&#58;= createParam&#40;'Array in', PtArray&#41;;     SetIsOutput&#40;ArrayIn,false&#41;;    ArrayOut&#58;= createParam&#40;'Array out', PtArray&#41;;             SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;;   Var i, j &#58; Integer;begin    if &#40;N=ArrayIn&#41;  then begin        j &#58;= 0;        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            If &#40;GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0&#41; then begin               SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;               j &#58;= j + 1;            end;        end;            SetLength&#40;ArrayOut, j&#41;;    end;end;
You can set the length after filling in the values, even if the new length is longer than the previous. AFAIK there shouldn't be any problems with that. I haven't done it much (if ever) with data arrays, but a lot of times with Midi arrays.

Besides, if you don't need Process - skip it. I don't know if it really matters and it's being called the engine when the procedure is empty, but in this case there's no need for it. I think you can do that with all the standard procedures: Init, Destroy, Callback and Process when they're not needed.

Statistics: Posted by bsork — 12 Jun 2012, 12:17


]]>
2012-06-12T11:07:49+02:00 2012-06-12T11:07:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23641#p23641 <![CDATA[Midi Harmonizer]]>

CODE:

///////////////////////////////////////////////////////////////////////////////// Function&#58; Removes any zero values from an array // Version &#58; 1.0// Date &#58; 12 June 2012//////////////////////////////////////////////////////////////////////////////// variables declarationVar ArrayIn, ArrayOut &#58; tparameter;Var non_zero, i, j &#58; integer;// initialisation &#58; create parametersprocedure init;begin  ArrayIn&#58;= createParam&#40;'Array in', PtArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;ArrayOut&#58;= createParam&#40;'Array out', PtArray&#41;;         SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginif &#40;N=ArrayIn&#41;  then beginnon_zero &#58;= 0;i &#58;= 0;j &#58;= 0;//count non-zero elementsfor i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do beginIf  GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0  then beginnon_zero &#58;= non_zero + 1; end;end;//set output array to size of non zero elementsSetLength&#40;ArrayOut, non_zero&#41;;//copy only non_zero elements to outputfor i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1  do beginIf  GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0  then beginSetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;; j &#58;= j + 1;end;end;end;end;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by caco — 12 Jun 2012, 11:07


]]>
2012-06-12T11:01:19+02:00 2012-06-12T11:01:19+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23640#p23640 <![CDATA[Midi Harmonizer]]> Statistics: Posted by bsork — 12 Jun 2012, 11:01


]]>
2012-06-12T10:26:21+02:00 2012-06-12T10:26:21+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23639#p23639 <![CDATA[Midi Harmonizer]]>
The only problem is the behaviour of the list/combo boxes when using text/value pairs, as it will jump to the first item with the chosen value when the value is repeated..
agreed
Confusing, but in this case educational, as you learn that scales with different names are in fact alike..
That's why i didn't removed duplicates.
I could patch an 'educational button' to switch between two list.
Here are the duplicates:
duplicate.txt
What are the ones i should keep?

Thanks for the support.

Statistics: Posted by Fléau — 12 Jun 2012, 10:26


]]>
2012-06-12T09:20:28+02:00 2012-06-12T09:20:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23638#p23638 <![CDATA[Midi Harmonizer]]>
Fléau I really like the use of the dec2bin module, that is an ingenious way of storing the scale patterns :)
Agreed! The only problem is the behaviour of the list/combo boxes when using text/value pairs, as it will jump to the first item with the chosen value when the value is repeated. Confusing, but in this case educational, as you learn that scales with different names are in fact alike.
If nobody else has time for your script I will have a go for you tomorrow, I am learning Usine's script language at the moment so it will be good practice for me ;)
If you don't find the time Caco, I think I can do it tonight. It shouldn't take many lines of code.

Statistics: Posted by bsork — 12 Jun 2012, 09:20


]]>
BrainModular BrainModular Users Forum 2012-06-22T17:45:05+02:00 https://brainmodular.com/forums/app.php/feed/topic/3489 2012-06-22T17:45:05+02:00 2012-06-22T17:45:05+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23727#p23727 <![CDATA[Midi Harmonizer]]> thanks a lot !

Statistics: Posted by nay-seven — 22 Jun 2012, 17:45


]]>
2012-06-22T16:46:09+02:00 2012-06-22T16:46:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23724#p23724 <![CDATA[Midi Harmonizer]]> http://www.sensomusic.com/forums/upload ... onizer.wkp

Corrected a scale mistake in the chord database.
Added a 'key feedback' switch on the note scaler.
Added a chord player and a arppegio player with modulated speed.

I'm near to upload it in the addons, so all suggestions are welcome!

Statistics: Posted by Fléau — 22 Jun 2012, 16:46


]]>
2012-06-18T15:46:22+02:00 2012-06-18T15:46:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23708#p23708 <![CDATA[Midi Harmonizer]]> Statistics: Posted by damstraversaz — 18 Jun 2012, 15:46


]]>
2012-06-18T15:18:09+02:00 2012-06-18T15:18:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23707#p23707 <![CDATA[Midi Harmonizer]]> Statistics: Posted by bsork — 18 Jun 2012, 15:18


]]>
2012-06-18T14:49:22+02:00 2012-06-18T14:49:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23706#p23706 <![CDATA[Midi Harmonizer]]> I have an issue with the dec2bin module, which is not find by usine in the modules folder. does it need a additionnal pack ?
best,
Damien

Statistics: Posted by damstraversaz — 18 Jun 2012, 14:49


]]>
2012-06-17T17:57:50+02:00 2012-06-17T17:57:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23700#p23700 <![CDATA[Midi Harmonizer]]> Here is the new version with the chord detector:

download:http://www.sensomusic.com/forums/upload ... onizer.wkp

Image

Next step is isolating chords according to a scale and play them,
vice versa, and then play arpeggio.

Statistics: Posted by Fléau — 17 Jun 2012, 17:57


]]>
2012-06-15T23:57:48+02:00 2012-06-15T23:57:48+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23695#p23695 <![CDATA[Midi Harmonizer]]>

CODE:

CONST BUFFER_SIZE = 128;// MIDI channel messagesCONST NOTEOFF = Byte&#40;128&#41;;CONST NOTEON  = Byte&#40;144&#41;;TYPE tMidiArr = ARRAY OF tMidi;TYPE tNoteOns = RECORD        origChannel &#58; Byte;        origNoteNo  &#58; Byte;        outChannel  &#58; Byte;        outNoteNo   &#58; Byte;     END;VAR pMidiIn, pMidiOut1 &#58; tParameter;VAR pTranspose, pNumNotes &#58; tParameter;VAR sentNoteOns &#58; ARRAY OF tNoteOns;VAR numIn, numSentNoteOns, numOut1 &#58; Integer;VAR transpose &#58; Integer;PROCEDURE Init;   VAR i &#58; Integer;BEGIN   pMidiIn &#58;= CreateParam&#40;'midi in', ptMidi&#41;; SetIsOutput&#40;pMidiIn, FALSE&#41;;   pMidiOut1 &#58;= CreateParam&#40;'midi out', ptMidi&#41;; SetIsInput&#40;pMidiOut1, FALSE&#41;;   pTranspose &#58;= CreateParam&#40;'transpose', ptDataFader&#41;; SetIsOutput&#40;pTranspose, FALSE&#41;;   SetMin&#40;pTranspose, -48&#41;; SetMax&#40;pTranspose, 48&#41;;   SetFormat&#40;pTranspose, '%.0f'&#41;; SetSymbol&#40;pTranspose, 'sm'&#41;;   pNumNotes &#58;= CreateParam&#40;'num notes', ptDataField&#41;; SetIsInput&#40;pNumNotes, FALSE&#41;;   SetArrayLength&#40;sentNoteOns, BUFFER_SIZE&#41;;   numSentNoteOns &#58;= 0;   numOut1 &#58;= 0;END; // InitFUNCTION IsNoteOn &#40;currMsg &#58; tMidi&#41; &#58; Boolean;BEGIN   IsNoteOn &#58;= &#40;&#40;currMsg.msg = NOTEON&#41; AND &#40;currMsg.data2 > 0&#41;&#41;;END;FUNCTION IsNoteOff &#40;currMsg &#58; tMidi&#41; &#58; Boolean;BEGIN   IsNoteOff &#58;= &#40;currMsg.msg = NOTEOFF&#41; OR &#40;&#40;currMsg.msg = NOTEON&#41; AND &#40;currMsg.data2 = 0&#41;&#41;;END;PROCEDURE CreateOut&#40;currMsg &#58; tMidi&#41;;BEGIN   SetMidiArrayValue&#40;pMidiOut1, numOut1, currMsg&#41;;   numOut1 &#58;= numOut1 + 1;END; // CreateOutPROCEDURE CreateNoteOnOut&#40;origMsg, outMsg &#58; tMidi&#41;;   VAR curr &#58; tNoteOns;BEGIN   WITH curr DO BEGIN      origChannel &#58;= origMsg.channel;      origNoteNo  &#58;= origMsg.data1;      outChannel  &#58;= outMsg.channel;      outNoteNo   &#58;= outMsg.data1;   END;   sentNoteOns&#91;numSentNoteOns&#93; &#58;= curr;   numSentNoteOns &#58;= numSentNoteOns + 1;   CreateOut&#40;outMsg&#41;;END; // CreateNoteOnOutPROCEDURE CheckSendNoteOff&#40;currMsg &#58; tMidi&#41;;   VAR i, j &#58; Integer;   VAR outMsg &#58; tMidi;   VAR curr &#58; tNoteOns;BEGIN   j &#58;= 0;   FOR i &#58;= 0 TO &#40;numSentNoteOns - 1&#41; DO BEGIN      curr &#58;= sentNoteOns&#91;i&#93;;      IF &#40;&#40;currMsg.channel = curr.origChannel&#41; AND &#40;currMsg.data1 = curr.origNoteNo&#41;&#41; THEN BEGIN         outMsg.msg     &#58;= currMsg.msg;         outMsg.channel &#58;= curr.outChannel;         outMsg.data1   &#58;= curr.outNoteNo;         outMsg.data2   &#58;= currMsg.data2;         CreateOut&#40;outMsg&#41;;         j &#58;= j + 1;      END      ELSE BEGIN         sentNoteOns&#91;i - j&#93; &#58;= curr;      END;   END;   numSentNoteOns &#58;= numSentNoteOns - j;END; // CheckSendNoteOffPROCEDURE CheckInput&#40;currMsg &#58; tMidi&#41;;   VAR newMsg &#58; tMidi;BEGIN   newMsg &#58;= currMsg;   IF &#40;IsNoteOn&#40;currMsg&#41;&#41; THEN BEGIN      newMsg.data1 &#58;= newMsg.data1 + transpose;      CreateNoteOnOut&#40;currMsg, newMsg&#41;;   END   ELSE IF &#40;IsNoteOff&#40;currMsg&#41;&#41; THEN      CheckSendNoteOff&#40;currMsg&#41;;   SetValue&#40;pNumNotes, numSentNoteOns&#41;;END; // CheckInputPROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN   CASE n OF      pMidiIn    &#58; numIn     &#58;= GetLength&#40;n&#41;;      pTranspose &#58; transpose &#58;= round&#40;GetValue&#40;n&#41;&#41;;   END;END; // CallbackPROCEDURE Process;   VAR i &#58; Integer;   VAR currMsg &#58; tMidi;BEGIN   FOR i &#58;= 0 TO &#40;numIn - 1&#41; DO BEGIN      GetMidiArrayValue&#40;pMidiIn, i, currMsg&#41;;      CheckInput&#40;currMsg&#41;;   END;   SetLength&#40;pMidiOut1, numOut1&#41;;   numOut1 &#58;= 0;END; // Process
There are still bits and pieces of the code left that could be removed.

Statistics: Posted by bsork — 15 Jun 2012, 23:57


]]>
2012-06-15T15:12:13+02:00 2012-06-15T15:12:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23692#p23692 <![CDATA[Midi Harmonizer]]>

CODE:

SetValue&#40;voices, nbOfMidi &#41;;
This will assign the value of nbOfMidi to the parameter called voices

I do not think this will not work as you hope though as nbOfMidi will only be greater than zero for the actual BLOC (e.g 64, 128 samples etc) that you receive the MIDI messages in. After that it will go back to zero. It will not give you the number of actual MIDI messages currently switched on.

Statistics: Posted by caco — 15 Jun 2012, 15:12


]]>
2012-06-15T14:50:50+02:00 2012-06-15T14:50:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23691#p23691 <![CDATA[Midi Harmonizer]]>

CODE:

var input   &#58; Tparameter;var output  &#58; Tparameter;var transpo &#58; TParameter;var voices  &#58; TParameter;procedure init;begin   Input &#58;= CreateParam&#40;'In',ptMidi&#41;; Output &#58;= CreateParam&#40;'Out',ptMidi&#41;; transpo &#58;= CreateParam&#40;'transpo',ptDataFader&#41;; voices &#58;= CreateParam&#40;'voices',ptDatafield&#41;; SetIsInput&#40;Output,false&#41;; SetIsOutPut&#40;Input,false&#41;; SetIsOutPut&#40;transpo,false&#41;; SetFormat&#40;transpo,'%.0f'&#41;; SetIsInput&#40;voices,false&#41;; SetMin&#40;transpo,-24&#41;; SetMax&#40;transpo,24&#41;;end;var i            &#58; integer;var nbOfMidi     &#58; integer;var ReceivedMidi &#58; TMidi;var TranspoVal   &#58; single;//////////////////////////////// main proc//////////////////////////////procedure Process;begin nbOfMidi &#58;= GetLength&#40;input&#41;;  // get the number of incoming midi codes  if nbOfMidi > 0  then begin    SetLength&#40;outPut,nbOfMidi&#41;;      // set the number of output codes    transpoVal &#58;= getValue&#40;transpo&#41;; // get the transpo value    for i &#58;= 0 to nbOfMidi-1         // loop for all input codes, for polyphonic data &#40;chords&#41;    do begin      GetMidiArrayValue&#40;input,i,ReceivedMidi&#41;; // get each code      ReceivedMidi.data1 &#58;= ReceivedMidi.data1+trunc&#40;transpoVal&#41;; // calculate transpo      SetMidiArrayValue&#40;output,i,ReceivedMidi&#41;; // set output value         end; end  else SetLength&#40;outPut,0&#41;; // nothing received, set out length to 0end;
I added:
var voices : TParameter;
voices := CreateParam('voices',ptDatafield);
SetIsInput(voices,false);

i'd like to get
voices := nbOfMidi; (number of note on)
tried to place this line everywhere in the process but nothing happen,
what i'm doing wrong?

Statistics: Posted by Fléau — 15 Jun 2012, 14:50


]]>
2012-06-15T12:06:17+02:00 2012-06-15T12:06:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23689#p23689 <![CDATA[Midi Harmonizer]]>

Statistics: Posted by caco — 15 Jun 2012, 12:06


]]>
2012-06-14T23:23:55+02:00 2012-06-14T23:23:55+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23683#p23683 <![CDATA[Midi Harmonizer]]>

Here it is:

CODE:

////////////////////////////////////////////////////////////////////////////////// ArrayFind.script// Returns the array index where array B is first found in array A, with an// optional start index for array A. If no matches, the result is -1.//// The returned index in A is the "real" index; the start offset is not // subtracted from the result.//// bSork, V2 June 2012////////////////////////////////////////////////////////////////////////////////VAR pArrA, pStartA, pArrB, pResult &#58; tParameter;PROCEDURE Init;BEGIN   pArrA &#58;= CreateParam&#40;'array A', ptArray&#41;; SetIsOutput&#40;pArrA, FALSE&#41;;   SetMin&#40;pArrA, -1000000000&#41;;    SetMax&#40;pArrA, +1000000000&#41;;   pStartA &#58;= CreateParam&#40;'start index A', ptDataFader&#41;; SetIsOutput&#40;pStartA, FALSE&#41;;   SetMin&#40;pStartA, 0&#41;; SetMax&#40;pStartA, 8191&#41;; SetFormat&#40;pStartA, '%.0f'&#41;;   SetDefaultValue&#40;pStartA, 0&#41;;   pArrB &#58;= CreateParam&#40;'array B', ptArray&#41;; SetIsOutput&#40;pArrB, FALSE&#41;;   SetMin&#40;pArrB, -1000000000&#41;;    SetMax&#40;pArrB, +1000000000&#41;;   pResult &#58;= CreateParam&#40;'result', ptDataField&#41;; SetIsInput&#40;pResult, FALSE&#41;;   SetMin&#40;pResult, -1&#41;; SetMax&#40;pResult, 8191&#41;; SetFormat&#40;pResult, '%.0f'&#41;;   SetValue&#40;pResult, 0&#41;;END; // InitPROCEDURE Find;   VAR lenA, lenB &#58; Integer;   VAR r, a, a2, b &#58; Integer;   VAR bx &#58; Single;   VAR found &#58; Boolean;BEGIN   r &#58;= -1;   lenB &#58;= GetLength&#40;pArrB&#41;;   IF &#40;lenB > 0&#41; THEN BEGIN      b &#58;= 0;      bx &#58;= GetDataArrayValue&#40;pArrB, b&#41;;      a &#58;= round&#40;GetValue&#40;pStartA&#41;&#41;;      lenA &#58;= GetLength&#40;pArrA&#41;;      WHILE &#40;&#40;r = -1&#41; AND &#40;&#40;lenA - a&#41; >= lenB&#41;&#41; DO BEGIN         found &#58;= &#40;bx = GetDataArrayValue&#40;pArrA, a&#41;&#41;;         IF &#40;found&#41; THEN BEGIN            a2 &#58;= a + 1;            b &#58;= 1;         END;         WHILE &#40;found AND &#40;b < lenB&#41;&#41; DO BEGIN            found &#58;= &#40;GetDataArrayValue&#40;pArrA, a2&#41; = GetDataArrayValue&#40;pArrB, b&#41;&#41;;            a2 &#58;= a2 + 1;            b &#58;= b + 1;         END;         IF &#40;found AND &#40;b = lenB&#41;&#41; THEN            r &#58;= a         ELSE            b &#58;= 0;         a &#58;= a + 1;      END;   END;   SetValue&#40;pResult, r&#41;;END; // FindPROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN   IF &#40;n <= pArrB&#41; THEN      Find;END; // Callback
Hope it works for you!

I'll replace the old one in the add-ons as well.

Statistics: Posted by bsork — 14 Jun 2012, 23:23


]]>
2012-06-14T11:40:53+02:00 2012-06-14T11:40:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23662#p23662 <![CDATA[Midi Harmonizer]]>
I think, however, that I can make the script somewhat more efficient by doing things in another order. Will probably do it tonight.

Statistics: Posted by bsork — 14 Jun 2012, 11:40


]]>
2012-06-14T11:21:37+02:00 2012-06-14T11:21:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23660#p23660 <![CDATA[Midi Harmonizer]]>
@Fléau - The scripting language used is based on Delphi.

Statistics: Posted by caco — 14 Jun 2012, 11:21


]]>
2012-06-14T10:19:58+02:00 2012-06-14T10:19:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23659#p23659 <![CDATA[Midi Harmonizer]]>
BEGIN
r := -1;
IF (((lenA - startA) >= lenB) AND (lenB > 0)) THEN BEGIN
b := 0;
// bx := GetDataArrayValue(pArrB, b); THIS LINE (42 i think)
FOR a := startA TO (lenA - 1) DO BEGIN
ax := GetDataArrayValue(pArrA, a);
bx := GetDataArrayValue(pArrB, b); HAD TO BE PLACED HERE
IF (ax = bx) THEN BEGIN
IF (b = 0) THEN r := a;
b := b + 1;
IF (b = lenB) THEN BREAK;
bx := GetDataArrayValue(pArrB, b);
END
ELSE BEGIN
b := 0;
r := -1;
END;
IF ((lenA - a - 1) < (lenB - b)) THEN BEGIN
r := -1;
BREAK;
END
END;
END;
SetValue(pResult, r);
doFind := FALSE;
END; // Find
Need to learn scripting,
what is the used language?

Statistics: Posted by Fléau — 14 Jun 2012, 10:19


]]>
2012-06-14T00:19:01+02:00 2012-06-14T00:19:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23657#p23657 <![CDATA[Midi Harmonizer]]>
If anyone else feels compelled to have a go at it - please do!

Statistics: Posted by bsork — 14 Jun 2012, 00:19


]]>
2012-06-13T15:56:34+02:00 2012-06-13T15:56:34+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23654#p23654 <![CDATA[Midi Harmonizer]]> I've found a better solution to compare chords, using your 'array find' script,
but it don't work with my array and i can't find why.
here is the workspace:
http://www.sensomusic.com/forums/upload ... %20bug.wkp

Statistics: Posted by Fléau — 13 Jun 2012, 15:56


]]>
2012-06-12T19:53:52+02:00 2012-06-12T19:53:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23649#p23649 <![CDATA[Midi Harmonizer]]> like "pentatonic major / chinese mongolian"=661
etc ?
Anyway thanks a lot for this work, it's gonna be a HIT among the growing Usine community!

Statistics: Posted by tanabarbier — 12 Jun 2012, 19:53


]]>
2012-06-12T18:45:31+02:00 2012-06-12T18:45:31+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23647#p23647 <![CDATA[Midi Harmonizer]]> my patch was taking 0.04% cpu
caco script 0.03%
bsork script 0.02%
need to repace them all, and then 'chord detector' will be finished (it works yet)
many thanks!

need your advice:
should i make restricted scale list or should i patch a switch to chose between restricted/educational?

Statistics: Posted by Fléau — 12 Jun 2012, 18:45


]]>
2012-06-12T14:20:51+02:00 2012-06-12T14:20:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23644#p23644 <![CDATA[Midi Harmonizer]]>
...and your post reminds me that it's about time I got into the SDK. Long time since I've done much with curly braces, though, and I've never used C++, which I must admit I find quite confusing. I'm not much of an OO programmer...

Regarding DontProcess or similar, I can't recall anything like that. I've just taken it for granted that if Process isn't declared, nothing happens. Well, maybe a couple of CPU cycles to find that there's nothing to do, but not much more. Any comments from the boss?

Statistics: Posted by bsork — 12 Jun 2012, 14:20


]]>
2012-06-12T12:58:32+02:00 2012-06-12T12:58:32+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23643#p23643 <![CDATA[Midi Harmonizer]]>

I do like the scripts though, it was very quick to create I can see myself starting to use them now in some cases instead of SDK to save time. I have been avoiding them so far but the language is pretty easy to pick up.

I didn't realize you could write to data arrays prior to resizing them, that makes things easier. In the SDK you can set DontProcess==TRUE if you do not need the audio processing to be called, maybe scripts have something similar?

Statistics: Posted by caco — 12 Jun 2012, 12:58


]]>
2012-06-12T12:17:41+02:00 2012-06-12T12:17:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23642#p23642 <![CDATA[Midi Harmonizer]]>

Your script works just fine, but could be a bit more efficient:

CODE:

Var ArrayIn, ArrayOut &#58; tparameter;// initialisation &#58; create parametersprocedure init;begin      ArrayIn&#58;= createParam&#40;'Array in', PtArray&#41;;     SetIsOutput&#40;ArrayIn,false&#41;;    ArrayOut&#58;= createParam&#40;'Array out', PtArray&#41;;             SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;;   Var i, j &#58; Integer;begin    if &#40;N=ArrayIn&#41;  then begin        j &#58;= 0;        for i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do begin            If &#40;GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0&#41; then begin               SetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;;               j &#58;= j + 1;            end;        end;            SetLength&#40;ArrayOut, j&#41;;    end;end;
You can set the length after filling in the values, even if the new length is longer than the previous. AFAIK there shouldn't be any problems with that. I haven't done it much (if ever) with data arrays, but a lot of times with Midi arrays.

Besides, if you don't need Process - skip it. I don't know if it really matters and it's being called the engine when the procedure is empty, but in this case there's no need for it. I think you can do that with all the standard procedures: Init, Destroy, Callback and Process when they're not needed.

Statistics: Posted by bsork — 12 Jun 2012, 12:17


]]>
2012-06-12T11:07:49+02:00 2012-06-12T11:07:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23641#p23641 <![CDATA[Midi Harmonizer]]>

CODE:

///////////////////////////////////////////////////////////////////////////////// Function&#58; Removes any zero values from an array // Version &#58; 1.0// Date &#58; 12 June 2012//////////////////////////////////////////////////////////////////////////////// variables declarationVar ArrayIn, ArrayOut &#58; tparameter;Var non_zero, i, j &#58; integer;// initialisation &#58; create parametersprocedure init;begin  ArrayIn&#58;= createParam&#40;'Array in', PtArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;ArrayOut&#58;= createParam&#40;'Array out', PtArray&#41;;         SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginif &#40;N=ArrayIn&#41;  then beginnon_zero &#58;= 0;i &#58;= 0;j &#58;= 0;//count non-zero elementsfor i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1 do beginIf  GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0  then beginnon_zero &#58;= non_zero + 1; end;end;//set output array to size of non zero elementsSetLength&#40;ArrayOut, non_zero&#41;;//copy only non_zero elements to outputfor i&#58;= 0 to GetLength&#40;ArrayIn&#41;-1  do beginIf  GetDataArrayValue&#40;ArrayIn, i&#41;  <> 0  then beginSetDataArrayValue&#40;ArrayOut, j, GetDataArrayValue&#40;ArrayIn, i&#41;&#41;; j &#58;= j + 1;end;end;end;end;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by caco — 12 Jun 2012, 11:07


]]>
2012-06-12T11:01:19+02:00 2012-06-12T11:01:19+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23640#p23640 <![CDATA[Midi Harmonizer]]> Statistics: Posted by bsork — 12 Jun 2012, 11:01


]]>
2012-06-12T10:26:21+02:00 2012-06-12T10:26:21+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23639#p23639 <![CDATA[Midi Harmonizer]]>
The only problem is the behaviour of the list/combo boxes when using text/value pairs, as it will jump to the first item with the chosen value when the value is repeated..
agreed
Confusing, but in this case educational, as you learn that scales with different names are in fact alike..
That's why i didn't removed duplicates.
I could patch an 'educational button' to switch between two list.
Here are the duplicates:
duplicate.txt
What are the ones i should keep?

Thanks for the support.

Statistics: Posted by Fléau — 12 Jun 2012, 10:26


]]>
2012-06-12T09:20:28+02:00 2012-06-12T09:20:28+02:00 https://brainmodular.com/forums/viewtopic.php?t=3489&p=23638#p23638 <![CDATA[Midi Harmonizer]]>
Fléau I really like the use of the dec2bin module, that is an ingenious way of storing the scale patterns :)
Agreed! The only problem is the behaviour of the list/combo boxes when using text/value pairs, as it will jump to the first item with the chosen value when the value is repeated. Confusing, but in this case educational, as you learn that scales with different names are in fact alike.
If nobody else has time for your script I will have a go for you tomorrow, I am learning Usine's script language at the moment so it will be good practice for me ;)
If you don't find the time Caco, I think I can do it tonight. It shouldn't take many lines of code.

Statistics: Posted by bsork — 12 Jun 2012, 09:20


]]>