Skip to content

Commit

Permalink
add midi_chorderizer V2 (replaces octaver), Set Envelope Points script
Browse files Browse the repository at this point in the history
  • Loading branch information
junh1024 committed Aug 5, 2023
1 parent f3f3912 commit c184b33
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 33 deletions.
94 changes: 94 additions & 0 deletions Effects/midi_chorderizer V2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
desc:MIDI Chorderizer
//tags: MIDI processing

slider1:5<0,24,1>Voice 1 Offset (st)
slider2:0<0,24,1>Voice 2 Offset (st)
slider3:0<0,24,1>Voice 3 Offset (st)
slider4:0<0,24,1>Voice 4 Offset (st)
slider5:1<0,1>Velocity Scale @ 1
slider6:1<0,1>Velocity Scale @ 4
slider7:0<0,127,1>Lowest Key (MIDI Note #)
slider8:127<0,127,1>Highest Key (MIDI Note #)

in_pin:none
out_pin:none

@init

@slider
slider1=slider1;


@block

while (
midirecv(ts,msg1,msg23) ?
(
m=msg1&240;
note=msg23&127;

(m == 8*16 || m==9*16) && note >= slider7 && note <= slider8 ?
(

slider1 > 0 ? (
note2 = note+slider1;
) : note2=-1;

slider2 > 0 ? (
note3 = note+slider2;
) : note3=-1;

slider3 > 0 ? (
note4 = note+slider3;
) : note4=-1;

slider4 > 0 ? (
note5 = note+slider4;
) : note5=-1;

(m == 9*16 && msg23>=256) ?
(
vel=(msg23/256)|0;
vel<0?vel=0:vel>=127?vel=127:vel|=0;
ov=vel;
vel *= 256.0;


note >= 0 && note < 128 ? midisend(ts,9*16,note+vel); // send note on
note2 >= 0 && note2 < 128 ? (
sc=slider5; vel2=ov*sc; vel2<0?vel2=0:vel2>=127?vel2=127:vel2|=0; vel2 *= 256.0;
// vel2=127;
midisend(ts,9*16,note2+vel2); // send note on
);
note3 >= 0 && note3 < 128 ? (
sc=slider5*0.75 + slider6*0.25; vel2=ov*sc; vel2<0?vel2=0:vel2>=127?vel2=127:vel2|=0; vel2 *= 256.0;
midisend(ts,9*16,note3+vel2); // send note on
);
note4 >= 0 && note4 < 128 ? (
sc=slider5*0.25 + slider6*0.75; vel2=ov*sc; vel2<0?vel2=0:vel2>=127?vel2=127:vel2|=0; vel2 *= 256.0;
midisend(ts,9*16,note4+vel2); // send note on
);
note5 >= 0 && note5 < 128 ? (
sc=slider6; vel2=ov*sc; vel2<0?vel2=0:vel2>=127?vel2=127:vel2|=0; vel2 *= 256.0;
midisend(ts,9*16,note5+vel2); // send note on
);
) : (m == 8*16 || m == 9*16) ? (
note >= 0 && note < 128 ? midisend(ts,8*16,note); // send note off
note2 >= 0 && note2 < 128 ? midisend(ts,8*16,note2); // send note off
note3 >= 0 && note3 < 128 ? midisend(ts,8*16,note3); // send note off
note4 >= 0 && note4 < 128 ? midisend(ts,8*16,note4); // send note off
note5 >= 0 && note5 < 128 ? midisend(ts,8*16,note5); // send note off
);
) :
(
midisend(ts,msg1,msg23);
);
bla=1;
);
);


@sample



66 changes: 33 additions & 33 deletions Meters/15.1 Surround Visualizer GUI (L).txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,40 @@ Time_Response=(100-slider4)/100;
@sample
//sample capture
//orig sample needed for 3D analysis
samples[0 ]= spl0 ;
samples[1 ]= spl1 ;
samples[2 ]= spl2 ;
samples[3 ]= spl3 ;
samples[4 ]= spl4 ;
samples[5 ]= spl5 ;
samples[6 ]= spl6 ;
samples[7 ]= spl7 ;
samples[8 ]= spl8 ;
samples[9 ]= spl9 ;
samples[10 ]= spl10 ;
samples[11 ]= spl11 ;
samples[12 ]= spl12 ;
samples[13 ]= spl13 ;
samples[14 ]= spl14 ;
samples[15 ]= spl15 ;
samples[0 ]= spl0 ;
samples[1 ]= spl1 ;
samples[2 ]= spl2 ;
samples[3 ]= spl3 ;
samples[4 ]= spl4 ;
samples[5 ]= spl5 ;
samples[6 ]= spl6 ;
samples[7 ]= spl7 ;
samples[8 ]= spl8 ;
samples[9 ]= spl9 ;
samples[10 ]= spl10 ;
samples[11 ]= spl11 ;
samples[12 ]= spl12 ;
samples[13 ]= spl13 ;
samples[14 ]= spl14 ;
samples[15 ]= spl15 ;

//abs for loudness
samples_avg[0 ]+= abs(spl0 );
samples_avg[1 ]+= abs(spl1 );
samples_avg[2 ]+= abs(spl2 );
samples_avg[3 ]+= abs(spl3 );
samples_avg[4 ]+= abs(spl4 );
samples_avg[5 ]+= abs(spl5 );
samples_avg[6 ]+= abs(spl6 );
samples_avg[7 ]+= abs(spl7 );
samples_avg[8 ]+= abs(spl8 );
samples_avg[9 ]+= abs(spl9 );
samples_avg[10 ]+= abs(spl10 );
samples_avg[11 ]+= abs(spl11 );
samples_avg[12 ]+= abs(spl12 );
samples_avg[13 ]+= abs(spl13 );
samples_avg[14 ]+= abs(spl14 );
samples_avg[15 ]+= abs(spl15 );
samples_avg[0 ]+= abs(spl0 );
samples_avg[1 ]+= abs(spl1 );
samples_avg[2 ]+= abs(spl2 );
samples_avg[3 ]+= abs(spl3 );
samples_avg[4 ]+= abs(spl4 );
samples_avg[5 ]+= abs(spl5 );
samples_avg[6 ]+= abs(spl6 );
samples_avg[7 ]+= abs(spl7 );
samples_avg[8 ]+= abs(spl8 );
samples_avg[9 ]+= abs(spl9 );
samples_avg[10 ]+= abs(spl10 );
samples_avg[11 ]+= abs(spl11 );
samples_avg[12 ]+= abs(spl12 );
samples_avg[13 ]+= abs(spl13 );
samples_avg[14 ]+= abs(spl14 );
samples_avg[15 ]+= abs(spl15 );

samples_captured+=1;

Expand Down Expand Up @@ -149,7 +149,7 @@ drawbox(gfx_w,gfx_h/2);

//draw height

slider7>0?
slider1>0?
(
gfx_g = gfx_b = 0;
gfx_r = 0.8;
Expand Down
41 changes: 41 additions & 0 deletions Scripts/Set Envelope Points.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
desc="Stretch & lock files depending on BPM of project & file. Length correction may be buggy"
by="junh1024"

from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0, message, -1)

debug = True

def msg(m):
if 'debug' in globals():
RPR_ShowConsoleMsg(m)

# msg(RPR_CountSelectedMediaItems(0))

with undoable(desc):
# code from https://github.com/X-Raym/REAPER-ReaScripts/blob/1a0d13ebcef3efe32f18ef213aa70673dc2d6bbe/Envelopes/X-Raym_Set%20selected%20envelope%20points%20value.eel

# RPR_ShowConsoleMsg(BPM_proj)

#get file BPM
retval= envelope= ptidx= timeOut= valueOut= shapeOut= tensionOut= selectedOut=0
new_value = RPR_GetUserInputs("Point",1,"What to set these point(s) to?","",64)[4]
new_value=float(new_value.strip())

# RPR_ShowConsoleMsg(BPM_file)
envelope = RPR_GetSelectedEnvelope(0)
#get items
for i in range ( RPR_CountEnvelopePoints( envelope ) ):

( retval, envelope, ptidx, timeOut, valueOut, shapeOut, tensionOut, selectedOut) = RPR_GetEnvelopePoint(envelope, i, timeOut, valueOut, shapeOut, tensionOut, selectedOut)

if ( selectedOut == 1 ):
RPR_SetEnvelopePoint(envelope, i, timeOut, new_value, shapeOut, tensionOut, 1, True );

0 comments on commit c184b33

Please sign in to comment.