Created
August 11, 2023 03:20
-
-
Save dustractor/ed558b7f6479cf76840fdf7672fd3f8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flpianoroll import * | |
note_ct = score.noteCount | |
def createDialog(): | |
form = ScriptDialog("Select every nth note","") | |
form.AddInputKnobInt("nth",2,2,64) | |
return form | |
def apply(form): | |
nth = form.GetInputValue("nth") | |
times = set() | |
for n in range(note_ct): | |
xnote = score.getNote(n) | |
times.add(xnote.time) | |
goodtimes = list() | |
for n,t in enumerate(sorted(list(times))): | |
if (n % nth) == 0: | |
goodtimes.append(t) | |
goodnotes = list() | |
for n in range(note_ct): | |
xnote = score.getNote(n) | |
if xnote.time in goodtimes: | |
goodnotes.append(n) | |
for n in goodnotes: | |
xnote = score.getNote(n) | |
xnote.selected = True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment