Ok, I decided to make a foray into scripting.
To be honest I lost patience and decided to edit an already existing script and added bits from others to it. (see below)
A sort of Frankenstein's Monster if you will.
The idea is to monitor every note going into a monophonic instrument I'm playing and when a CC command is received it plays the note back.
I'm almost there except this script seems to be responding to EVERY cc command instead of just one.
It plays the note back on all cc messages
How do I fix it so that it only responds to just ONE cc command and not all of them?
In fact how do I fix it so that it responds to a cc command and its value (e.g. CC 80, 20 triggers a midi note)
I know the answer is a simple one and I will be dedicating more of my time to learning scripting from Monday this week.
Here is the offender below.
on init
declare const $ROOT_X := 66
declare const $ROOT_Y := 2
declare const $GRID_X := 92
declare const $GRID_Y := 21
declare $count
declare ui_knob $cc_1_knob (0,127,1)
set_text($cc_1_knob,"Knob 1")
declare ui_value_edit $cc_1_vedit (-1,127,1)
set_text($cc_1_vedit,"MIDI CC")
move_control ($cc_1_vedit,1,2)
move_control ($cc_1_knob,1,3)
make_persistent ($cc_1_knob)
make_persistent ($cc_1_vedit)
declare $a
{set_control_par (get_ui_id($learn_button),$CON TROL_PAR_WIDTH,40)}
declare ui_label $label_1 (2,1)
set_text ($label_1,"Change Note Numbers into CC Numbers")
declare ui_value_edit $Min (0,127,$VALUE_EDIT_MODE_NOTE_N AMES)
$Min := 36
make_persistent ($Min)
declare ui_value_edit $Max (0,127,$VALUE_EDIT_MODE_NOTE_N AMES)
$Max := 48
make_persistent ($Max)
move_control ($label_1,3,2)
move_control ($Min,3,3)
move_control ($Max,4,3)
declare $note_id
declare ui_value_edit $CC (80,95,1)
declare ui_value_edit $Note (72,127,0)
declare ui_value_edit $Velocity ($cc_1_vedit,127,1)
declare ui_value_edit $Duration (0,10000,1)
make_persistent($CC)
make_persistent($Note)
make_persistent($Velocity)
make_persistent($Duration)
message("")
end on
on ui_control ($cc_1_knob)
if ($cc_1_vedit # -1)
set_controller ($cc_1_vedit, $cc_1_knob)
end if
end on
on ui_control ($Min)
if ($Min > $Max)
$Max := $Min
end if
end on
on ui_control ($Max)
if ($Max < $Min)
$Min := $Max
end if
end on
on note
$Min := $EVENT_NOTE
$Max := $EVENT_NOTE
if ($Min > $Max)
$a := $Max
$Max := $Min
$Min := $a
end if
exit
end on
on controller
if ( $CC = 80 )
$note_id := play_note($Max,$cc_1_knob,0,$D uration*1000)
end if
if (%CC[$CC] = 0)
note_off($note_id)
end if
end on
Any pointers would be a great help.
Thanks.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks