Key Sensitivity + Random Tune Confusion

MTC84
MTC84 Member Posts: 71 Member
edited October 2024 in Scripting Workshop

Hi,

I have 2 small On Note scripts which work individually but not together. I simply want to execute both but have run into some confusion.

In the 1st block (Key Sensitivity) - $EVENT_ID is ignored which is preventing the Random Tune script from working obviously but I have no idea how to get around this.

I have tried adding the Random Tune code lines inside each if statement but that didn't work.

I have tried positioning the Random Tune script before/above the Key Sensitivity script but that didn't work either.

Any help would be hugely appreciated. Thanks.

{ON NOTE - KEY SENSITIVITY KNOB}

on note

	ignore_event($EVENT_ID)

	if ($EVENT_VELOCITY+$Key_Sensitivity > 127)
		play_note($EVENT_NOTE, 127, 0, -1)
	else
	if ($EVENT_VELOCITY+$Key_Sensitivity < 1)
		play_note($EVENT_NOTE, 1, 0, -1)
	else
		play_note($EVENT_NOTE, $EVENT_VELOCITY+$Key_Sensitivity, 0, -1)
	end if
end if


{RANDOM TUNE - NOT WORKING}

	$Random_Tune_Amount := random(-5000, 5000)
	change_tune ($EVENT_ID, $Random_Tune_Amount, 1)
end on

Comments

  • medusa
    medusa Member Posts: 98 Helper

    you need to capture the event ID of the new playnotes you made in the script and then change_tune THAT


    ie.  $new_ID := play_note($EVENT_NOTE, $EVENT_VELOCITY+$Key_Sensitivity, 0, -1)
    


    change_tune($new_ID, ...

  • MTC84
    MTC84 Member Posts: 71 Member

    Thanks so much. All seems to be working now.

  • MTC84
    MTC84 Member Posts: 71 Member

    Just a quick question regarding the variable I need to decalre in the on init block.

    My instrument has multi mic channels - Do I need to use a polyphonic variable? It's not something I have used before. Thanks.

    declare $new_ID
    
    {OR}
    
    declare polyphonic $new_ID
    
  • medusa
    medusa Member Posts: 98 Helper

    I don't think you need it polyphonic in this case since you're only tuning the event ONCE, at the beginning of each note event.

  • MTC84
    MTC84 Member Posts: 71 Member

    Thanks very much for the help. Much appreciated.

This discussion has been closed.
Back To Top