ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray
Statistics: Posted by bsork — 31 Oct 2008, 06:28 Statistics: Posted by amiga909 — 31 Oct 2008, 05:08 Statistics: Posted by moody33 — 30 Oct 2008, 12:01 Statistics: Posted by bsork — 30 Oct 2008, 08:32 Statistics: Posted by amiga909 — 30 Oct 2008, 05:12 Statistics: Posted by moody33 — 30 Oct 2008, 01:09 Statistics: Posted by bsork — 29 Oct 2008, 23:20
]]>
here a mp3 example
www.thaumat.org/_permShare/mp3/mep.dry.mp3
www.thaumat.org/_permShare/mp3/mep.wet.mp3
pretty weird ![]()
]]>
Moody.
]]>
@amiga909: You can restrict ranges and transpose without a script, but as you mention hanging notes are a problem if parameters are changed between NoteOn and NoteOff. I guess there are ways of getting the exact same behaviour as the various incarnations of the transpose script using only modules, but it wouldn't be easy, and I suspect that the result would end up as rather more complex to customize or debug than what is essentially a quite simple script.
Usine patching is as we all know very much about creating data flows, but the inherent problem of MIDI notes is that they consist of two essentialy non-related messages, so the NoteOff has to refer back to something earlier on in the flow one way or another, which can be tricky.
]]>
further its not rescaled as moody specified. 

]]>
I've notice only one thing, but it's normal and totally logical : if the range is below one octave, the script don't take care and modulate within a range of one or two octave around the specified range. It's logical and I'm happy to see that the script don't give strange results in this case. Really great script . It solved my problem so far! Perfect !
Finally, you're a genius !
]]>
This time I've done some testing, and seems ok to me, but the behaviour of the octave foldback together with the extra restriction of what notes to output can be somewhat confusing the first time it's encountered, I guess...
Try it and let me hear your comments!
]]>
Statistics: Posted by bsork — 29 Oct 2008, 12:12
Statistics: Posted by moody33 — 29 Oct 2008, 11:45
Statistics: Posted by moody33 — 29 Oct 2008, 11:34
Statistics: Posted by bsork — 29 Oct 2008, 10:56
Statistics: Posted by bsork — 28 Oct 2008, 22:35
Statistics: Posted by moody33 — 28 Oct 2008, 17:44
Statistics: Posted by woodslanding — 28 Oct 2008, 07:09
Statistics: Posted by bsork — 27 Oct 2008, 13:15

Statistics: Posted by amiga909 — 27 Oct 2008, 11:01
CODE:
//////////////////////////////////////////////////////// transpose midi note// 2008-10-24: @bSork, first version // 2008-10-26: @amiga909, 'wrap around' added //////////////////////////////////////////////////////VAR pIn, pOut, pTransp, pWrapAround : tParameter;TYPE tTransp = ARRAY OF integer;VAR transp : ARRAY OF tTransp;VAR tmp : tMidi;VAR len, transpose, i, tempTransp : integer;PROCEDURE Init;BEGIN pIn := CreateParam('midi in', ptMidi); SetIsOutput(pIn, FALSE); pOut := CreateParam('midi out', ptMidi); SetIsInput(pOut, FALSE); pTransp := CreateParam('transpose', ptDataFader); SetIsOutput(pTransp, FALSE); SetFormat(pTransp, '%.0f'); SetMin(pTransp, -127); SetMax(pTransp, 127); pWrapAround := CreateParam('wrap around', ptSwitch); SetIsOutput(pWrapAround, FALSE); SetArrayLength(transp, 16); FOR i := 0 TO 15 DO // A two-dimensional array; [16 channels][128 transpose values] SetArrayLength(transp[i], 128);END; // expects a noteOn msg with velocity > 0; outputs the transposed note value [0-127]FUNCTION calcTranspose (t: integer; wrap: single): integer;BEGIN IF wrap > 0 THEN BEGIN // IF t > 127 THEN result := t - 128 ELSE IF t < 0 THEN result := t + 128; END ELSE BEGIN IF t > 127 THEN result:= 127 ELSE IF t < 0 THEN result:=0 ELSE result:=t; END; END;// mainBEGIN len := GetLength(pIn); IF (len > 0) THEN BEGIN transpose := trunc(GetValue(pTransp)); SetLength(pOut, len); FOR i := 0 TO (len - 1) DO BEGIN GetMidiArrayValue(pIn, i, tmp); tempTransp := transpose + tmp.data1; IF (tmp.msg = 144) AND (tmp.data2 > 0) THEN BEGIN // NoteOn tempTransp:= calcTranspose(tempTransp, GetValue(pWrapAround)); transp[tmp.channel - 1][tmp.data1] := tempTransp; tmp.data1 := tempTransp; SetMidiArrayValue(pOut, i, tmp); END ELSE IF (tmp.msg = 128) or ((tmp.msg = 144) and (tmp.data2 = 0)) THEN // NoteOff tmp.data1 := transp[tmp.channel - 1][tmp.data1]; SetMidiArrayValue(pOut, i, tmp); END; END ELSE BEGIN SetLength(pOut, 0); END;END.CODE:
//////////////////////////////////////////////////////// multiply midi note// 2008-10-24: @bSork, first version of midi transpose// 2008-10-26: @amiga909, midi multiply//////////////////////////////////////////////////////VAR pIn, pOut, pMult, pWrapAround : tParameter;TYPE tMult = ARRAY OF integer;VAR mult : ARRAY OF tMult;VAR tmp : tMidi;VAR len, i, tempMult : integer;VAR multiply: double;PROCEDURE Init;BEGIN pIn := CreateParam('midi in', ptMidi); SetIsOutput(pIn, FALSE); pOut := CreateParam('midi out', ptMidi); SetIsInput(pOut, FALSE); pMult := CreateParam('multiply', ptDataFader); SetIsOutput(pMult, FALSE); SetMin(pMult, 0.125); SetMax(pMult, 8); SetDefaultValue(pMult,1); pWrapAround := CreateParam('wrap around', ptSwitch); SetIsOutput(pWrapAround, FALSE); SetArrayLength(mult, 16); FOR i := 0 TO 15 DO // A two-dimensional array; [16 channels][128 multiply values] SetArrayLength(mult[i], 128);END; // expects a noteOn msg with velocity > 0; outputs the multiplyd note value [0-127]FUNCTION calcMultiply (t: integer; wrap: single): integer; var tt:integer;BEGIN IF wrap > 0 THEN BEGIN tt:= 128*(trunc(t/128)); IF t > 127 THEN result := t - tt ELSE IF t < 0 THEN result := t + tt; END ELSE BEGIN IF t > 127 THEN result:= 127 ELSE IF t < 0 THEN result:=0 ELSE result:=t; END; END;// mainBEGIN len := GetLength(pIn); IF (len > 0) THEN BEGIN multiply := (GetValue(pMult)); SetLength(pOut, len); FOR i := 0 TO (len - 1) DO BEGIN GetMidiArrayValue(pIn, i, tmp); tempMult := round (multiply * tmp.data1); IF (tmp.msg = 144) AND (tmp.data2 > 0) THEN BEGIN // NoteOn tempMult:= calcMultiply(tempMult, GetValue(pWrapAround)); mult[tmp.channel - 1][tmp.data1] := tempMult; tmp.data1 := tempMult; SetMidiArrayValue(pOut, i, tmp); END ELSE IF (tmp.msg = 128) or ((tmp.msg = 144) and (tmp.data2 = 0)) THEN // NoteOff tmp.data1 := mult[tmp.channel - 1][tmp.data1]; SetMidiArrayValue(pOut, i, tmp); END; END ELSE BEGIN SetLength(pOut, 0); END;END.Statistics: Posted by amiga909 — 26 Oct 2008, 21:22
Statistics: Posted by bsork — 31 Oct 2008, 06:28
Statistics: Posted by amiga909 — 31 Oct 2008, 05:08
Statistics: Posted by moody33 — 30 Oct 2008, 12:01
Statistics: Posted by bsork — 30 Oct 2008, 08:32


Statistics: Posted by amiga909 — 30 Oct 2008, 05:12
Statistics: Posted by moody33 — 30 Oct 2008, 01:09
Statistics: Posted by bsork — 29 Oct 2008, 23:20
Statistics: Posted by bsork — 29 Oct 2008, 12:12
Statistics: Posted by moody33 — 29 Oct 2008, 11:45
Statistics: Posted by moody33 — 29 Oct 2008, 11:34
Statistics: Posted by bsork — 29 Oct 2008, 10:56
Statistics: Posted by bsork — 28 Oct 2008, 22:35
Statistics: Posted by moody33 — 28 Oct 2008, 17:44
Statistics: Posted by woodslanding — 28 Oct 2008, 07:09
Statistics: Posted by bsork — 27 Oct 2008, 13:15

Statistics: Posted by amiga909 — 27 Oct 2008, 11:01
CODE:
//////////////////////////////////////////////////////// transpose midi note// 2008-10-24: @bSork, first version // 2008-10-26: @amiga909, 'wrap around' added //////////////////////////////////////////////////////VAR pIn, pOut, pTransp, pWrapAround : tParameter;TYPE tTransp = ARRAY OF integer;VAR transp : ARRAY OF tTransp;VAR tmp : tMidi;VAR len, transpose, i, tempTransp : integer;PROCEDURE Init;BEGIN pIn := CreateParam('midi in', ptMidi); SetIsOutput(pIn, FALSE); pOut := CreateParam('midi out', ptMidi); SetIsInput(pOut, FALSE); pTransp := CreateParam('transpose', ptDataFader); SetIsOutput(pTransp, FALSE); SetFormat(pTransp, '%.0f'); SetMin(pTransp, -127); SetMax(pTransp, 127); pWrapAround := CreateParam('wrap around', ptSwitch); SetIsOutput(pWrapAround, FALSE); SetArrayLength(transp, 16); FOR i := 0 TO 15 DO // A two-dimensional array; [16 channels][128 transpose values] SetArrayLength(transp[i], 128);END; // expects a noteOn msg with velocity > 0; outputs the transposed note value [0-127]FUNCTION calcTranspose (t: integer; wrap: single): integer;BEGIN IF wrap > 0 THEN BEGIN // IF t > 127 THEN result := t - 128 ELSE IF t < 0 THEN result := t + 128; END ELSE BEGIN IF t > 127 THEN result:= 127 ELSE IF t < 0 THEN result:=0 ELSE result:=t; END; END;// mainBEGIN len := GetLength(pIn); IF (len > 0) THEN BEGIN transpose := trunc(GetValue(pTransp)); SetLength(pOut, len); FOR i := 0 TO (len - 1) DO BEGIN GetMidiArrayValue(pIn, i, tmp); tempTransp := transpose + tmp.data1; IF (tmp.msg = 144) AND (tmp.data2 > 0) THEN BEGIN // NoteOn tempTransp:= calcTranspose(tempTransp, GetValue(pWrapAround)); transp[tmp.channel - 1][tmp.data1] := tempTransp; tmp.data1 := tempTransp; SetMidiArrayValue(pOut, i, tmp); END ELSE IF (tmp.msg = 128) or ((tmp.msg = 144) and (tmp.data2 = 0)) THEN // NoteOff tmp.data1 := transp[tmp.channel - 1][tmp.data1]; SetMidiArrayValue(pOut, i, tmp); END; END ELSE BEGIN SetLength(pOut, 0); END;END.CODE:
//////////////////////////////////////////////////////// multiply midi note// 2008-10-24: @bSork, first version of midi transpose// 2008-10-26: @amiga909, midi multiply//////////////////////////////////////////////////////VAR pIn, pOut, pMult, pWrapAround : tParameter;TYPE tMult = ARRAY OF integer;VAR mult : ARRAY OF tMult;VAR tmp : tMidi;VAR len, i, tempMult : integer;VAR multiply: double;PROCEDURE Init;BEGIN pIn := CreateParam('midi in', ptMidi); SetIsOutput(pIn, FALSE); pOut := CreateParam('midi out', ptMidi); SetIsInput(pOut, FALSE); pMult := CreateParam('multiply', ptDataFader); SetIsOutput(pMult, FALSE); SetMin(pMult, 0.125); SetMax(pMult, 8); SetDefaultValue(pMult,1); pWrapAround := CreateParam('wrap around', ptSwitch); SetIsOutput(pWrapAround, FALSE); SetArrayLength(mult, 16); FOR i := 0 TO 15 DO // A two-dimensional array; [16 channels][128 multiply values] SetArrayLength(mult[i], 128);END; // expects a noteOn msg with velocity > 0; outputs the multiplyd note value [0-127]FUNCTION calcMultiply (t: integer; wrap: single): integer; var tt:integer;BEGIN IF wrap > 0 THEN BEGIN tt:= 128*(trunc(t/128)); IF t > 127 THEN result := t - tt ELSE IF t < 0 THEN result := t + tt; END ELSE BEGIN IF t > 127 THEN result:= 127 ELSE IF t < 0 THEN result:=0 ELSE result:=t; END; END;// mainBEGIN len := GetLength(pIn); IF (len > 0) THEN BEGIN multiply := (GetValue(pMult)); SetLength(pOut, len); FOR i := 0 TO (len - 1) DO BEGIN GetMidiArrayValue(pIn, i, tmp); tempMult := round (multiply * tmp.data1); IF (tmp.msg = 144) AND (tmp.data2 > 0) THEN BEGIN // NoteOn tempMult:= calcMultiply(tempMult, GetValue(pWrapAround)); mult[tmp.channel - 1][tmp.data1] := tempMult; tmp.data1 := tempMult; SetMidiArrayValue(pOut, i, tmp); END ELSE IF (tmp.msg = 128) or ((tmp.msg = 144) and (tmp.data2 = 0)) THEN // NoteOff tmp.data1 := mult[tmp.channel - 1][tmp.data1]; SetMidiArrayValue(pOut, i, tmp); END; END ELSE BEGIN SetLength(pOut, 0); END;END.Statistics: Posted by amiga909 — 26 Oct 2008, 21:22