On Sonntag, 4. April 2021 22:24:09 CEST Andrew C wrote: > Hi all, > > I'm looking into creating a poorman's round robin script for some short > note staccatos.
I assume you want to use sfz. In this case create a text file somewhere which you will fill with NKSP script code and link that script in your sfz file with the 'script' opcode: http://doc.linuxsampler.org/sfz/script_opcode/ The advantage with the gig format is that you get immediate syntax / error / warning feedbacks while typing the script in gigedit's script editor. So this is probably more convenient and faster, especially on first steps. However alternatively you can also use 'ls_instr_script' from the command line to check your script for errors: cat /some/where/foo.txt | ls_instr_script sfz Additional options are described by: ls_instr_script > My plan is to write a script which will: > > At note on, pick a random number between 0 and 4. on init declare polyphonic $n end init on note $n := random(0, 4) message("Random number is " & $n) ... end on > Play either the same note, 2 semitones up but repitched to the original > note's pitch, 1 semitone up but repitched, 2 semitones down but repitched > or 1 semitone down but repitched. select $n case 0 play_note($EVENT_NOTE + 2, $EVENT_VELOCITY) case 1 ... case 2 ... case 3 ... case 4 ... end select I don't get though what you mean with "repitched to the original note's pitch". Do you want to start it with a x semitones offset and let it slide to the original pitch within a certain duration? > I looked at the NKSP reference manual and it seems like I can achieve the > first part with the Random() function. > > I'm considering using change_pitch function to simply tell the future note > to pitch itself up or down and then use play_note to play the new note's > sample but repitched. The function is called change_tune() for some reason (KSP invention): http://doc.linuxsampler.org/Instrument_Scripts/NKSP_Language/Reference/ change_tune_function/ And you would probably want to use it in conjunction with change_tune_time() to control how long it will take to perform the tuning/pitch change. > > play_note does send a new midi note_on event, if I'm not mistaken? Yes. This tour is probabably a good starting point: http://doc.linuxsampler.org/Instrument_Scripts/NKSP_Language/ Hover your mouse over keywords to see a short summary what they are doing. Click on them to get to the detailed description of the keyword. > > Thanks, > > Andrew. CU Christian _______________________________________________ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel