[go: up one dir, main page]

0% found this document useful (0 votes)
28 views37 pages

Script 1

The document outlines the initialization and configuration of a front panel for a sound synthesis application, including the declaration of various parameters and user interface controls. It defines sliders and switches for manipulating wave shapes, pitch, filters, and envelope settings, ensuring persistent storage of values. The setup allows for interactive control over sound parameters, enhancing user experience in sound design.

Uploaded by

tito rosales
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)
28 views37 pages

Script 1

The document outlines the initialization and configuration of a front panel for a sound synthesis application, including the declaration of various parameters and user interface controls. It defines sliders and switches for manipulating wave shapes, pitch, filters, and envelope settings, ensuring persistent storage of values. The setup allows for interactive control over sound parameters, enhancing user experience in sound design.

Uploaded by

tito rosales
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
You are on page 1/ 37

on init

make_perfview
set_script_title("FRONT PANEL")
set_ui_height_px(350)

message("")
declare $count
declare $group_count :=1
declare $contamination_count :=1

declare const $ROOT_X := 66


declare const $ROOT_Y := 2
declare const $GRID_X := 92
declare const $GRID_Y := 21
declare const $FONT_ID := 1
declare const $CREATE_AUTOMATION_ID := 0

declare $random
declare $random2
declare $newnote
declare $newnote2
declare $offset
declare $new_id
declare $old_velocity

pgs_create_key(GLITCH_ACTIVATED,1)

pgs_set_key_val(GLITCH_ACTIVATED,0,0)

{====================DECLARING THE BEHIND-THE-SCENES VALUES FOR THE


PARAMETERS=================}

declare $wave_shape_1
declare $wave_shape_2
declare $wave_shape_3
declare $coarse_pitch_1
declare $coarse_pitch_2
declare $coarse_pitch_3
declare $fine_pitch_1
declare $fine_pitch_2
declare $fine_pitch_3
declare $hpf_1
declare $hpf_2
declare $hpf_3
declare $drive_1
declare $drive_2
declare $drive_3

make_persistent ($wave_shape_1)
make_persistent ($wave_shape_2)
make_persistent ($wave_shape_3)
make_persistent ($coarse_pitch_1)
make_persistent ($coarse_pitch_2)
make_persistent ($coarse_pitch_3)
make_persistent ($fine_pitch_1)
make_persistent ($fine_pitch_2)
make_persistent ($fine_pitch_3)
make_persistent ($hpf_1)
make_persistent ($hpf_2)
make_persistent ($hpf_3)
make_persistent ($drive_1)
make_persistent ($drive_2)
make_persistent ($drive_3)

declare $attack_1
declare $attack_2
declare $attack_3
declare $decay_1
declare $decay_2
declare $decay_3
declare $sustain_1
declare $sustain_2
declare $sustain_3
declare $release_1
declare $release_2
declare $release_3
declare $amp_lfo_speed_1
declare $amp_lfo_speed_2
declare $amp_lfo_speed_3
declare $amp_lfo_depth_1
declare $amp_lfo_depth_2
declare $amp_lfo_depth_3

make_persistent ($attack_1)
make_persistent ($attack_2)
make_persistent ($attack_3)
make_persistent ($decay_1)
make_persistent ($decay_2)
make_persistent ($decay_3)
make_persistent ($sustain_1)
make_persistent ($sustain_2)
make_persistent ($sustain_3)
make_persistent ($release_1)
make_persistent ($release_2)
make_persistent ($release_3)
make_persistent ($amp_lfo_speed_1)
make_persistent ($amp_lfo_speed_2)
make_persistent ($amp_lfo_speed_3)
make_persistent ($amp_lfo_depth_1)
make_persistent ($amp_lfo_depth_2)
make_persistent ($amp_lfo_depth_3)

{=================================BLUE PANEL
CONTROLS==========================================}

declare ui_slider $alpha_dial (1, 32)


make_persistent ($alpha_dial)
set_control_help($alpha_dial,"Selects the Wave Shape for the currently
active Wave.")
set_control_par_str(get_ui_id($alpha_dial), $CONTROL_PAR_PICTURE,
"rr_ht_alpha_dial")
set_control_par(get_ui_id($alpha_dial),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1500)
set_control_par(get_ui_id($alpha_dial),$CONTROL_PAR_DEFAULT_VALUE,1)
move_control_px($alpha_dial, ($GRID_X * 3)-26+41, ($GRID_Y * 3) +2)

declare ui_slider $wave_shape_display (1,32)


make_persistent ($wave_shape_display)
set_control_par_str (get_ui_id($wave_shape_display), $CONTROL_PAR_PICTURE,
"rr_ht_waveshapes")
set_control_par(get_ui_id($wave_shape_display), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($wave_shape_display), $CONTROL_PAR_WIDTH, 30)
set_control_par(get_ui_id($wave_shape_display),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1)
move_control_px($wave_shape_display, ($GRID_X * 1)+95+52, ($GRID_Y * 7) -53)

{=================COARSE PITCH====================}

declare ui_slider $coarse_pitch_knob (-12, 12)


make_persistent ($coarse_pitch_knob)
set_control_help($coarse_pitch_knob,"Tunes the currently active Wave in
semitones, from one octave down to one octave up.")
set_control_par_str(get_ui_id($coarse_pitch_knob),
$CONTROL_PAR_PICTURE, "rr_ht_knob_small")
set_control_par(get_ui_id($coarse_pitch_knob),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
set_control_par(get_ui_id($coarse_pitch_knob),
$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($coarse_pitch_knob, ($GRID_X * 1)-55, ($GRID_Y * 7) -23)

declare ui_slider $coarse_pitch_display (-12,12)


make_persistent ($coarse_pitch_display)
set_control_par_str (get_ui_id($coarse_pitch_display), $CONTROL_PAR_PICTURE,
"rr_ht_numbers_list_coarse")
set_control_par(get_ui_id($coarse_pitch_display), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($coarse_pitch_display), $CONTROL_PAR_WIDTH, 30)
set_control_par(get_ui_id($coarse_pitch_display),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1)
move_control_px($coarse_pitch_display, ($GRID_X * 1)-10-51, ($GRID_Y * 7) -
53)

{=================FINE PITCH====================}

declare ui_slider $fine_pitch_knob (-99, 99)


make_persistent ($fine_pitch_knob)
set_control_help($fine_pitch_knob,"Fine-tunes the currently active
Wave, to detune it against the other Waves.")
set_control_par_str(get_ui_id($fine_pitch_knob), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($fine_pitch_knob),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
set_control_par(get_ui_id($fine_pitch_knob),
$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($fine_pitch_knob, ($GRID_X * 1)-4, ($GRID_Y * 7) -23)

declare ui_slider $fine_pitch_display (-99,99)


make_persistent ($fine_pitch_display)
set_control_par_str (get_ui_id($fine_pitch_display), $CONTROL_PAR_PICTURE,
"rr_ht_numbers_list_long")
set_control_par(get_ui_id($fine_pitch_display), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($fine_pitch_display), $CONTROL_PAR_WIDTH, 30)
set_control_par(get_ui_id($fine_pitch_display),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1)
move_control_px($fine_pitch_display, ($GRID_X * 1)-9, ($GRID_Y * 7) -53)

{=================HPF====================}

declare ui_slider $hpf_knob (0, 99)


make_persistent ($hpf_knob)
set_control_help($hpf_knob,"Adjusts the cutoff of the High Pass Filter
applied to the currently active Wave. Useful for thinning the sound.")
set_control_par_str(get_ui_id($hpf_knob), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($hpf_knob),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1500)
set_control_par(get_ui_id($hpf_knob),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($hpf_knob, ($GRID_X * 1)+51, ($GRID_Y * 7) -23)

declare ui_slider $hpf_display (0,99)


make_persistent ($hpf_display)
set_control_par_str (get_ui_id($hpf_display), $CONTROL_PAR_PICTURE,
"rr_ht_numbers_list_short")
set_control_par(get_ui_id($hpf_display), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($hpf_display), $CONTROL_PAR_WIDTH, 30)
set_control_par(get_ui_id($hpf_display),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1)
move_control_px($hpf_display, ($GRID_X * 1)+45, ($GRID_Y * 7) -53)

{=================DRIVE====================}

declare ui_slider $drive_knob (0, 99)


make_persistent ($drive_knob)
set_control_help($drive_knob,"Overdrives the output circuit of the
currently active Wave, leading to a harsher, more distorted sound.")
set_control_par_str(get_ui_id($drive_knob), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($drive_knob),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1500)
set_control_par(get_ui_id($drive_knob),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($drive_knob, ($GRID_X * 1)+51+50, ($GRID_Y * 7) -23)

declare ui_slider $drive_display (0,99)


make_persistent ($drive_display)
set_control_par_str (get_ui_id($drive_display), $CONTROL_PAR_PICTURE,
"rr_ht_numbers_list_short")
set_control_par(get_ui_id($drive_display), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($drive_display), $CONTROL_PAR_WIDTH, 30)
set_control_par(get_ui_id($drive_display),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1)
move_control_px($drive_display, ($GRID_X * 1)+95, ($GRID_Y * 7) -53)

{==================================WAVE SELECTOR
BUTTONS=======================================}

declare ui_switch $wave_1_active


set_control_par_str (get_ui_id($wave_1_active), $CONTROL_PAR_PICTURE,
"rr_ht_button_blue")
set_control_par_str (get_ui_id($wave_1_active), $CONTROL_PAR_TEXT, "")
set_control_par(get_ui_id($wave_1_active), $CONTROL_PAR_HEIGHT, 58)
set_control_par(get_ui_id($wave_1_active), $CONTROL_PAR_WIDTH, 74)
make_persistent($wave_1_active)
move_control_px($wave_1_active, ($GRID_X * 1)-8, ($GRID_Y * 1) +0)
set_control_help($wave_1_active, "Switches the front panel to control the
editing parameters for Wave 1. Note that the Sub oscillator tracks one octave below
Wave 1, and shares its Envelope settings.")

declare ui_slider $wave_1_led (0,1)


make_persistent ($wave_1_led)
read_persistent_var ($wave_1_led)
if ($wave_1_led =1)
set_control_par_str(get_ui_id($wave_1_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($wave_1_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if
set_control_par(get_ui_id($wave_1_led), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($wave_1_led), $CONTROL_PAR_WIDTH, 30)
move_control_px($wave_1_led, ($GRID_X * 1)+4, ($GRID_Y * 1) -10)

declare ui_switch $wave_2_active


set_control_par_str (get_ui_id($wave_2_active), $CONTROL_PAR_PICTURE,
"rr_ht_button_blue")
set_control_par_str (get_ui_id($wave_2_active), $CONTROL_PAR_TEXT, "")
set_control_par(get_ui_id($wave_2_active), $CONTROL_PAR_HEIGHT, 58)
set_control_par(get_ui_id($wave_2_active), $CONTROL_PAR_WIDTH, 74)
make_persistent($wave_2_active)
move_control_px($wave_2_active, ($GRID_X * 1)+45, ($GRID_Y * 1) +0)
set_control_help($wave_2_active, "Switches the front panel to control the
editing parameters for Wave 2. Note that the Noise oscillator follows Wave 2's
Envelope and LFO settings.")

declare ui_slider $wave_2_led (0,1)


make_persistent ($wave_2_led)
read_persistent_var ($wave_2_led)
if ($wave_2_led =1)
set_control_par_str(get_ui_id($wave_2_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($wave_2_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if
set_control_par(get_ui_id($wave_2_led), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($wave_2_led), $CONTROL_PAR_WIDTH, 30)
move_control_px($wave_2_led, ($GRID_X * 1)+58, ($GRID_Y * 1) -10)

declare ui_switch $wave_3_active


set_control_par_str (get_ui_id($wave_3_active), $CONTROL_PAR_PICTURE,
"rr_ht_button_blue")
set_control_par_str (get_ui_id($wave_3_active), $CONTROL_PAR_TEXT, "")
set_control_par(get_ui_id($wave_3_active), $CONTROL_PAR_HEIGHT, 58)
set_control_par(get_ui_id($wave_3_active), $CONTROL_PAR_WIDTH, 74)
make_persistent($wave_3_active)
move_control_px($wave_3_active, ($GRID_X * 1)+98, ($GRID_Y * 1) +0)
set_control_help($wave_3_active, "Switches the front panel to control the
editing parameters for Wave 3.")

declare ui_slider $wave_3_led (0,1)


make_persistent ($wave_3_led)
read_persistent_var ($wave_3_led)
if ($wave_3_led =1)
set_control_par_str(get_ui_id($wave_3_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($wave_3_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if
set_control_par(get_ui_id($wave_3_led), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($wave_3_led), $CONTROL_PAR_WIDTH, 30)
move_control_px($wave_3_led, ($GRID_X * 1)+111, ($GRID_Y * 1) -10)

{========================================AMP
ENVELOPE==========================================}

declare ui_slider $amp_attack (0, 1000000)


make_persistent ($amp_attack)
set_control_help($amp_attack,"Sets the Attack rate of the amplifier
envelope for the currently active Wave.")
set_control_par_str(get_ui_id($amp_attack), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($amp_attack),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($amp_attack),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($amp_attack, ($GRID_X * 5)-27, ($GRID_Y * 3) +10)

declare ui_slider $amp_decay (0, 1000000)


make_persistent ($amp_decay)
set_control_help($amp_decay,"Sets the Decay rate of the amplifier
envelope for the currently active Wave.")
set_control_par_str(get_ui_id($amp_decay), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($amp_decay),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($amp_decay),
$CONTROL_PAR_DEFAULT_VALUE,500000)
move_control_px($amp_decay, ($GRID_X * 5)-26+25, ($GRID_Y * 3) +10)

declare ui_slider $amp_sustain (0, 1000000)


make_persistent ($amp_sustain)
set_control_help($amp_sustain,"Sets the Sustain level of the amplifier
envelope for the currently active Wave.")
set_control_par_str(get_ui_id($amp_sustain), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($amp_sustain),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($amp_sustain),
$CONTROL_PAR_DEFAULT_VALUE,1000000)
move_control_px($amp_sustain, ($GRID_X * 5)-26+51, ($GRID_Y * 3) +10)

declare ui_slider $amp_release (0, 1000000)


make_persistent ($amp_release)
set_control_help($amp_release,"Sets the Release rate of the amplifier
envelope for the currently active Wave.")
set_control_par_str(get_ui_id($amp_release), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($amp_release),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($amp_release),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($amp_release, ($GRID_X * 5)-26+77, ($GRID_Y * 3) +10)
{=================AMP LFO===========================}

declare ui_slider $amp_lfo_rate (150000, 750000)


make_persistent ($amp_lfo_rate)
set_control_help($amp_lfo_rate,"Adjusts the rate of the Amplifier LFO,
introducing tremolo-style effects to the sound.")
set_control_par_str(get_ui_id($amp_lfo_rate), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($amp_lfo_rate),
$CONTROL_PAR_DEFAULT_VALUE,500000)
set_control_par(get_ui_id($amp_lfo_rate),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1500)
move_control_px($amp_lfo_rate, ($GRID_X * 6)+22, ($GRID_Y * 2) +27)

declare ui_slider $amp_lfo_depth (0, 1000000)


make_persistent ($amp_lfo_depth)
set_control_help($amp_lfo_depth,"Adjusts the depth of the Filter LFO,
introducing tremolo-style effects to the sound.")
set_control_par_str(get_ui_id($amp_lfo_depth), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($amp_lfo_depth),$CONTROL_PAR_DEFAULT_VALUE,0)
set_control_par(get_ui_id($amp_lfo_depth),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
move_control_px($amp_lfo_depth, ($GRID_X * 6)+22, ($GRID_Y * 4) +30)

{========================================MIXER
BLOCK===========================================}

declare ui_slider $wave_1_amount (0, 750000)


make_persistent ($wave_1_amount)
set_control_help($wave_1_amount,"Adjusts the output level of Wave 1.")
set_control_par_str(get_ui_id($wave_1_amount), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($wave_1_amount),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($wave_1_amount),
$CONTROL_PAR_DEFAULT_VALUE,500000)
move_control_px($wave_1_amount, ($GRID_X * 5)-27, ($GRID_Y * 10) +19)

declare ui_slider $wave_2_amount (0, 750000)


make_persistent ($wave_2_amount)
set_control_help($wave_2_amount,"Adjusts the output level of Wave 2.")
set_control_par_str(get_ui_id($wave_2_amount), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($wave_2_amount),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($wave_2_amount),
$CONTROL_PAR_DEFAULT_VALUE,500000)
move_control_px($wave_2_amount, ($GRID_X * 5)-26+25, ($GRID_Y * 10) +19)

declare ui_slider $wave_3_amount (0, 750000)


make_persistent ($wave_3_amount)
set_control_help($wave_3_amount,"Adjusts the output level of Wave 3.")
set_control_par_str(get_ui_id($wave_3_amount), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($wave_3_amount),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($wave_3_amount),
$CONTROL_PAR_DEFAULT_VALUE,500000)
move_control_px($wave_3_amount, ($GRID_X * 5)-26+51, ($GRID_Y * 10) +19)

declare ui_slider $sub_amount (0, 750000)


make_persistent ($sub_amount)
set_control_help($sub_amount,"Adjusts the output level of the Sub-
Oscillator. This tracks one octave below Wave 1, and shares its envelope
parameters.")
set_control_par_str(get_ui_id($sub_amount), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($sub_amount),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($sub_amount),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($sub_amount, ($GRID_X * 5)-26+77, ($GRID_Y * 10) +19)

declare ui_slider $noise_amount (0, 750000)


make_persistent ($noise_amount)
set_control_help($noise_amount,"Adjusts the output level of the Noise
oscillator. Noise shares Wave 2's envelope and LFO parameters.")
set_control_par_str(get_ui_id($noise_amount), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($noise_amount),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($noise_amount),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($noise_amount, ($GRID_X * 5)-26+103, ($GRID_Y * 10) +19)

{=======================FILTER
SECTION=========================================================}

declare ui_slider $filter_attack (0, 1000000)


make_persistent ($filter_attack)
set_control_help($filter_attack,"Adjusts the Attack time of the Low-
Pass Filter circuit.")
set_control_par_str(get_ui_id($filter_attack), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($filter_attack),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($filter_attack),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($filter_attack, ($GRID_X * 1)-59, ($GRID_Y * 12)-24)

declare ui_slider $filter_decay (0, 1000000)


make_persistent ($filter_decay)
set_control_help($filter_decay,"Adjusts the Decay time of the Low-Pass
Filter circuit.")
set_control_par_str(get_ui_id($filter_decay), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($filter_decay),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
2500)
set_control_par(get_ui_id($filter_decay),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($filter_decay,($GRID_X * 1)-33, ($GRID_Y * 12)-24)

declare ui_slider $filter_sustain (0, 1000000)


make_persistent ($filter_sustain)
set_control_help($filter_sustain,"Adjusts the Sustain level of the Low-
Pass Filter circuit.")
set_control_par_str(get_ui_id($filter_sustain), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($filter_sustain),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($filter_sustain),
$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($filter_sustain,($GRID_X * 1)-7, ($GRID_Y * 12)-24)

declare ui_slider $filter_release (0, 1000000)


make_persistent ($filter_release)
set_control_help($filter_release,"Adjusts the Release rate of the
Low_Pass Filter circuit.")
set_control_par_str(get_ui_id($filter_release), $CONTROL_PAR_PICTURE,
"rr_slider_square_tiny")
set_control_par(get_ui_id($filter_release),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($filter_release),
$CONTROL_PAR_DEFAULT_VALUE,1000000)
move_control_px($filter_release,($GRID_X * 1)+19, ($GRID_Y * 12)-24)

declare ui_slider $cutoff (50000, 1000000)


make_persistent ($cutoff)
set_control_help($cutoff,"Adjusts the cutoff frequency of the Low-Pass
Filter circuit. Note that Cutoff can also be affected by incoming MIDI velocity if
the Velocity > Cutoff knob on the Effects pane is dialled up.")
set_control_par_str(get_ui_id($cutoff), $CONTROL_PAR_PICTURE,
"rr_ht_knob_large")
set_control_par(get_ui_id($cutoff),$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
set_control_par(get_ui_id($cutoff),$CONTROL_PAR_DEFAULT_VALUE,1000000)
move_control_px($cutoff, ($GRID_X * 3)-25, ($GRID_Y * 10) +15)

declare ui_slider $resonance (0, 1000000)


make_persistent ($resonance)
set_control_help($resonance,"Adjusts the resonance of the Low-Pass
Filter circuit.")
set_control_par_str(get_ui_id($resonance), $CONTROL_PAR_PICTURE,
"rr_ht_knob_large")
set_control_par(get_ui_id($resonance),$CONTROL_PAR_MOUSE_BEHAVIOUR,-
1500)
set_control_par(get_ui_id($resonance),$CONTROL_PAR_DEFAULT_VALUE,0)
move_control_px($resonance, ($GRID_X * 3)+47, ($GRID_Y * 10) +15)

declare ui_slider $filter_lfo_rate (150000, 750000)


make_persistent ($filter_lfo_rate)
set_control_help($filter_lfo_rate,"Adjusts the rate of the Filter LFO,
introducing wah-style effects to the sound.")
set_control_par_str(get_ui_id($filter_lfo_rate), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($filter_lfo_rate),
$CONTROL_PAR_DEFAULT_VALUE,500000)
set_control_par(get_ui_id($filter_lfo_rate),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
move_control_px($filter_lfo_rate, ($GRID_X * 2)+10, ($GRID_Y * 10) +15)

declare ui_slider $filter_lfo_depth (0, 1000000)


make_persistent ($filter_lfo_depth)
set_control_help($filter_lfo_depth,"Adjusts the depth of the Filter
LFO, introducing wah-style effects to the sound.")
set_control_par_str(get_ui_id($filter_lfo_depth), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($filter_lfo_depth),
$CONTROL_PAR_DEFAULT_VALUE,0)
set_control_par(get_ui_id($filter_lfo_depth),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
move_control_px($filter_lfo_depth, ($GRID_X * 2)+10, ($GRID_Y * 12) +18)

declare ui_slider $filter_env_depth (0, 1000000)


make_persistent ($filter_env_depth)
set_control_help($filter_env_depth,"Controls how much effect the Filter
Envelope has over the Cutoff.")
set_control_par_str(get_ui_id($filter_env_depth), $CONTROL_PAR_PICTURE,
"rr_ht_knob_small")
set_control_par(get_ui_id($filter_env_depth),
$CONTROL_PAR_DEFAULT_VALUE,1000000)
set_control_par(get_ui_id($filter_env_depth),
$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)
move_control_px($filter_env_depth, ($GRID_X * 2)-42, ($GRID_Y * 12) +18)

declare ui_switch $filter_mode


set_control_par_str (get_ui_id($filter_mode), $CONTROL_PAR_PICTURE,
"rr_ht_button_blue")
set_control_par_str (get_ui_id($filter_mode), $CONTROL_PAR_TEXT, "")
set_control_par(get_ui_id($filter_mode), $CONTROL_PAR_HEIGHT, 58)
set_control_par(get_ui_id($filter_mode), $CONTROL_PAR_WIDTH, 74)
make_persistent($filter_mode)
move_control_px($filter_mode, ($GRID_X * 2)+74, ($GRID_Y * 12) +49)
set_control_help($filter_mode, "Switches the front panel to control the
editing parameters for Wave 3.")

declare ui_slider $4pole_led (0,1)


make_persistent ($4pole_led)
read_persistent_var ($4pole_led)
if ($4pole_led =1)
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if
set_control_par(get_ui_id($4pole_led), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($4pole_led), $CONTROL_PAR_WIDTH, 30)
move_control_px($4pole_led, ($GRID_X * 3)+50, ($GRID_Y * 14) +17)

declare ui_slider $2pole_led (0,1)


make_persistent ($2pole_led)
read_persistent_var ($2pole_led)
if ($2pole_led =1)
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if
set_control_par(get_ui_id($2pole_led), $CONTROL_PAR_HEIGHT, 35)
set_control_par(get_ui_id($2pole_led), $CONTROL_PAR_WIDTH, 30)
move_control_px($2pole_led, ($GRID_X * 3)+84, ($GRID_Y * 14) +17)

{====================================GLITCH
BUTTON==========================================}

declare ui_switch $glitch


set_control_par_str (get_ui_id($glitch), $CONTROL_PAR_PICTURE,
"rr_ht_button_blue")
set_control_par_str (get_ui_id($glitch), $CONTROL_PAR_TEXT, "")
set_control_par(get_ui_id($glitch), $CONTROL_PAR_HEIGHT, 58)
set_control_par(get_ui_id($glitch), $CONTROL_PAR_WIDTH, 74)
make_persistent($glitch)
move_control_px($glitch, ($GRID_X * 6)+20, ($GRID_Y * 12) +4)
set_control_help($glitch, "Switches the front panel to control the editing
parameters for Wave 3.")

{====================UPDATING THE UI on
launch==============================================}

read_persistent_var ($wave_shape_1)
read_persistent_var ($wave_shape_2)
read_persistent_var ($wave_shape_3)
read_persistent_var ($coarse_pitch_1)
read_persistent_var ($coarse_pitch_2)
read_persistent_var ($coarse_pitch_3)
read_persistent_var ($fine_pitch_1)
read_persistent_var ($fine_pitch_2)
read_persistent_var ($fine_pitch_3)
read_persistent_var ($hpf_1)
read_persistent_var ($hpf_2)
read_persistent_var ($hpf_3)
read_persistent_var ($drive_1)
read_persistent_var ($drive_2)
read_persistent_var ($drive_3)
read_persistent_var ($wave_1_active)
read_persistent_var ($wave_2_active)
read_persistent_var ($wave_3_active)
read_persistent_var ($attack_1)
read_persistent_var ($attack_2)
read_persistent_var ($attack_3)
read_persistent_var ($decay_1)
read_persistent_var ($decay_2)
read_persistent_var ($decay_3)
read_persistent_var ($sustain_1)
read_persistent_var ($sustain_2)
read_persistent_var ($sustain_3)
read_persistent_var ($release_1)
read_persistent_var ($release_2)
read_persistent_var ($release_3)
read_persistent_var ($amp_lfo_speed_1)
read_persistent_var ($amp_lfo_speed_2)
read_persistent_var ($amp_lfo_speed_3)
read_persistent_var ($amp_lfo_depth_1)
read_persistent_var ($amp_lfo_depth_2)
read_persistent_var ($amp_lfo_depth_3)

if ($wave_1_active =1)
$wave_shape_display := $wave_shape_1
$coarse_pitch_display := $coarse_pitch_1
$fine_pitch_display := $fine_pitch_1
$hpf_display := $hpf_1
$drive_display := $drive_1
$amp_attack := $attack_1
$amp_decay := $decay_1
$amp_sustain := $sustain_1
$amp_release := $release_1
$amp_lfo_rate := $amp_lfo_speed_1
$amp_lfo_depth := $amp_lfo_depth_1
end if
if ($wave_2_active =1)
$wave_shape_display := $wave_shape_2
$coarse_pitch_display := $coarse_pitch_2
$fine_pitch_display := $fine_pitch_2
$hpf_display := $hpf_2
$drive_display := $drive_2
$amp_attack := $attack_2
$amp_decay := $decay_2
$amp_sustain := $sustain_2
$amp_release := $release_2
$amp_lfo_rate := $amp_lfo_speed_2
$amp_lfo_depth := $amp_lfo_depth_2
end if
if ($wave_3_active =1)
$wave_shape_display := $wave_shape_3
$coarse_pitch_display := $coarse_pitch_3
$fine_pitch_display := $fine_pitch_3
$hpf_display := $hpf_3
$drive_display := $drive_3
$amp_attack := $attack_3
$amp_decay := $decay_3
$amp_sustain := $sustain_3
$amp_release := $release_3
$amp_lfo_rate := $amp_lfo_speed_3
$amp_lfo_depth := $amp_lfo_depth_3
end if

end on

{==================================================================================
===========
===================================================================================
===========
===================================================================================
===========
=================================
====================================
================================= CALLBACKS
====================================
=================================
====================================
===================================================================================
===========
===================================================================================
===========
===================================================================================
==========}

{=================================== GLITCH CALLBACKS


=======================================}

on ui_control ($glitch)

pgs_set_key_val(GLITCH_ACTIVATED,0,1) {sends the rallying cry to the


other scripts!}

{glitch values for behind-the-scenes blue bar parameters}

$wave_shape_1 := random (1,32)


$wave_shape_2 := random (1,32)
$wave_shape_3 := random (1,32)

$random := random (1,10)


if ($random =1)
$coarse_pitch_1 := -12
end if
if ($random =2)
$coarse_pitch_1 := 12
end if
if (in_range($random,3,10))
$coarse_pitch_1 := 0
end if

$random := random (1,9)


if ($random =1)
$coarse_pitch_2 := 12
end if
if ($random =2)
$coarse_pitch_2 := -12
end if
if ($random =3)
$coarse_pitch_2 := 7
end if
if ($random =4)
$coarse_pitch_2 := 7
end if
if (in_range($random,5,9))
$coarse_pitch_2 := 0
end if

$random := random (1,9)


if ($random =1)
$coarse_pitch_3 := 12
end if
if ($random =2)
$coarse_pitch_3 := 7
end if
if ($random =3)
$coarse_pitch_3 := random (-12,12)
end if
if (in_range($random,4,9))
$coarse_pitch_3 := 0
end if

$random := random (1,10)


if (in_range ($random,1,4))
$fine_pitch_1 := 0
$fine_pitch_2 := random (-35,-10)
$fine_pitch_3 := random (10,35)
end if
if ($random =5)
$fine_pitch_1 := 0
$fine_pitch_2 := 0
$fine_pitch_3 := 0
end if
if ($random =6)
$fine_pitch_1 := 0
$fine_pitch_2 := random (-70,-20)
$fine_pitch_3 := random (20,70)
end if
if (in_range ($random,7,10))
$fine_pitch_1 := 0
$fine_pitch_2 := random (-25,0)
$fine_pitch_3 := random (0,25)
end if

$random := random (1,9)


if (in_range ($random,1,6))
$hpf_1 :=0
$hpf_2 :=0
$hpf_3 :=0
end if
if ($random =7)
$hpf_1 :=0
$hpf_2 :=0
$hpf_3 := random (1,85)
end if
if ($random =8)
$hpf_1 :=0
$hpf_2 := random (1,85)
$hpf_3 := random (1,85)
end if
if ($random =9)
$hpf_1 := random (1,50)
$hpf_2 := random (30,80)
$hpf_3 := random (50,90)
end if

$random := random (1,9)


if (in_range ($random,1,5))
$drive_1 :=0
$drive_2 :=0
$drive_3 :=0
end if
if (in_range ($random,6,7))
$drive_1 :=0
$drive_2 := random (1,50)
$drive_3 := random (1,50)
end if
if ($random =8)
$drive_1 := random (1,50)
$drive_2 := random (1,99)
$drive_3 := random (1,99)
end if
if ($random =9)
$drive_1 := random (1,99)
$drive_2 := random (1,99)
$drive_3 := random (1,99)
end if

$random := random (1,5)


if ($random =1)
$attack_1 := random (1,450000)
$attack_2 := random (1,1000000)
$attack_3 := random (1,1000000)
end if
if ($random =2)
$attack_1 := random (200000,600000)
$attack_2 := random (500000,1000000)
$attack_3 := random (200000,1000000)
end if
if ($random =3)
$attack_1 := random (1,300000)
$attack_2 := random (1,300000)
$attack_3 := random (1,1000000)
end if
if ($random =4)
$attack_1 := random (1,600000)
$attack_2 := random (1,600000)
$attack_3 := random (1,600000)
end if
if ($random =5)
$attack_1 := random (1,1000000)
$attack_2 := random (1,1000000)
$attack_3 := random (1,1000000)
end if

$random := random (1,5)


if ($random =1)
$decay_1 := random (400000,1000000)
$decay_2 := random (400000,1000000)
$decay_3 := random (400000,1000000)
end if
if ($random =2)
$decay_1 := random (600000,1000000)
$decay_2 := random (600000,1000000)
$decay_3 := random (600000,1000000)
end if
if ($random =3)
$decay_1 := random (200000,750000)
$decay_2 := random (200000,750000)
$decay_3 := random (400000,1000000)
end if
if ($random =4)
$decay_1 := random (1,1000000)
$decay_2 := random (1,1000000)
$decay_3 := random (1,1000000)
end if
if ($random =1)
$decay_1 := random (1,500000)
$decay_2 := random (200000,500000)
$decay_3 := random (1,500000)
end if
$random := random (1,3)
if ($random =1)
$sustain_1 := random (400000,1000000)
$sustain_2 := random (400000,1000000)
$sustain_3 := random (400000,1000000)
end if
if ($random =2)
$sustain_1 := random (400000,1000000)
$sustain_2 := random (200000,700000)
$sustain_3 := random (200000,700000)
end if
if ($random =2)
$sustain_1 := random (1,1000000)
$sustain_2 := random (1,500000)
$sustain_3 := random (1,500000)
end if

$random := random (1,3)


if ($random =1)
$release_1 := random (400000,800000)
$release_2 := random (400000,800000)
$release_3 := random (400000,800000)
end if
if ($random =2)
$release_1 := random (150000,500000)
$release_2 := random (150000,500000)
$release_3 := random (150000,800000)
end if
if ($random =3)
$release_1 := random (1,900000)
$release_2 := random (1,900000)
$release_3 := random (1,750000)
end if

$random := random (1,6)


if ($random =1)
$attack_2 := $attack_1
$attack_3 := $attack_1
$decay_2 := $decay_1
$decay_3 := $decay_1
$sustain_2 := $sustain_1
$sustain_3 := $sustain_1
$release_2 := $release_1
$release_3 := $release_1
end if

$random := random (1,4)


if ($random =1)
$amp_lfo_speed_1 := random (150000, 750000)
$amp_lfo_speed_2 := random (150000, 750000)
$amp_lfo_speed_3 := random (150000, 750000)
else
$amp_lfo_speed_1 := random (350000, 600000)
$amp_lfo_speed_2 := random (350000, 600000)
$amp_lfo_speed_3 := random (350000, 600000)
end if

$random := random (1,5)


if ($random =1)
$amp_lfo_speed_2 := $amp_lfo_speed_1
$amp_lfo_speed_3 := $amp_lfo_speed_1
end if

$random := random (1,5)


if ($random =1)
$amp_lfo_depth_1 := random (1,500000)
$amp_lfo_depth_2 := random (1,500000)
$amp_lfo_depth_3 := random (1,500000)
end if
if ($random =2)
$amp_lfo_depth_1 := random (1,1000000)
$amp_lfo_depth_2 := random (1,1000000)
$amp_lfo_depth_3 := random (1,1000000)
end if
if ($random =3)
$amp_lfo_depth_1 := 0
$amp_lfo_depth_2 := random (1,200000)
$amp_lfo_depth_3 := random (1,1000000)
end if
if ($random =4)
$amp_lfo_depth_1 := 0
$amp_lfo_depth_2 := 0
$amp_lfo_depth_3 := random (1,500000)
end if
if ($random =5)
$amp_lfo_depth_1 := 0
$amp_lfo_depth_2 := 0
$amp_lfo_depth_3 := 0
end if

{========================Now randomising the other front panel


controls===================}

$random := random (1,4)


if ($random =1)
$wave_1_amount := random (0,750000)
else
$wave_1_amount := random (550000,750000)
end if

$random := random (1,4)


if ($random =1)
$wave_2_amount := random (0,750000)
else
$wave_2_amount := random (550000,750000)
end if

$wave_3_amount := random (0,750000)

$random := random (1,5)


if ($random =1)
$sub_amount := random (400000,750000)
end if
if ($random =2)
$sub_amount := random (1,750000)
end if
if (in_range ($random,3,5))
$sub_amount := 0
end if

$random := random (1,5)


if ($random =1)
$noise_amount := random (1,400000)
end if
if ($random =2)
$noise_amount := random (1,750000)
end if
if (in_range ($random,3,5))
$noise_amount := 0
end if

$random := random (1,5)


if ($random =1)
$filter_attack := random (1,1000000)
end if
if ($random =2)
$filter_attack := random (1, 350000)
end if
if (in_range($random, 3,5))
$filter_attack := 0
end if

$random := random (1,5)


if ($random =1)
$filter_decay := random (1,450000)
end if
if ($random =2)
$filter_decay := random (1, 1000000)
end if
if (in_range($random, 3,5))
$filter_decay := random (350000,1000000)
end if

$random := random (1,6)


if ($random =1)
$filter_release := random (1,1000000)
else
$filter_release := 1000000
end if

$random := random (1,4)


if ($random =1)
$cutoff := 1000000
else
$cutoff := random (50000,1000000)
end if

$random := random (1,3)


if ($random =1)
$resonance := 0
end if
if ($random =2)
$resonance := random (0,1000000)
end if
if ($random =3)
$resonance := random (0,300000)
end if

$random := random (1,5)


if ($random =1)
$filter_lfo_rate := random (150000,750000)
else
$filter_lfo_rate := random (300000,550000)
end if

$random := random (1,4)


if ($random =1)
$filter_lfo_depth := random (0,1000000)
else
$filter_lfo_depth := 0
end if

$random := random (1,2)


if ($random =1)
$filter_env_depth := random (0,1000000)
else
$filter_env_depth := 0
end if

$random := random (1,2)


if ($random =1)
$4pole_led :=1
$2pole_led :=0
else
$4pole_led :=0
$2pole_led :=1
end if

{=============================IMPLEMENTING THE
GLITCH====================================}

$count :=1
while ($count <33)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_1*50)),$count,-
1,-1)
inc ($count)
end while
$count :=33
while ($count <65)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_2*50)),$count,-
1,-1)
inc ($count)
end while
$count :=65
while ($count <97)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_3*50)),$count,-
1,-1)
inc ($count)
end while

$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_1*8000),$count,0,-
1)
inc ($count)
end while

$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_2*8000),$count,0,-
1)
inc ($count)
end while

$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_3*8000),$count,0,-
1)
inc ($count)
end while

$count :=1
while ($count < 33)
set_engine_par($ENGINE_PAR_DRIVE,($drive_1*10000),
$count,3,1)
inc ($count)
end while

$count :=33
while ($count < 65)
set_engine_par($ENGINE_PAR_DRIVE,($drive_2*10000),
$count,3,1)
inc ($count)
end while

$count :=65
while ($count < 97)
set_engine_par($ENGINE_PAR_DRIVE,($drive_3*10000),
$count,3,1)
inc ($count)
end while

$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_ATTACK,$attack_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_ATTACK,$attack_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_ATTACK,$attack_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_ATTACK,$attack_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_ATTACK,$attack_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_DECAY,$decay_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_DECAY,$decay_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_DECAY,$decay_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_DECAY,$decay_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_DECAY,$decay_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_RELEASE,$release_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_RELEASE,$release_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_RELEASE,$release_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_RELEASE,$release_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)

$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_RELEASE,$release_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <33)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_speed_1,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while

$count :=33
while ($count <65)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_speed_2,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_speed_2,98,(find_mod (98,"AMP_LFO")),-1)

$count :=65
while ($count <97)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_speed_3,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while

$count :=1
while ($count <33)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth_1,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while

$count :=33
while ($count <65)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth_2,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth_2,98,(find_mod(98,"AMP_LFO")),-1)

$count :=65
while ($count <97)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth_3,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while

if ($4pole_led = 0)

$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
0,$count,1,-1)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
1,$count,2,-1)
inc ($count)
end while
else

$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
1,$count,1,-1)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
0,$count,2,-1)
inc ($count)
end while
end if

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_CUTOFF,$cutoff,$count,1,-1)
set_engine_par($ENGINE_PAR_CUTOFF,$cutoff,$count,2,-1)
inc ($count)
end while

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_RESONANCE,$resonance,$count,1,-1)
set_engine_par($ENGINE_PAR_RESONANCE,$resonance,$count,2,-1)
inc ($count)
end while

$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_env_depth,
$count,(find_mod($count,"FILTER_ENVELOPE")),-1)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_env_depth,
$count,(find_mod($count,"ENV_AHDSR")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_lfo_depth,
$count,(find_mod($count,"LFO_SINE")),-1)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_lfo_depth,
$count,(find_mod($count,"LFO_TRI")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,$filter_lfo_rate,$count,
(find_mod ($count,"LFO_SINE")),-1)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,$filter_lfo_rate,$count,
(find_mod ($count,"LFO_TRI")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_ATTACK,$filter_attack,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_ATTACK,$filter_attack,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_DECAY,$filter_decay,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_DECAY,$filter_decay,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_SUSTAIN,$filter_sustain,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_SUSTAIN,$filter_sustain,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while

$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_RELEASE,$filter_release,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_RELEASE,$filter_release,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while

$count := 1
while ($count <33)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_1_amount,$count,-1,-1)
inc ($count)
end while

$count := 33
while ($count <65)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_2_amount,$count,-1,-1)
inc ($count)
end while

$count := 65
while ($count <97)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_3_amount,$count,-1,-1)
inc ($count)
end while

set_engine_par ($ENGINE_PAR_VOLUME,$sub_amount,97,-1,-1)

set_engine_par ($ENGINE_PAR_VOLUME,$noise_amount,98,-1,-1)

{====================UPDATING THE UI on
glitch====================================}

if ($4pole_led =1)
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if

if ($2pole_led =1)
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
else
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end if

if ($wave_1_led =1)
$wave_shape_display := $wave_shape_1
$coarse_pitch_display := $coarse_pitch_1
$fine_pitch_display := $fine_pitch_1
$hpf_display := $hpf_1
$drive_display := $drive_1

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_1
$amp_decay := $decay_1
$amp_sustain := $sustain_1
$amp_release := $release_1
$amp_lfo_rate := $amp_lfo_speed_1
$amp_lfo_depth := $amp_lfo_depth_1
end if

if ($wave_2_led =1)
$wave_shape_display := $wave_shape_2
$coarse_pitch_display := $coarse_pitch_2
$fine_pitch_display := $fine_pitch_2
$hpf_display := $hpf_2
$drive_display := $drive_2

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_2
$amp_decay := $decay_2
$amp_sustain := $sustain_2
$amp_release := $release_2
$amp_lfo_rate := $amp_lfo_speed_2
$amp_lfo_depth := $amp_lfo_depth_2
end if

if ($wave_3_led =1)
$wave_shape_display := $wave_shape_3
$coarse_pitch_display := $coarse_pitch_3
$fine_pitch_display := $fine_pitch_3
$hpf_display := $hpf_3
$drive_display := $drive_3

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_3
$amp_decay := $decay_3
$amp_sustain := $sustain_3
$amp_release := $release_3
$amp_lfo_rate := $amp_lfo_speed_3
$amp_lfo_depth := $amp_lfo_depth_3
end if

end on

{=================================WAVE SELECTION
CALLBACKS===================================}

on ui_control ($wave_1_active)
$wave_shape_display := $wave_shape_1
$coarse_pitch_display := $coarse_pitch_1 {=============== WAVE 1
================}
$fine_pitch_display := $fine_pitch_1
$hpf_display := $hpf_1
$drive_display := $drive_1

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_1
$amp_decay := $decay_1
$amp_sustain := $sustain_1
$amp_release := $release_1
$amp_lfo_rate := $amp_lfo_speed_1
$amp_lfo_depth := $amp_lfo_depth_1

$wave_1_led := 1
set_control_par_str(get_ui_id($wave_1_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
$wave_2_led := 0
set_control_par_str(get_ui_id($wave_2_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
$wave_3_led := 0
set_control_par_str(get_ui_id($wave_3_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end on

on ui_control ($wave_2_active)
$wave_shape_display := $wave_shape_2
$coarse_pitch_display := $coarse_pitch_2 {=========== WAVE 2
=================}
$fine_pitch_display := $fine_pitch_2
$hpf_display := $hpf_2
$drive_display := $drive_2

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_2
$amp_decay := $decay_2
$amp_sustain := $sustain_2
$amp_release := $release_2
$amp_lfo_rate := $amp_lfo_speed_2
$amp_lfo_depth := $amp_lfo_depth_2

$wave_2_led := 1
set_control_par_str(get_ui_id($wave_2_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
$wave_1_led := 0
set_control_par_str(get_ui_id($wave_1_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
$wave_3_led := 0
set_control_par_str(get_ui_id($wave_3_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end on

on ui_control ($wave_3_active)
$wave_shape_display := $wave_shape_3
$coarse_pitch_display := $coarse_pitch_3 {============== WAVE 3
================}
$fine_pitch_display := $fine_pitch_3
$hpf_display := $hpf_3
$drive_display := $drive_3

$alpha_dial := $wave_shape_display
$coarse_pitch_knob := $coarse_pitch_display
$fine_pitch_knob := $fine_pitch_display
$hpf_knob := $hpf_display
$drive_knob := $drive_display

$amp_attack := $attack_3
$amp_decay := $decay_3
$amp_sustain := $sustain_3
$amp_release := $release_3
$amp_lfo_rate := $amp_lfo_speed_3
$amp_lfo_depth := $amp_lfo_depth_3

$wave_3_led := 1
set_control_par_str(get_ui_id($wave_3_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
$wave_1_led := 0
set_control_par_str(get_ui_id($wave_1_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
$wave_2_led := 0
set_control_par_str(get_ui_id($wave_2_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
end on

{==========================BLUE SECTION KNOB


CALLBACKS========================================}

on ui_control ($alpha_dial)
if ($wave_1_led =1)
$wave_shape_display := $alpha_dial
$wave_shape_1 := $wave_shape_display
end if
if ($wave_2_led =1)
$wave_shape_display := $alpha_dial
$wave_shape_2 := $wave_shape_display
end if
if ($wave_3_led =1)
$wave_shape_display := $alpha_dial
$wave_shape_3 := $wave_shape_display
end if
end on

on ui_control ($coarse_pitch_knob)
if ($wave_1_led =1)
$coarse_pitch_display := $coarse_pitch_knob
$coarse_pitch_1 := $coarse_pitch_display
end if
if ($wave_2_led =1)
$coarse_pitch_display := $coarse_pitch_knob
$coarse_pitch_2 := $coarse_pitch_display
end if
if ($wave_3_led =1)
$coarse_pitch_display := $coarse_pitch_knob
$coarse_pitch_3 := $coarse_pitch_display
end if
end on

on ui_control ($fine_pitch_knob)
if ($wave_1_led =1)
$fine_pitch_display := $fine_pitch_knob
$fine_pitch_1 := $fine_pitch_display
end if
if ($wave_2_led =1)
$fine_pitch_display := $fine_pitch_knob
$fine_pitch_2 := $fine_pitch_display
end if
if ($wave_3_led =1)
$fine_pitch_display := $fine_pitch_knob
$fine_pitch_3 := $fine_pitch_display
end if

$count :=1
while ($count <33)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_1*50)),$count,-
1,-1)
inc ($count)
end while
$count :=33
while ($count <65)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_2*50)),$count,-
1,-1)
inc ($count)
end while
$count :=65
while ($count <97)
set_engine_par ($ENGINE_PAR_TUNE,(500000 + ($fine_pitch_3*50)),$count,-
1,-1)
inc ($count)
end while

end on

on ui_control ($hpf_knob)
if ($wave_1_led =1)
$hpf_display := $hpf_knob
$hpf_1 := $hpf_display
$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_1*8000),$count,0,-
1)
inc ($count)
end while
end if
if ($wave_2_led =1)
$hpf_display := $hpf_knob
$hpf_2 := $hpf_display
$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_2*8000),$count,0,-
1)
inc ($count)
end while
end if
if ($wave_3_led =1)
$hpf_display := $hpf_knob
$hpf_3 := $hpf_display
$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_CUTOFF,($hpf_3*8000),$count,0,-
1)
inc ($count)
end while
end if
end on

on ui_control ($drive_knob)
if ($wave_1_led =1)
$drive_display := $drive_knob
$drive_1 := $drive_display
$count :=1
while ($count < 33)
set_engine_par($ENGINE_PAR_DRIVE,($drive_1*10000),
$count,3,1)
inc ($count)
end while
end if
if ($wave_2_led =1)
$drive_display := $drive_knob
$drive_2 := $drive_display
$count :=33
while ($count < 65)
set_engine_par($ENGINE_PAR_DRIVE,($drive_2*10000),
$count,3,1)
inc ($count)
end while
end if
if ($wave_3_led =1)
$drive_display := $drive_knob
$drive_3 := $drive_display
$count :=65
while ($count < 97)
set_engine_par($ENGINE_PAR_DRIVE,($drive_3*10000),
$count,3,1)
inc ($count)
end while
end if
end on

on ui_control ($amp_attack) {=============AMP ENVELOPE


CALLBACKS============}
if ($wave_1_led =1)
$attack_1 := $amp_attack
$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_ATTACK,$attack_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_ATTACK,$attack_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_2_led =1)
$attack_2 := $amp_attack
$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_ATTACK,$attack_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_ATTACK,$attack_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_3_led =1)
$attack_3 := $amp_attack
$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_ATTACK,$attack_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
end if
end on

on ui_control ($amp_decay)
if ($wave_1_led =1)
$decay_1 := $amp_decay
$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_DECAY,$decay_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_DECAY,$decay_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_2_led =1)
$decay_2 := $amp_decay
$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_DECAY,$decay_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_DECAY,$decay_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_3_led =1)
$decay_3 := $amp_decay
$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_DECAY,$decay_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
end if
end on

on ui_control ($amp_sustain)
if ($wave_1_led =1)
$sustain_1 := $amp_sustain
$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_2_led =1)
$sustain_2 := $amp_sustain
$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_3_led =1)
$sustain_3 := $amp_sustain
$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_SUSTAIN,$sustain_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
end if
end on

on ui_control ($amp_release)
if ($wave_1_led =1)
$release_1 := $amp_release
$count :=1
while ($count <33)
set_engine_par($ENGINE_PAR_RELEASE,$release_1,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_RELEASE,$release_1,97,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_2_led =1)
$release_2 := $amp_release
$count :=33
while ($count <65)
set_engine_par($ENGINE_PAR_RELEASE,$release_2,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
set_engine_par($ENGINE_PAR_RELEASE,$release_2,98,
(find_mod($count,"AMP_ENVELOPE")),-1)
end if
if ($wave_3_led =1)
$release_3 := $amp_release
$count :=65
while ($count <97)
set_engine_par($ENGINE_PAR_RELEASE,$release_3,$count,
(find_mod($count,"AMP_ENVELOPE")),-1)
inc ($count)
end while
end if
end on

on ui_control ($amp_lfo_rate)
if ($wave_1_led =1)
$amp_lfo_speed_1 := $amp_lfo_rate
$count :=1
while ($count <33)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_rate,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while
end if
if ($wave_2_led =1)
$amp_lfo_speed_2 := $amp_lfo_rate
$count :=33
while ($count <65)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_rate,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_rate,98,(find_mod (98,"AMP_LFO")),-1)
end if
if ($wave_3_led =1)
$amp_lfo_speed_3 := $amp_lfo_rate
$count :=65
while ($count <97)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,
$amp_lfo_rate,$count,(find_mod ($count,"AMP_LFO")),-1)
inc ($count)
end while
end if
end on

on ui_control ($amp_lfo_depth)
if ($wave_1_led =1)
$amp_lfo_depth_1 := $amp_lfo_depth
$count :=1
while ($count <33)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while
end if
if ($wave_2_led =1)
$amp_lfo_depth_2 := $amp_lfo_depth
$count :=33
while ($count <65)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth,98,(find_mod(98,"AMP_LFO")),-1)
end if
if ($wave_3_led =1)
$amp_lfo_depth_3 := $amp_lfo_depth
$count :=65
while ($count <97)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,
$amp_lfo_depth,$count,(find_mod($count,"AMP_LFO")),-1)
inc ($count)
end while
end if
end on

{========================================FILTER SECTION
CALLBACKS============================}

on ui_control ($filter_mode)
if ($4pole_led =1) {switching to 2-pole mode}
$4pole_led := 0
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
$2pole_led :=1
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
0,$count,1,-1)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
1,$count,2,-1)
inc ($count)
end while
else
$4pole_led := 1 {switching to 4-pole mode}
set_control_par_str(get_ui_id($4pole_led), $CONTROL_PAR_PICTURE,
"sq_led_on")
$2pole_led :=0
set_control_par_str(get_ui_id($2pole_led), $CONTROL_PAR_PICTURE,
"sq_led_off")
$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
1,$count,1,-1)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,
0,$count,2,-1)
inc ($count)
end while
end if
end on

on ui_control ($cutoff)
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_CUTOFF,$cutoff,$count,1,-1)
set_engine_par($ENGINE_PAR_CUTOFF,$cutoff,$count,2,-1)
inc ($count)
end while
end on

on ui_control ($resonance)
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_RESONANCE,$resonance,$count,1,-1)
set_engine_par($ENGINE_PAR_RESONANCE,$resonance,$count,2,-1)
inc ($count)
end while
end on

on ui_control ($filter_env_depth)
$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_env_depth,
$count,(find_mod($count,"FILTER_ENVELOPE")),-1)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_env_depth,
$count,(find_mod($count,"ENV_AHDSR")),-1)
inc ($count)
end while
end on

on ui_control ($filter_lfo_depth)
$count :=1
while ($count <99)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_lfo_depth,
$count,(find_mod($count,"LFO_SINE")),-1)
_set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$filter_lfo_depth,
$count,(find_mod($count,"LFO_TRI")),-1)
inc ($count)
end while
end on

on ui_control ($filter_lfo_rate)
$count :=1
while ($count <99)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,$filter_lfo_rate,$count,
(find_mod ($count,"LFO_SINE")),-1)
_set_engine_par ($ENGINE_PAR_INTMOD_FREQUENCY,$filter_lfo_rate,$count,
(find_mod ($count,"LFO_TRI")),-1)
inc ($count)
end while
end on

on ui_control ($filter_attack) {==========FILTER


ENVELOPE CALLBACKS=========}
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_ATTACK,$filter_attack,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_ATTACK,$filter_attack,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while
end on

on ui_control ($filter_decay)
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_DECAY,$filter_decay,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_DECAY,$filter_decay,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while
end on

on ui_control ($filter_sustain)
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_SUSTAIN,$filter_sustain,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_SUSTAIN,$filter_sustain,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while
end on

on ui_control ($filter_release)
$count :=1
while ($count <99)
set_engine_par($ENGINE_PAR_RELEASE,$filter_release,$count,
(find_mod($count,"ENV_AHDSR")),-1)
set_engine_par($ENGINE_PAR_RELEASE,$filter_release,$count,
(find_mod($count,"FILTER_ENVELOPE")),-1)
inc ($count)
end while
end on

{==============================MIXER LEVELS
CALLBACKS=========================================}

on ui_control ($wave_1_amount)
$count := 1
while ($count <33)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_1_amount,$count,-1,-1)
inc ($count)
end while
end on

on ui_control ($wave_2_amount)
$count := 33
while ($count <65)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_2_amount,$count,-1,-1)
inc ($count)
end while
end on

on ui_control ($wave_3_amount)
$count := 65
while ($count <97)
set_engine_par ($ENGINE_PAR_VOLUME,$wave_3_amount,$count,-1,-1)
inc ($count)
end while
end on

on ui_control ($sub_amount)
set_engine_par ($ENGINE_PAR_VOLUME,$sub_amount,97,-1,-1)
end on

on ui_control ($noise_amount)
set_engine_par ($ENGINE_PAR_VOLUME,$noise_amount,98,-1,-1)
end on

{==================================================================================
============
=================================== ON NOTE CALLBACKS
=========================================
===================================================================================
===========}

on note

disallow_group ($ALL_GROUPS)

allow_group ($wave_shape_1) {wave 1 plus sub}


allow_group (97)
play_note(($EVENT_NOTE + $coarse_pitch_1),$EVENT_VELOCITY,1,-1)
disallow_group ($wave_shape_1)
disallow_group (97)

allow_group (32+$wave_shape_2) {wave 2 plus noise}


allow_group (98)
play_note(($EVENT_NOTE + $coarse_pitch_2),$EVENT_VELOCITY,1,-1)
disallow_group (32+$wave_shape_2)
disallow_group (98)

allow_group (64+$wave_shape_3) {wave 3}


play_note(($EVENT_NOTE + $coarse_pitch_3),$EVENT_VELOCITY,1,-1)
disallow_group (64+$wave_shape_3)

end on

You might also like