Skip to content

Commit

Permalink
Plugins list for MU4
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism committed Jun 2, 2022
1 parent b73764f commit 838d85a
Show file tree
Hide file tree
Showing 21 changed files with 4,811 additions and 1,308 deletions.
1,613 changes: 1,613 additions & 0 deletions share/plugins/Modal_Tuning.qml

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions share/plugins/NewRetrograde.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//===========================================================================
// New Retrograde
// https://github.com/ellejohara/newretrograde
//
// Copyright (C) 2020 Astrid Lydia Johannsen (ellejohara)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3
// as published by the Free Software Foundation and appearing in
// the file LICENSE
//===========================================================================

import QtQuick 2.0
import MuseScore 3.0

MuseScore {
menuPath: "Plugins.NewRetrograde"
description: "Takes a selection of notes and reverses them."
version: "1.0"

function retrogradeSelection() {
var cursor = curScore.newCursor(); // get the selection
cursor.rewind(2); // go to the end of the selection

if(!cursor.segment) { // if nothing selected
console.log('nothing selected'); // say "nothing selected"
Qt.quit(); // then quit
} else {
var endTick = cursor.tick; // mark the selection end tick
cursor.rewind(1); // go to the beginning of the selection
var startTick = cursor.tick; // mark the selection start tick
}
//console.log(startTick + ' - ' + endTick); // display selection start and end ticks

var noteArray = []; // create a blank array


while(cursor.segment && cursor.tick < endTick) { // while in the selection
var e = cursor.element; // put current element into variable e
if(e) { // if e exists
if(e.type == Element.CHORD) { // if e is a note or chord
var pitches = []; // put the note pitches of each chord into an array
var notes = e.notes;
for(var i = 0; i < notes.length; i++) { // iterate through each note in chord
var note = notes[i]; // get the note pitch number
pitches.push(note.pitch); // put pitch number into variable
}
}

if(e.type == Element.REST) { // if e is a rest
var pitches = 'REST'; // "REST" as pitch
}

var numer = e.duration.numerator; // numerator of duration
var denom = e.duration.denominator; // denominator of duration

noteArray.push([pitches, numer, denom]);
}
cursor.next(); // move to next tick
}

noteArray.reverse(); // this does the retrograde (reverse array)
cursor.rewind(1); // go back to beginning of selection

// this section rewrites the selection with the reversed array
for(var i = 0; i < noteArray.length; i++) {
var noteDur = noteArray[i];
var pitches = noteDur[0]; // get note and chord pitches
var numer = noteDur[1]; // duration numerator
var denom = noteDur[2]; // duration denominator

// set the duration
cursor.setDuration(numer, denom);

// if there is only a single note
if(pitches.length == 1) {
cursor.addNote(pitches[0]); // add note
}

// if there is a chord or rest
if(pitches.length > 1) {

// if rest
if(pitches === 'REST') {
cursor.addRest () // add rest
} else {

// if chord
for(var j = 0; j < pitches.length; j++) {
var pitch = pitches[j];
if(j == 0) { // loop through each pitch of chord
// write the root note in a new cursor position
cursor.addNote(pitch); // root of chord
} else {
// write the notes to the same cursor position
cursor.addNote(pitch, cursor); // remainder of notes in chord
}
}
}
}

} // end for
}


onRun: {
retrogradeSelection();
Qt.quit()
}
}
146 changes: 0 additions & 146 deletions share/plugins/abc_import.qml

This file was deleted.

Loading

0 comments on commit 838d85a

Please sign in to comment.