Play_Note Keeps Retrigging on All PGS Callbacks
Hi,
So recently I've been running into a weird issue that i'm having trouble solving.
I have been trying to create a noise texture menu that will play a looping texture (vinyl noise, rain, forest sounds. etc.) when selected from a dropdown menu. This will loop in the background of the kontakt instrument while you play and can be triggered on and off with a bypass button.
I have successfully been able to get this script to work with multiple approaches in it's on separate script slot but the issue always repeats itself when I set up a PGS callback to control the par from the first script slot.
Whenever I set up the PGS callback in "slot 1" the controls work however when I touch any knob , slider or switch that triggers a PGS event it ends up "retriggering" the selected "play_note" noise from "slot 2" from the beginning which creates a stuttering like effecting when simple turning a knob or a "clicking noise" when pressing a button.
This issue only happens when I turn a PGS control in script slot 1 which includes the sliders I have controlling other scripts (slot 3 and 4) as well. I also stripped both codes down to just the instrument and noise script and still got the same result.
I'm unsure how to approach fixing this issue or if there is a better way to incorporate a background "noise select menu". I appreciate any time and help on this matter as I am really grateful for the assistance this community has provided over the years.
----
Here's a sample of the "Noise Menu" script. I figured this is what someone could take a look at since the issue can be replicated when creating a PGS trigger with any script.
{----- INIT -----} {paste INIT code under here} on init make_perfview set_script_title("Noise") set_ui_height_px(532) set_ui_width_px(948) {NOISE PANEL - SLIDER} declare ui_button $NoiseButton declare ui_menu $SelectNoise add_menu_item ($SelectNoise, "Select Noise",0) add_menu_item ($SelectNoise, "Ampex-102 Noise Floor",1) add_menu_item ($SelectNoise, "Juno-106 Noise Floor",2) add_menu_item ($SelectNoise, "Moog One Noise Floor",3) add_menu_item ($SelectNoise, "OB-6 Noise Floor",4) add_menu_item ($SelectNoise, "Old Record Noise Floor",5) add_menu_item ($SelectNoise, "Record Vinyl Noise A",6) add_menu_item ($SelectNoise, "Record Vinyl Noise B",7) add_menu_item ($SelectNoise, "Record Vinyl Noise C",8) add_menu_item ($SelectNoise, "Record Vinyl Noise D",9) add_menu_item ($SelectNoise, "Record Vinyl Noise E",10) add_menu_item ($SelectNoise, "After The Rain Texture",11) add_menu_item ($SelectNoise, "Lost at Sea Texture",12) add_menu_item ($SelectNoise, "Rain in Dubai Texture",13) add_menu_item ($SelectNoise, "Room Tone Texture",14) add_menu_item ($SelectNoise, "The Woods Texture",15) add_menu_item ($SelectNoise, "Time in London Texture",16) add_menu_item ($SelectNoise, "Tour in France Texture",17) add_menu_item ($SelectNoise, "Walk to Mexico Texture",18) add_menu_item ($SelectNoise, "Warm Night Swim Texture",19) add_menu_item ($SelectNoise, "Wet Parked Car Texture",20) declare $noteID make_persistent($SelectNoise) make_persistent($NoiseButton) read_persistent_var($SelectNoise) end on {----- ON NOTE -----} {paste ON NOTE code under here} {----- ON CONTROLLER -----} {paste CONTROLLER code under here} {----- FUNCTIONS -----} {paste FUNCTION code under here} function NoiseMode() if ($NoiseButton = 0) note_off($noteID) else if ($NoiseButton = 1 and $SelectNoise = 0) note_off($noteID) end if if ($NoiseButton = 1 and $SelectNoise = 1) note_off($noteID) $noteID := play_note(0,127,0,-1) set_event_par_arr($noteID,$EVENT_PAR_ALLOW_GROUP,0,$ALL_GROUPS) set_event_par_arr($noteID,$EVENT_PAR_ALLOW_GROUP,1,find_group("Ampex-102 Noise Floor")) end if if ($NoiseButton = 1 and $SelectNoise = 2) note_off($noteID) $noteID := play_note(0,127,0,-1) set_event_par_arr($noteID,$EVENT_PAR_ALLOW_GROUP,0,$ALL_GROUPS) set_event_par_arr($noteID,$EVENT_PAR_ALLOW_GROUP,1,find_group("Juno-106 Noise Floor")) end if end if end function {----- CONTROLS -----} {paste CONTROL code under here} {NOISE BUTTON - CONTROL} on ui_control($NoiseButton) call NoiseMode() end on {SELECT NOISE - CONTROL} on ui_control($SelectNoise) call NoiseMode() end on {----- PGS -----} {paste PGS code under here} on pgs_changed if (pgs_key_exists(NOISE_BUTTON)) $NoiseButton := pgs_get_key_val(NOISE_BUTTON,0) call NoiseMode() end if if (pgs_key_exists(SELECT_NOISE)) $SelectNoise := pgs_get_key_val(SELECT_NOISE,0) call NoiseMode() end if end on
Comments
-
You only need to execute those function calls if $NoiseButton (or $SelectNoise) have actually changed value, so add a check for that:
if (pgs_key_exists(NOISE_BUTTON) and pgs_get_key_val(NOISE_BUTTON, 0) # $NoiseButton)
1 -
OMG !!!! EvilDragon !!! I freaking love you dude !!!
Checking for those changed values worked flawlessly. I don't know how to repay you cause this was driving me crazy for days and I knew it had to be something simple that i'm obviously missing.
I really appreciate your help and taking the time man.
Your are a legend !
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 785 Tech Talks
- 4.1K Native Access
- 16.6K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 379 Battery 4
- 845 Guitar Rig & FX
- 429 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.3K Traktor
- 7.3K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators