hello
Someone may know how to make a button or KNOB or SWICHE
Play for POLY mode with one click
the same program + POLY mode
on init
declare const $pitch_change_interval := 100
declare $glide_on
declare $currentnote_id
declare $newnote_id
declare $oldnote1_id
declare $oldnote2_id
declare $oldnote3_id
declare $current_pitch
declare $target_pitch
declare $pitch_shift
declare $actual_glide
declare $interval_cents
declare polyphonic $this_id
declare ui_knob $Glide(1000, 1000000, 1000000)
declare ui_knob $Start(0, 1000000, 1000000)
declare ui_knob $Scaling(100, 1000, 100)
declare ui_value_edit $Threshold(0, 127, 1)
$Glide := 120000
$Start := 5000
$Scaling := 125
$Threshold := 12
move_control($Glide,1,1)
move_control($Start,2,1)
move_control($Scaling,3,1)
move_control($Threshold,4,1)
make_persistent($Start)
make_persistent($Glide)
make_persistent($Scaling)
make_persistent($Threshold)
message("")
end on
on note
if ($glide_on=1)
ignore_event($EVENT_ID)
$newnote_id := play_note($EVENT_NOTE,$EVENT_VELOCITY,$Start,-1)
$this_id := $newnote_id
change_tune($newnote_id,$current_pitch-($EVENT_NOTE*100000),0)
$target_pitch := $EVENT_NOTE*100000
$interval_cents := abs($target_pitch/1000-($current_pitch/1000))
if ($interval_cents>($Threshold*100))
$interval_cents := $Threshold*100
end if
$actual_glide := $Glide+($Glide*$interval_cents/1200*($Scaling-100)/100)
fade_out($newnote_id,0,1)
fade_in($newnote_id,$actual_glide)
fade_out($currentnote_id,$actual_glide,1)
note_off($oldnote3_id)
$oldnote3_id := $oldnote2_id
$oldnote2_id := $oldnote1_id
$oldnote1_id := $currentnote_id
$currentnote_id := $newnote_id
$pitch_shift := ($target_pitch-$current_pitch)/($actual_glide/$pitch_change_interval)
wait($pitch_change_interval)
while (abs($target_pitch-$current_pitch)>abs($pitch_shift))
if ($currentnote_id=$this_id)
change_tune($currentnote_id,$pitch_shift,1)
change_tune($oldnote1_id,$pitch_shift,1)
change_tune($oldnote2_id,$pitch_shift,1)
change_tune($oldnote3_id,$pitch_shift,1)
$current_pitch := $current_pitch+$pitch_shift
wait($pitch_change_interval)
else
exit
end if
end while
if ($currentnote_id=$this_id)
$pitch_shift := $target_pitch-$current_pitch
change_tune($currentnote_id,$pitch_shift,1)
change_tune($oldnote1_id,$pitch_shift,1)
change_tune($oldnote2_id,$pitch_shift,1)
change_tune($oldnote3_id,$pitch_shift,1)
$current_pitch := $target_pitch
end if
else
$currentnote_id := $EVENT_ID
$current_pitch := $EVENT_NOTE*100000
$glide_on := 1
end if
end on
on release
if ($EVENT_ID=$currentnote_id)
$glide_on := 0
note_off($oldnote3_id)
note_off($oldnote2_id)
note_off($oldnote1_id)
$current_pitch := $target_pitch
end if
if ($glide_on=1 and ($EVENT_ID # $oldnote3_id))
ignore_event($EVENT_ID)
wait($Glide)
note_off($EVENT_ID)
end if
end on