0% found this document useful (0 votes)
74 views10 pages

Microtuning Script Setup

This document declares variables and controls for a microtuning user interface script. It declares constants, labels, buttons, tables and value editors for adjusting tuning parameters. The controls are positioned on the interface. Variables are linked to store tuning values and IDs of the controls.

Uploaded by

Mohamed Kaleb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views10 pages

Microtuning Script Setup

This document declares variables and controls for a microtuning user interface script. It declares constants, labels, buttons, tables and value editors for adjusting tuning parameters. The controls are positioned on the interface. Variables are linked to store tuning values and IDs of the controls.

Uploaded by

Mohamed Kaleb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

on init

declare $yjjle
declare $q3qgi
declare $t0rma
declare $vlhs0
set_script_title("Microtuning")
set_ui_height(310)
declare const $tefrp := 0
declare const $trcbl := 1
declare const $wmzyu := 0
declare const $fxomi := 1
declare $tr3sa
declare $arzi3
declare polyphonic $osexa
declare polyphonic $t3plg
declare polyphonic $pjym5
declare polyphonic $tyl32
declare polyphonic $up5bg
declare polyphonic $3lw1k
declare $gfsjw
declare $ondkz
declare $3bcqb
declare $io0ek
declare $w3nmh
declare $jiyzb
declare !xxiit[12]
!xxiit[0] := "C"
!xxiit[1] := "C#"
!xxiit[2] := "D"
!xxiit[3] := "D#"
!xxiit[4] := "E"
!xxiit[5] := "F"
!xxiit[6] := "F#"
!xxiit[7] := "G"
!xxiit[8] := "G#"
!xxiit[9] := "A"
!xxiit[10] := "A#"
!xxiit[11] := "B"
declare %cc0vd[12] := (0, 11730, 3910, 15640, -13690, -1960, -17490, 1960, 13690, -
15640, -3910, -11730)
declare $ahizh
declare $mij4l
declare %tuning[12]
declare $hzhi0 := 0
make_persistent($hzhi0)
read_persistent_var($hzhi0)
$tr3sa := 1
$arzi3 := 1
declare ui_label $2vgfp(4, 1)
set_text($2vgfp,"Microtuning")
move_control($2vgfp,$tr3sa,$arzi3)
$tr3sa := $tr3sa+4
declare ui_button $us0b2
set_control_par(get_ui_id($us0b2),$CONTROL_PAR_TEXT_ALIGNMENT,1)
set_text($us0b2,"LOAD Preset")
set_control_help($us0b2,"Loads tuning settings from an external file.")
move_control($us0b2,$tr3sa,$arzi3)
$tr3sa := $tr3sa+1
declare ui_button $advp2
set_control_par(get_ui_id($advp2),$CONTROL_PAR_TEXT_ALIGNMENT,1)
set_text($advp2,"SAVE Preset")
set_control_help($advp2,"Saves the current tuning settings to an external file.")
move_control($advp2,$tr3sa,$arzi3)
$arzi3 := $arzi3+1
$tr3sa := 1
declare ui_label $neigj(6, 1)
move_control($neigj,$tr3sa,$arzi3)
$arzi3 := $arzi3+1
declare ui_table %pnpxr[12](6, 4, -100000)
make_persistent(%pnpxr)
read_persistent_var(%pnpxr)
move_control(%pnpxr,$tr3sa,$arzi3)
set_control_help(%pnpxr,"Sets the tuning per note, measured in millicents.")
declare %lxlts[12]
declare ui_value_edit $daxfm(-100000, 100000, 1000)
set_control_par(get_ui_id($daxfm),$CONTROL_PAR_WIDTH,60)
if (1<1)
$gfsjw := 1
else
if (1>12)
$gfsjw := 12
else
$gfsjw := 1
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($daxfm),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($daxfm),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($daxfm),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($daxfm),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($daxfm,"")
%lxlts[1-1] := get_ui_id($daxfm)
declare ui_value_edit $xaxvq(-100000, 100000, 1000)
set_control_par(get_ui_id($xaxvq),$CONTROL_PAR_WIDTH,60)
if (2<1)
$gfsjw := 1
else
if (2>12)
$gfsjw := 12
else
$gfsjw := 2
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($xaxvq),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($xaxvq),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($xaxvq),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($xaxvq),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($xaxvq,"")
%lxlts[2-1] := get_ui_id($xaxvq)
declare ui_value_edit $ky2yd(-100000, 100000, 1000)
set_control_par(get_ui_id($ky2yd),$CONTROL_PAR_WIDTH,60)
if (3<1)
$gfsjw := 1
else
if (3>12)
$gfsjw := 12
else
$gfsjw := 3
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($ky2yd),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($ky2yd),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($ky2yd),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($ky2yd),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($ky2yd,"")
%lxlts[3-1] := get_ui_id($ky2yd)
declare ui_value_edit $5vttr(-100000, 100000, 1000)
set_control_par(get_ui_id($5vttr),$CONTROL_PAR_WIDTH,60)
if (4<1)
$gfsjw := 1
else
if (4>12)
$gfsjw := 12
else
$gfsjw := 4
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($5vttr),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($5vttr),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($5vttr),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($5vttr),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($5vttr,"")
%lxlts[4-1] := get_ui_id($5vttr)
declare ui_value_edit $0uk5x(-100000, 100000, 1000)
set_control_par(get_ui_id($0uk5x),$CONTROL_PAR_WIDTH,60)
if (5<1)
$gfsjw := 1
else
if (5>12)
$gfsjw := 12
else
$gfsjw := 5
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($0uk5x),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($0uk5x),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($0uk5x),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($0uk5x),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($0uk5x,"")
%lxlts[5-1] := get_ui_id($0uk5x)
declare ui_value_edit $wy04o(-100000, 100000, 1000)
set_control_par(get_ui_id($wy04o),$CONTROL_PAR_WIDTH,60)
if (6<1)
$gfsjw := 1
else
if (6>12)
$gfsjw := 12
else
$gfsjw := 6
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($wy04o),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($wy04o),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($wy04o),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($wy04o),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($wy04o,"")
%lxlts[6-1] := get_ui_id($wy04o)
declare ui_value_edit $q5r0l(-100000, 100000, 1000)
set_control_par(get_ui_id($q5r0l),$CONTROL_PAR_WIDTH,60)
if (7<1)
$gfsjw := 1
else
if (7>12)
$gfsjw := 12
else
$gfsjw := 7
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($q5r0l),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($q5r0l),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($q5r0l),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($q5r0l),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($q5r0l,"")
%lxlts[7-1] := get_ui_id($q5r0l)
declare ui_value_edit $rcs1g(-100000, 100000, 1000)
set_control_par(get_ui_id($rcs1g),$CONTROL_PAR_WIDTH,60)
if (8<1)
$gfsjw := 1
else
if (8>12)
$gfsjw := 12
else
$gfsjw := 8
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($rcs1g),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($rcs1g),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($rcs1g),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($rcs1g),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($rcs1g,"")
%lxlts[8-1] := get_ui_id($rcs1g)
declare ui_value_edit $p0avx(-100000, 100000, 1000)
set_control_par(get_ui_id($p0avx),$CONTROL_PAR_WIDTH,60)
if (9<1)
$gfsjw := 1
else
if (9>12)
$gfsjw := 12
else
$gfsjw := 9
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($p0avx),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($p0avx),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($p0avx),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($p0avx),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($p0avx,"")
%lxlts[9-1] := get_ui_id($p0avx)
declare ui_value_edit $ps4ra(-100000, 100000, 1000)
set_control_par(get_ui_id($ps4ra),$CONTROL_PAR_WIDTH,60)
if (10<1)
$gfsjw := 1
else
if (10>12)
$gfsjw := 12
else
$gfsjw := 10
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($ps4ra),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($ps4ra),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($ps4ra),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($ps4ra),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($ps4ra,"")
%lxlts[10-1] := get_ui_id($ps4ra)
declare ui_value_edit $l0y1w(-100000, 100000, 1000)
set_control_par(get_ui_id($l0y1w),$CONTROL_PAR_WIDTH,60)
if (11<1)
$gfsjw := 1
else
if (11>12)
$gfsjw := 12
else
$gfsjw := 11
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($l0y1w),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($l0y1w),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($l0y1w),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($l0y1w),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($l0y1w,"")
%lxlts[11-1] := get_ui_id($l0y1w)
declare ui_value_edit $rfcv5(-100000, 100000, 1000)
set_control_par(get_ui_id($rfcv5),$CONTROL_PAR_WIDTH,60)
if (12<1)
$gfsjw := 1
else
if (12>12)
$gfsjw := 12
else
$gfsjw := 12
end if
end if
$gfsjw := ($gfsjw-1)*(500-0)/(12-1)+0
set_control_par(get_ui_id($rfcv5),$CONTROL_PAR_POS_X,60+$gfsjw)
set_control_par(get_ui_id($rfcv5),$CONTROL_PAR_POS_Y,123)
set_control_par(get_ui_id($rfcv5),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
set_control_par(get_ui_id($rfcv5),$CONTROL_PAR_SHOW_ARROWS,0)
set_text($rfcv5,"")
%lxlts[12-1] := get_ui_id($rfcv5)
$arzi3 := $arzi3+5
declare ui_label $kertn(1, 1)
set_control_par(get_ui_id($kertn),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($kertn,$tr3sa,$arzi3)
set_text($kertn,"Tuning Baseline")
$tr3sa := $tr3sa+1
declare ui_label $3w5ij(1, 1)
set_control_par(get_ui_id($3w5ij),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($3w5ij,$tr3sa,$arzi3)
set_text($3w5ij,"Key Center")
$tr3sa := $tr3sa+1
declare ui_label $3oznf(1, 1)
set_control_par(get_ui_id($3oznf),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($3oznf,$tr3sa,$arzi3)
set_text($3oznf,"Tuning Amount")
$tr3sa := $tr3sa+1
declare ui_label $g40yn(1, 1)
set_control_par(get_ui_id($g40yn),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($g40yn,$tr3sa,$arzi3)
set_text($g40yn,"Realtime Update")
$tr3sa := $tr3sa+1
declare ui_label $qpl2v(1, 1)
set_control_par(get_ui_id($qpl2v),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($qpl2v,$tr3sa,$arzi3)
set_text($qpl2v,"Script Mode")
$arzi3 := $arzi3+1
$tr3sa := 1
declare ui_menu $uwemh
set_control_par(get_ui_id($uwemh),$CONTROL_PAR_TEXT_ALIGNMENT,1)
add_menu_item($uwemh,"Equal",0)
add_menu_item($uwemh,"Pure",1)
make_persistent($uwemh)
read_persistent_var($uwemh)
move_control($uwemh,$tr3sa,$arzi3)
set_control_help($uwemh,"Sets whether the tuning is based on equal temperament or
pure intonation.")
$tr3sa := $tr3sa+1
declare ui_menu $kjeew
set_control_par(get_ui_id($kjeew),$CONTROL_PAR_TEXT_ALIGNMENT,1)
$gfsjw := 0
while ($gfsjw<=11)
add_menu_item($kjeew,!xxiit[$gfsjw],$gfsjw)
inc($gfsjw)
end while
make_persistent($kjeew)
read_persistent_var($kjeew)
move_control($kjeew,$tr3sa,$arzi3)
set_control_help($kjeew,"Changes the reference point for the tuning.")
$tr3sa := $tr3sa+1
declare ui_slider $50r2n(0, 100)
make_persistent($50r2n)
read_persistent_var($50r2n)
move_control($50r2n,$tr3sa,$arzi3)
set_control_help($50r2n,"Adjusts the overall tuning adjustment amount.")
$tr3sa := $tr3sa+1
declare ui_switch $3edg1
set_text($3edg1,"Enabled")
set_control_par(get_ui_id($3edg1),$CONTROL_PAR_TEXT_ALIGNMENT,1)
move_control($3edg1,$tr3sa,$arzi3)
set_control_help($3edg1,"Updates the tuning in realtime rather than only when
samples are initially triggered.")
make_persistent($3edg1)
read_persistent_var($3edg1)
$tr3sa := $tr3sa+1
declare %uuvtj[3] := (18, 19, 20)
declare $m1pij
declare ui_menu $zpiks
set_control_par(get_ui_id($zpiks),$CONTROL_PAR_TEXT_ALIGNMENT,1)
$gfsjw := 0
while ($gfsjw<num_elements(%uuvtj))
add_menu_item($zpiks,"Mode " & ($gfsjw+1),$gfsjw)
inc($gfsjw)
end while
make_persistent($zpiks)
read_persistent_var($zpiks)
move_control($zpiks,$tr3sa,$arzi3)
set_control_help($zpiks,"Changes modes for better compatibility with other
scripts.")
declare polyphonic $rjlhd
declare polyphonic $olsyw
declare @ntgx3
declare @nu3eg
@ntgx3 := " "
@nu3eg := " "
$gfsjw := 0
while ($gfsjw<=11)
@ntgx3 := @ntgx3 & @nu3eg & !xxiit[($gfsjw+$kjeew) mod 12] & @nu3eg
inc($gfsjw)
end while
set_control_par_str(get_ui_id($neigj),$CONTROL_PAR_TEXT,@ntgx3)
$m1pij := %uuvtj[$zpiks]
$gfsjw := 0
while ($gfsjw<=11)
set_control_par(%lxlts[$gfsjw],$CONTROL_PAR_VALUE,%pnpxr[$gfsjw])
inc($gfsjw)
end while
declare const $lssec := 200
declare %4cl4n[$lssec]
declare $jxwtb
if ($hzhi0=0)
$50r2n := 100
end if
$hzhi0 := 1
message("")
make_perfview
declare polyphonic $2wn5t
end on
function refresh_fine_tuners
$gfsjw := 0
while ($gfsjw<=11)
set_control_par(%lxlts[$gfsjw],$CONTROL_PAR_VALUE,%pnpxr[$gfsjw])
inc($gfsjw)
end while
end function
function refresh_event_par_mode
$m1pij := %uuvtj[$zpiks]
end function
function refresh_tuning_table_labels
@ntgx3 := " "
@nu3eg := " "
$gfsjw := 0
while ($gfsjw<=11)
@ntgx3 := @ntgx3 & @nu3eg & !xxiit[($gfsjw+$kjeew) mod 12] & @nu3eg
inc($gfsjw)
end while
set_control_par_str(get_ui_id($neigj),$CONTROL_PAR_TEXT,@ntgx3)
end function
function refresh_realtime_tuning
if ($3edg1=$trcbl)
get_event_ids(%4cl4n)
$gfsjw := 0
while ($gfsjw<$lssec)
$jxwtb := %4cl4n[$gfsjw]
$ondkz := (get_event_par($jxwtb,$EVENT_PAR_NOTE)-$kjeew+12) mod 12
if ($50r2n<0)
$3bcqb := 0
else
if ($50r2n>100)
$3bcqb := 100
else
$3bcqb := $50r2n
end if
end if
$3bcqb := ($3bcqb-0)*(%pnpxr[$ondkz]-0)/(100-0)+0
if ($uwemh=1)
$3bcqb := $3bcqb+%cc0vd[$ondkz]
end if
$io0ek := get_event_par($jxwtb,$m1pij)
$io0ek := $3bcqb-get_event_par($jxwtb,$m1pij)
change_tune($jxwtb,$io0ek,1)
set_event_par($jxwtb,$m1pij,$3bcqb)
inc($gfsjw)
end while
end if
end function
on ui_control($us0b2)
$ahizh := load_array(%tuning,0)
end on
on ui_control($advp2)
$gfsjw := 0
while ($gfsjw<num_elements(%tuning))
%tuning[$gfsjw] := %pnpxr[$gfsjw]
inc($gfsjw)
end while
$mij4l := save_array(%tuning,0)
end on
on async_complete
if ($NI_ASYNC_ID=$ahizh)
$ahizh := -1
$us0b2 := 0
if ($NI_ASYNC_EXIT_STATUS=1)
$gfsjw := 0
while ($gfsjw<num_elements(%tuning))
%pnpxr[$gfsjw] := %tuning[$gfsjw]
inc($gfsjw)
end while
call refresh_realtime_tuning
call refresh_fine_tuners
end if
end if
if ($NI_ASYNC_ID=$mij4l)
$mij4l := -1
$advp2 := 0
end if
end on
on ui_control($3edg1)
call refresh_realtime_tuning
end on
on ui_control($uwemh)
call refresh_realtime_tuning
end on
on ui_control(%pnpxr)
call refresh_realtime_tuning
call refresh_fine_tuners
end on
on ui_control($50r2n)
call refresh_realtime_tuning
end on
on ui_control($zpiks)
call refresh_event_par_mode
call refresh_realtime_tuning
end on
on ui_control($kjeew)
call refresh_tuning_table_labels
call refresh_realtime_tuning
end on
on note
$rjlhd := ($EVENT_NOTE-$kjeew+12) mod 12
if ($50r2n<0)
$olsyw := 0
else
if ($50r2n>100)
$olsyw := 100
else
$olsyw := $50r2n
end if
end if
$olsyw := ($olsyw-0)*(%pnpxr[$rjlhd]-0)/(100-0)+0
if ($uwemh=1)
$olsyw := $olsyw+%cc0vd[$rjlhd]
end if
$2wn5t := get_event_par($EVENT_ID,$m1pij)
$2wn5t := $olsyw-get_event_par($EVENT_ID,$m1pij)
change_tune($EVENT_ID,$2wn5t,1)
set_event_par($EVENT_ID,$m1pij,$olsyw)
end on
on ui_control($daxfm)
%pnpxr[1-1] := $daxfm
call refresh_realtime_tuning
end on
on ui_control($xaxvq)
%pnpxr[2-1] := $xaxvq
call refresh_realtime_tuning
end on
on ui_control($ky2yd)
%pnpxr[3-1] := $ky2yd
call refresh_realtime_tuning
end on
on ui_control($5vttr)
%pnpxr[4-1] := $5vttr
call refresh_realtime_tuning
end on
on ui_control($0uk5x)
%pnpxr[5-1] := $0uk5x
call refresh_realtime_tuning
end on
on ui_control($wy04o)
%pnpxr[6-1] := $wy04o
call refresh_realtime_tuning
end on
on ui_control($q5r0l)
%pnpxr[7-1] := $q5r0l
call refresh_realtime_tuning
end on
on ui_control($rcs1g)
%pnpxr[8-1] := $rcs1g
call refresh_realtime_tuning
end on
on ui_control($p0avx)
%pnpxr[9-1] := $p0avx
call refresh_realtime_tuning
end on
on ui_control($ps4ra)
%pnpxr[10-1] := $ps4ra
call refresh_realtime_tuning
end on
on ui_control($l0y1w)
%pnpxr[11-1] := $l0y1w
call refresh_realtime_tuning
end on
on ui_control($rfcv5)
%pnpxr[12-1] := $rfcv5
call refresh_realtime_tuning
end on

You might also like