1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

legato tune problem!

Discussion in 'Scripting Workshop' started by kerem bozkurt, Jun 6, 2019.

  1. kerem bozkurt

    kerem bozkurt NI Product Owner

    Messages:
    30
    help!



    Code:
    on init
    make_perfview
    set_ui_height_px(405)
    set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"icon.png")
    set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"st")
    set_script_title("Byhsnk")
    
    declare $pos
    declare ui_slider $Tune(-50000, 50000)
    $Tune := -50000
    make_persistent($Tune)
    _read_persistent_var($Tune)
    set_control_help($Tune,"This knob controls tune amount in cents -50 +50")
    
    set_control_par_str(get_ui_id($Tune),$CONTROL_PAR_PICTURE,"OrangeKnob")
    set_control_par(get_ui_id($Tune),$CONTROL_PAR_MOUSE_BEHAVIOUR,-150)
    set_control_par(get_ui_id($Tune),$CONTROL_PAR_POS_X,250)
    set_control_par(get_ui_id($Tune),$CONTROL_PAR_POS_Y,285)
    set_control_par_str(get_ui_id($Tune),$CONTROL_PAR_AUTOMATION_NAME,"Tune amount")
    
    
    declare ui_switch $pass
    set_control_par(get_ui_id($pass),$CONTROL_PAR_TEXT_ALIGNMENT,1)
    set_control_par_str(get_ui_id($pass),$CONTROL_PAR_TEXT,"Legato On - Off")
    set_control_par_str(get_ui_id($pass),$CONTROL_PAR_PICTURE,"")
    set_control_par(get_ui_id($pass),$CONTROL_PAR_FONT_TYPE,0)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_TEXTPOS_Y,2)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_TEXT_ALIGNMENT,1)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_WIDTH,150)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_HEIGHT,20)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_POS_X,435)
    set_control_par(get_ui_id($pass),$CONTROL_PAR_POS_Y,1)
    make_persistent($pass)
    
    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_knob $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 while
    
    
    
    
    end on
    
    on ui_control($pass)
    note_off($ALL_EVENTS)
    
    end on
    
    on note
    
    
    
    
    if( $pass= 0)
    exit
    else
    
    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 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
    
    
    
     

    Attached Files:

    • RRTT.png
      RRTT.png
      File size:
      18.2 KB
      Views:
      207
    Last edited: Jun 8, 2019
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Cannot help with compiled code and non-english posts. :) Post uncompiled code.
     
  3. kerem bozkurt

    kerem bozkurt NI Product Owner

    Messages:
    30
    can you help with this?

    my english is not good?

    prob.png prob2.png
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    I cannot. Post uncompiled code from SublimeKSP.
     
  5. kerem bozkurt

    kerem bozkurt NI Product Owner

    Messages:
    30
    i finally did......
     
  6. Turan Ascioglu

    Turan Ascioglu New Member

    Messages:
    2
    Merahab Mehmet,

    Script'in ilgimi cekti.
    Ne ise yariyor?

    saygilar
     
  7. kerem bozkurt

    kerem bozkurt NI Product Owner

    Messages:
    30
    kardeşim yeni gördüm uzun zamandır buraya girmiyordum portamento işlevi yapıyor ben bunu nasıl koma vermek için tune işlemi nasıl yaparım diye atmıştım sonra kendim yapmak zorunda kaldım sorunumu o şekilde çözdüm nki çalışmalarında olduğu zaman seslerde güzel performans sağlıyor bir yandan legato görevini de yapıyor
     
  8. Turan Ascioglu

    Turan Ascioglu New Member

    Messages:
    2
    Selam kardeş,

    Uzun zaman oldu.
    Bende script isiyle ugrasiyorum.
    Senin scripte benzer bi script yaptim.
    Soyle aciklayim kisaca;
    Tus 1 basik tutarak tus 2 ye basiyorsun.
    Hizli basinca hizli portamento, yavas basinca yavas portamento. Yani velocity gucune gore kaydirmayi ayarliyorum. Guzel oldu simdilik.

    Bak ne dicem. Bana whatsapp numarani versen, ordan hem tanissak sohbet etsek, hem de fikir paylassak? Ne dersin?
    Benim numaram +32 484 148 960
    Belcikada yasiyorum, 30 senedir sahne muzisyeniyim, IT/server/network mühendisiyim, muzigi de seviyorum :)
    Saygilar