• Register
  • Help
Results 1 to 4 of 4

Topic: PIANO K2 harmonic script +SELF MASK - 3.37

Share/Bookmark
  1. #1

    PIANO K2 harmonic script +SELF MASK - 3.37

    Code:
    {*********************************************************
    Symp res pedal up (damper strings free harmonic)
    "the real harmonic script" 
    sounds between keys
    
    Author: O.FRAPPIER
    
    Version: 3.38 -  updated at 03 - 05 - 2005
    
    Retrigger have to be set "on" in ADHSR/Modulation !
    may to be not compatible with others scripts in same rack
    
    Self-mask (Selfmask button): If one repeated Keyboard note is louder than previous ones,
    these ones are masked by this last one. So they are faded out.
    
    out-harm harmonics (out-harm button): fade out previous repeated harmonic
    
    
    If you are a developer and would like to use them in your commercial library, contact me at
    harmonicscript@9online.fr  (for the enhanced version too)
    
    
    "ONLY_HARMONIC" button on -> if tou want use specific samples with this script
    if same harmonic is repeated -> one key - one voice to save polyphoni
    
    "IN_PEDAL_DOWN" harmonics rules still working when pedal down to up 
    
    
    **********************************************************} 
    on init
    
    
    message ("")
    
    declare %note_id[128] 
    declare %note_old_id[128] 
    declare %vel[128] 
    declare %vel_old[128] 
    declare %n[128]  
    declare %m[128]  
    declare %sos_note[128]
    declare $a
    declare $f
    declare $sustain
    declare $sostenuto
    	
      
    {-----GUI-----}
    declare ui_label $name(1,2)
    declare ui_value_edit $Sust_ctr(0,127,1)
    declare ui_value_edit $Sost_ctr(0,127,1)
    declare ui_button $ONLY_HARMONIC
    declare ui_button $IN_PEDAL_DOWN
    
    declare ui_button $3rds_on
    declare ui_button $4ths_on
    declare ui_button $5ths_on
    declare ui_button $8ths_on
    
    declare ui_knob $Selfmask (0, 1000, 1000)
    declare ui_knob $out_harm (0, 1000, 1000)
    
    declare ui_knob $Vol_3rds (0, 100, 1)
    declare ui_knob $Vol_4ths (0, 100, 1) 
    declare ui_knob $Vol_5ths (0, 100, 1) 
    declare ui_knob $Vol_8ths (0, 100, 1) 
    declare ui_knob $fade_in (0, 100, 1) 
    
    declare ui_value_edit $Volh (-4000, 4000, 100)
    
    
    
    declare %3rds_up_1[128]
    declare %4ths_up_1[128]
    declare %5ths_up_1[128]
    declare %8ths_up_1[128]
    
    declare %3rds_up_2[128]
    declare %4ths_up_2[128]
    declare %5ths_up_2[128]
    declare %8ths_up_2[128]
    
    declare %3rds_up_3[128]
    declare %4ths_up_3[128]
    declare %5ths_up_3[128]
    declare %8ths_up_3[128]
    
    declare %3rds_up_4[128]
    declare %4ths_up_4[128]
    declare %5ths_up_4[128]
    
    declare %3rds_dw_1[128]
    declare %4ths_dw_1[128]
    declare %5ths_dw_1[128]
    declare %8ths_dw_1[128]
    
    declare %3rds_dw_2[128]
    declare %4ths_dw_2[128]
    declare %5ths_dw_2[128]
    declare %8ths_dw_2[128]
    
    declare %3rds_dw_3[128]
    declare %4ths_dw_3[128]
    declare %5ths_dw_3[128]
    
    declare %3rds_dw_4[128]
    declare %4ths_dw_4[128]
    declare %5ths_dw_4[128]
    
    {polyphonic rules id}
    declare %event31[128]
    declare %event32[128]
    declare %event33[128]
    declare %event34[128]
    declare %event41[128]
    declare %event42[128]
    declare %event43[128]
    declare %event44[128]
    declare %event51[128]
    declare %event52[128]
    declare %event53[128]
    declare %event54[128]
    declare %event81[128]
    declare %event82[128]
    declare %event83[128]
    
    declare %event231[128]
    declare %event232[128]
    declare %event233[128]
    declare %event234[128]
    declare %event241[128]
    declare %event242[128]
    declare %event243[128]
    declare %event244[128]
    declare %event251[128]
    declare %event252[128]
    declare %event253[128]
    declare %event254[128]
    declare %event281[128]
    declare %event282[128]
    
    declare $kh
    declare $c2
    declare $saut
    declare $octave
    declare $quinte
    declare $quarte
    declare $tierce
    
    	
    	
    	{-----Inits-----}
    set_text( $name, "O.FRAPPIER 3.38" )	
    $Sust_ctr := 64
    $Sost_ctr := 66
    $ONLY_HARMONIC :=0
    $IN_PEDAL_DOWN :=1
    $3rds_on := 1
    $4ths_on := 1
    $5ths_on := 1
    $8ths_on := 1
    $Selfmask :=100
    $out_harm :=250
    $Vol_3rds :=10
    $Vol_4ths :=20
    $Vol_5ths :=50
    $Vol_8ths :=50
    $fade_in :=75
    $Volh := -3000
    $saut := 24
    $octave := 12
    $quarte := 5
    $quinte := 7
    $tierce := 4
    
    	{-----Layout-----}
    	
    	
    move_control ($name, 6,4) 
    
    move_control ($Sust_ctr, 2,6)
    move_control ($Sost_ctr, 1,6)
    move_control ($ONLY_HARMONIC, 5,2)
    move_control ($IN_PEDAL_DOWN, 5,3)
    
    move_control ($3rds_on, 1,1)
    move_control ($4ths_on, 2,1)
    move_control ($5ths_on, 3,1)
    move_control ($8ths_on, 4,1)
    
    move_control ($Vol_3rds, 1,2)
    move_control ($Vol_4ths, 2,2)
    move_control ($Vol_5ths, 3,2)
    move_control ($Vol_8ths, 4,2)
    
    
    move_control ($Selfmask, 3,5)
    move_control ($out_harm, 4,5)
    move_control ($Volh, 6,3)
    	
    	{-----Recall-----}
    	
    make_persistent ($Sost_ctr)
    make_persistent ($Sust_ctr)
    make_persistent ($ONLY_HARMONIC)
    make_persistent ($IN_PEDAL_DOWN)
    make_persistent ($3rds_on)
    make_persistent ($4ths_on)
    make_persistent ($5ths_on)
    make_persistent ($8ths_on)
    make_persistent ($Selfmask)
    make_persistent ($out_harm)
    make_persistent ($Vol_3rds)
    make_persistent ($Vol_4ths)
    make_persistent ($Vol_5ths)
    make_persistent ($Vol_8ths)
    make_persistent ($fade_in)
    make_persistent ($Volh)
    
    end on
    
    on note
    
    	{Self-mask}
    
    %vel_old[$EVENT_NOTE] := 0
    %note_old_id[$EVENT_NOTE] := 0
    %note_old_id[$EVENT_NOTE] :=   %note_id[$EVENT_NOTE]
    %vel_old[$EVENT_NOTE] := %vel[$EVENT_NOTE]
    %note_id[$EVENT_NOTE] := $EVENT_ID
    %vel[$EVENT_NOTE] := $EVENT_VELOCITY
    %n[%vel_old[$EVENT_NOTE]] := %note_old_id[$EVENT_NOTE]
    %m[%vel_old[$EVENT_NOTE]] := %vel_old[$EVENT_NOTE]
    $f := 0
    while($f < 128)
    if (%m[$f] < %vel[$EVENT_NOTE])
    fade_out(%n[$f],$Selfmask*1000,1)
    end if
    inc($f)
    end while
    
            {--------}  
    	
    if ($ONLY_HARMONIC = 1)
    ignore_event($EVENT_ID) 
    end if
    
    $kh := 0
    
    
    if ($sustain = 0 or $IN_PEDAL_DOWN = 1)
    
    
    {3ths}
    if ($3rds_on = 1)
    {tierce asc} 
    if ($EVENT_NOTE-$tierce > 20)
    if (%KEY_DOWN[$EVENT_NOTE-$tierce] = 1)
    %event31[$EVENT_NOTE] := $EVENT_NOTE-$tierce
    $kh := $EVENT_NOTE+$saut
    if ($kh <109)
    fade_out (%3rds_up_1[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_up_1[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_up_1[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_up_1[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    if ($EVENT_NOTE-$tierce-$octave > 20)
    if (%KEY_DOWN[$EVENT_NOTE-$tierce-$octave] = 1)
    %event32[$EVENT_NOTE] := $EVENT_NOTE-$tierce-$octave
    $kh := $EVENT_NOTE+$octave
    if ($kh <109)
    fade_out (%3rds_up_2[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_up_2[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_up_2[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_up_2[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    if ($EVENT_NOTE-$tierce-$saut > 20)
    if (%KEY_DOWN[$EVENT_NOTE-$tierce-$saut ] = 1)
    %event33[$EVENT_NOTE] := $EVENT_NOTE-$tierce-$saut 
    $kh := $EVENT_NOTE
    if ($kh <109)
    fade_out (%3rds_up_3[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_up_3[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_up_3[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_up_3[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    
    if ($EVENT_NOTE-$tierce-$saut-$octave  > 20)
    if (%KEY_DOWN[$EVENT_NOTE-$tierce-$saut-$octave] = 1)
    %event34[$EVENT_NOTE] := $EVENT_NOTE-$tierce-$saut-$octave
    $kh := $EVENT_NOTE
    if ($kh <109)
    fade_out (%3rds_up_4[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_up_4[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_up_4[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_up_4[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    {tierce desc} 
    
    if ($EVENT_NOTE+$tierce > 20)
    if (%KEY_DOWN[$EVENT_NOTE+$tierce] = 1)
    %event231[$EVENT_NOTE] := $EVENT_NOTE+$tierce
    $kh := $EVENT_NOTE+$tierce+$saut
    if ($kh <109)
    fade_out (%3rds_dw_1[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_dw_1[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_dw_1[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_dw_1[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    
    if ($EVENT_NOTE+$tierce+$octave > 20)
    if (%KEY_DOWN[$EVENT_NOTE+$tierce+$octave] = 1)
    %event232[$EVENT_NOTE] := $EVENT_NOTE+$tierce+$octave
    $kh := $EVENT_NOTE+$tierce+$saut
    if ($kh <109)
    fade_out (%3rds_dw_2[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_dw_2[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_dw_2[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_dw_2[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    
    if ($EVENT_NOTE+$tierce+$saut > 20)
    if (%KEY_DOWN[$EVENT_NOTE+$tierce+$saut] = 1)
    %event233[$EVENT_NOTE] := $EVENT_NOTE+$tierce+$saut
    $kh := $EVENT_NOTE+$tierce+$saut
    if ($kh <109)
    fade_out (%3rds_dw_3[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_dw_3[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_dw_3[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_dw_3[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    
    if ($EVENT_NOTE+$tierce+$saut+$octave > 20)
    if (%KEY_DOWN[$EVENT_NOTE+$tierce+$saut+$octave] = 1)
    %event234[$EVENT_NOTE] := $EVENT_NOTE+$tierce+$saut+$octave
    $kh := $EVENT_NOTE+$tierce+$saut
    if ($kh <109)
    fade_out (%3rds_dw_4[$EVENT_NOTE],$out_harm*1000,1)
    %3rds_dw_4[$EVENT_NOTE]  := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %3rds_dw_4[$EVENT_NOTE] , 1000*$fade_in)
    change_vol( %3rds_dw_4[$EVENT_NOTE] ,(($Vol_3rds*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    end if
    {end 3ths}
    
    {4ths}
    if ($4ths_on = 1) 
    {quarte asc}
    if ($EVENT_NOTE-$quarte > 20 ) 
    if (%KEY_DOWN[$EVENT_NOTE-$quarte] = 1)
    %event41[$EVENT_NOTE] := $EVENT_NOTE-$quarte
    $kh := $EVENT_NOTE + $saut -$quarte
    if ($kh <109 )
    fade_out (%4ths_up_1[$EVENT_NOTE],$out_harm*1000,1) 
    %4ths_up_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %4ths_up_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %4ths_up_1[$EVENT_NOTE],(($Vol_4ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$quarte-$octave > 20)
    if (%KEY_DOWN[$EVENT_NOTE-$quarte-$octave] = 1)
    %event42[$EVENT_NOTE] := $EVENT_NOTE-$quarte-$octave
    $kh := $EVENT_NOTE + $saut -$quarte
    if ($kh <109 )
    fade_out (%4ths_up_2[$EVENT_NOTE],$out_harm*1000,1)
    %4ths_up_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %4ths_up_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %4ths_up_2[$EVENT_NOTE],(($Vol_4ths*300)+$Volh*10), 0) 
    end if 
    end if
    end if
    
    {quarte desc} 
    if ($EVENT_NOTE+$quarte <109 ) 
    if (%KEY_DOWN[$EVENT_NOTE+$quarte] = 1)
    %event241[$EVENT_NOTE] := $EVENT_NOTE+$quarte
    $kh := $EVENT_NOTE +$saut
    if ( $kh <109 )
    fade_out (%4ths_dw_1[$EVENT_NOTE],$out_harm*1000,1)
    %4ths_dw_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %4ths_dw_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %4ths_dw_1[$EVENT_NOTE],(($Vol_4ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE+$quarte+$octave <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$quarte+$octave] = 1)
    %event242[$EVENT_NOTE] := $EVENT_NOTE+$quarte+$octave 
    $kh := $EVENT_NOTE +$saut+$octave
    if ( $kh <109 )
    fade_out (%4ths_dw_2[$EVENT_NOTE],$out_harm*1000,1)
    %4ths_dw_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %4ths_dw_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %4ths_dw_2[$EVENT_NOTE],(($Vol_4ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    end if
    {end 4ths}
    
    {5ths}
    
    if ($5ths_on = 1)
    {quinte asc}
    if ($EVENT_NOTE-$quinte > 20) 
    if (%KEY_DOWN[$EVENT_NOTE-$quinte] = 1)
    %event51[$EVENT_NOTE] := $EVENT_NOTE-$quinte
    $kh := $EVENT_NOTE + $octave 
    if ($kh <109 )
    fade_out (%5ths_up_1[$EVENT_NOTE],$out_harm*1000,1) 
    %5ths_up_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_up_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_up_1[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$quinte-$octave > 20) 
    if (%KEY_DOWN[$EVENT_NOTE-$quinte-$octave] = 1)
    %event52[$EVENT_NOTE] := $EVENT_NOTE-$quinte-$octave
    $kh := $EVENT_NOTE 
    if ( $kh <109 )
    fade_out (%5ths_up_2[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_up_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_up_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_up_2[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$quinte-$saut > 20) 
    if (%KEY_DOWN[$EVENT_NOTE-$quinte-$saut] = 1)
    %event53[$EVENT_NOTE] := $EVENT_NOTE-$quinte-$saut
    $kh := $EVENT_NOTE 
    if ( $kh <109 )
    fade_out (%5ths_up_3[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_up_3[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_up_3[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_up_3[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$quinte-$octave-$saut > 20) 
    if (%KEY_DOWN[$EVENT_NOTE-$quinte-$octave-$saut] = 1)
    %event54[$EVENT_NOTE] := $EVENT_NOTE-$quinte-$octave-$saut
    $kh := $EVENT_NOTE 
    if ( $kh <109 )
    fade_out (%5ths_up_4[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_up_4[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_up_4[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_up_4[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if 
    
    {quinte desc}
    if ( $EVENT_NOTE+$quinte <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$quinte] = 1)
    %event251[$EVENT_NOTE] := $EVENT_NOTE+$quinte
    $kh := $EVENT_NOTE +$quinte+$octave
    if ($kh <109 )
    fade_out (%5ths_dw_1[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_dw_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_dw_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_dw_1[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ( $EVENT_NOTE+$quinte+$octave <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$quinte+$octave] = 1)
    %event252[$EVENT_NOTE] := $EVENT_NOTE+$quinte+$octave
    $kh := $EVENT_NOTE +$quinte+$octave
    if ($kh <109 )
    fade_out (%5ths_dw_2[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_dw_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_dw_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_dw_2[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ( $EVENT_NOTE+$quinte+$saut <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$quinte+$saut] = 1)
    %event253[$EVENT_NOTE] := $EVENT_NOTE+$quinte+$saut
    $kh := $EVENT_NOTE +$quinte+$saut
    if ($kh <109 )
    fade_out (%5ths_dw_3[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_dw_3[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_dw_3[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_dw_3[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    
    if ( $EVENT_NOTE+$quinte+$saut+$octave <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$quinte+$saut+$octave] = 1)
    %event254[$EVENT_NOTE] := $EVENT_NOTE+$quinte+$saut+$octave
    $kh := $EVENT_NOTE +$quinte+$saut+$octave
    if ($kh <109 )
    fade_out (%5ths_dw_4[$EVENT_NOTE],$out_harm*1000,1)
    %5ths_dw_4[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %5ths_dw_4[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %5ths_dw_4[$EVENT_NOTE],(($Vol_5ths*300)+$Volh*10), 0)
    end if 
    end if
    end if 
    
    end if
    {end 5ths}
    
    {8ths}
    if ($8ths_on = 1) 
    {octave asc}
    if ($EVENT_NOTE-$octave > 20 ) 
    if (%KEY_DOWN[$EVENT_NOTE-$octave] = 1)
    %event81[$EVENT_NOTE] := $EVENT_NOTE-$octave
    $kh := $EVENT_NOTE 
    if ( $kh <109 )
    fade_out (%8ths_up_1[$EVENT_NOTE],$out_harm*1000,1) 
    %8ths_up_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %8ths_up_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %8ths_up_1[$EVENT_NOTE],(($Vol_8ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$saut > 20 )
    if (%KEY_DOWN[$EVENT_NOTE-$saut] = 1)
    %event82[$EVENT_NOTE]  := $EVENT_NOTE-$saut
    $kh := $EVENT_NOTE 
    if ( $kh <109 )
    fade_out (%8ths_up_2[$EVENT_NOTE],$out_harm*1000,1)
    %8ths_up_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %8ths_up_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %8ths_up_2[$EVENT_NOTE],(($Vol_8ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    if ($EVENT_NOTE-$saut-$octave > 20 )
    if (%KEY_DOWN[$EVENT_NOTE-$saut-$octave] = 1)
    %event83[$EVENT_NOTE]  := $EVENT_NOTE-$saut-$octave
    $kh := $EVENT_NOTE 
    if ($kh <109 )
    fade_out (%8ths_up_3[$EVENT_NOTE],$out_harm*1000,1)
    %8ths_up_3[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %8ths_up_3[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %8ths_up_3[$EVENT_NOTE],(($Vol_8ths*300)+$Volh*10), 0)
    end if 
    end if
    end if
    
    
    {octave desc}
    if ( $EVENT_NOTE+$octave <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$octave] = 1)
    %event281[$EVENT_NOTE]  := $EVENT_NOTE+$octave
    $kh := $EVENT_NOTE + $octave
    if ( $kh <109 )
    fade_out (%8ths_dw_1[$EVENT_NOTE],$out_harm*1000,1) 
    %8ths_dw_1[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %8ths_dw_1[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %8ths_dw_1[$EVENT_NOTE],(($Vol_8ths*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    if ( $EVENT_NOTE+$saut <109 )
    if (%KEY_DOWN[$EVENT_NOTE+$saut] = 1)
    %event282[$EVENT_NOTE]  := $EVENT_NOTE+$saut
    $kh := $EVENT_NOTE +$saut
    if ($kh <109 )
    fade_out (%8ths_dw_2[$EVENT_NOTE],$out_harm*1000,1) 
    %8ths_dw_2[$EVENT_NOTE] := play_note ($kh,$EVENT_VELOCITY,0,-1)
    fade_in( %8ths_dw_2[$EVENT_NOTE], 1000*$fade_in)
    change_vol( %8ths_dw_2[$EVENT_NOTE],(($Vol_8ths*300)+$Volh*10), 0)
    end if 
    end if 
    end if
    
    
    end if
    
    {end 8ths}
    end if
    end on
    
    on release
    
    {all the 88 keys checked on release } 
    $c2 := 21
    while( 20 < $c2 and $c2 < 109)
    {tierce}
    if (%KEY_DOWN[%event31[$c2]] = 0 and %KEY_DOWN[$c2] = 0 )
    note_off( %3rds_up_1[$c2])
    else
    ignore_event(%3rds_up_1[$c2])
    end if
    
    if (%KEY_DOWN[%event32[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_up_2[$c2])
    else
    ignore_event(%3rds_up_2[$c2])
    end if
    
    if (%KEY_DOWN[%event33[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_up_3[$c2])
    else
    ignore_event(%3rds_up_3[$c2])
    end if
    
    if (%KEY_DOWN[%event34[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_up_4[$c2])
    else
    ignore_event(%3rds_up_4[$c2])
    end if
    
    if (%KEY_DOWN[%event231[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_dw_1[$c2])
    else
    ignore_event(%3rds_dw_1[$c2])
    end if
    
    if (%KEY_DOWN[%event232[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_dw_2[$c2])
    else
    ignore_event(%3rds_dw_2[$c2])
    end if
    
    if (%KEY_DOWN[%event233[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_dw_3[$c2])
    else
    ignore_event(%3rds_dw_3[$c2])
    end if
    
    if (%KEY_DOWN[%event234[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %3rds_dw_4[$c2])
    else
    ignore_event(%3rds_dw_4[$c2])
    end if
    
    {quarte}
    
    if (%KEY_DOWN[%event41[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %4ths_up_1[$c2])
    else
    ignore_event(%4ths_up_1[$c2])
    end if
    
    if (%KEY_DOWN[%event42[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %4ths_up_2[$c2])
    else
    ignore_event(%4ths_up_2[$c2])
    end if
    
    if (%KEY_DOWN[%event241[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %4ths_dw_1[$c2])
    else
    ignore_event(%4ths_dw_1[$c2])
    end if
    
    if (%KEY_DOWN[%event242[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %4ths_dw_2[$c2])
    else
    ignore_event(%4ths_dw_2[$c2])
    end if
    
    
    {quinte}
    if (%KEY_DOWN[%event51[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_up_1[$c2])
    else
    ignore_event(%5ths_up_1[$c2])
    end if
    
    if (%KEY_DOWN[%event52[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_up_2[$c2])
    else
    ignore_event(%5ths_up_2[$c2])
    end if
    
    if (%KEY_DOWN[%event53[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_up_3[$c2])
    else
    ignore_event(%5ths_up_3[$c2])
    end if
    
    if (%KEY_DOWN[%event54[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_up_4[$c2])
    else
    ignore_event(%5ths_up_4[$c2])
    end if
    
    if (%KEY_DOWN[%event251[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_dw_1[$c2])
    else
    ignore_event(%5ths_dw_1[$c2])
    end if
    
    if (%KEY_DOWN[%event252[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_dw_2[$c2])
    else
    ignore_event(%5ths_dw_2[$c2])
    end if
    
    if (%KEY_DOWN[%event253[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_dw_3[$c2])
    else
    ignore_event(%5ths_dw_3[$c2])
    end if
    
    if (%KEY_DOWN[%event254[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off( %5ths_dw_4[$c2])
    else
    ignore_event(%5ths_dw_4[$c2])
    end if
    
    
    {octave}
    if (%KEY_DOWN[%event81[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off(%8ths_up_1[$c2])
    else
    ignore_event(%8ths_up_1[$c2])
    end if
    
    if (%KEY_DOWN[%event82[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off(%8ths_up_2[$c2])
    else
    ignore_event(%8ths_up_2[$c2])
    end if
    
    if (%KEY_DOWN[%event83[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off(%8ths_up_3[$c2])
    else
    ignore_event(%8ths_up_3[$c2])
    end if
    
    if (%KEY_DOWN[%event281[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off(%8ths_dw_1[$c2])
    else
    ignore_event(%8ths_dw_1[$c2])
    end if
    
    if (%KEY_DOWN[%event282[$c2]] = 0 and %KEY_DOWN[$c2] = 0)
    note_off(%8ths_dw_2[$c2])
    else
    ignore_event(%8ths_dw_2[$c2])  
    end if
    
    inc($c2)
    end while
    
    
    if ($sostenuto = 1 )
    if (%sos_note[$EVENT_NOTE] = 1)
    ignore_event (%note_id[$EVENT_NOTE])
    else
    fade_out (%note_id[$EVENT_NOTE],400000,1)
    end if
    end if
    
    end on
    
    on controller
    	
    if ($CC_NUM = $Sost_ctr)
    if (%CC[$Sost_ctr] = 127)
    $Sostenuto := 1
    $a := 0
    while($a < 128)
    %sos_note[$a] := %KEY_DOWN[$a]
    inc($a)
    end while
    else
    $Sostenuto := 0
    $a := 0
    while($a < 128)
    %sos_note[$a] := 0
    if ($sustain = 0 and %KEY_DOWN[$a] = 0)
    note_off(%note_id[$a])				
    end if
    inc($a)
    end while			
    end if
    end if
    	
    if ($CC_NUM = $Sust_ctr)
    	
    select (%CC[$Sust_ctr])
    case 0 to 63
    $Sustain := 0	
    $a := 0
    while($a < 128)
    if (%KEY_DOWN[$a] = 0 and %sos_note[$a] = 0)
    note_off(%note_id[$a])
    end if
    inc($a)
    end while
    case 64 to 127
    $Sustain := 1
    end select
    end if
    end on

  2. #2
    Moderator/Developer Brian2112's Avatar
    Join Date
    Nov 2003
    Location
    Out of my Mind
    Posts
    1,858

    Thumbs up Re: PIANO K2 harmonic script +SELF MASK - 3.37

    Beautiful Olivier!

    Thank you so much for sharing! Not only is this a great script, it is very educational for those who are learning the scripting language.

    I have a question for you. I am noticing in Kontakt 2 that I am getting a lot of clicks during playback with some pianos (but I am using 4 convolution IR’s - Pedal Up, Down, Soundboard, and Hall so my CPU is probably just choking – render is fine). Are you turning up your DFD buffers in the instrument rack by chance? I turned mine up to 192 for some pianos.



    Thanks again!

    Brian
    "So what if some parts of life are a crap shoot? Get out there and shoot the crap." -- Neil Peart
    Hint:1.6180339887498948482 Φ

  3. #3

    Re: PIANO K2 harmonic script +SELF MASK - 3.37

    Which pianos? I haven't had this prob with the PMI Old Lady.

    (makes me wonder if I'm not doing something right )


    Quote Originally Posted by Brian2112
    Beautiful Olivier!

    Thank you so much for sharing! Not only is this a great script, it is very educational for those who are learning the scripting language.

    I have a question for you. I am noticing in Kontakt 2 that I am getting a lot of clicks during playback with some pianos (but I am using 4 convolution IR’s - Pedal Up, Down, Soundboard, and Hall so my CPU is probably just choking – render is fine). Are you turning up your DFD buffers in the instrument rack by chance? I turned mine up to 192 for some pianos.



    Thanks again!

    Brian

  4. #4

    Re: PIANO K2 harmonic script +SELF MASK - 3.37

    Hi,

    i'm currently check another script that replace convultion pedal down.

    It's a great script (Kornel MEZZO)

    This script allow -> Self-MASK - symp res pedal up et down
    and no polyph. problems.


    Kornel -> can you post a mp3 demo ?

    Regards,

    Olivier

Go Back to forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •