Online Sequencer Forums

Full Version: #midiflip code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
var p={};for(i=0;i<72;i++){p[piano[i]]=piano[71-i]}selectAll();for(i=0;i<selectedNotes.length;i++){n=selectedNotes[i];song.moveNote(n,n.instrument,n.instrument,n.time,n.time,n.type,p[n.type])}
Paste into console to #midiflip ANY song! There is a visual glitch that accompanies this, but it works internally; I tested it. You can save songs and the effect will stay.

Then again, you can still use other flippers online using importing and exporting, but this is faster.

MAJOR EDIT: THANK YOU TO korwynkim FOR THIS CODE. PROBS COULD HAVE DONE IT MYSELF BUT WHATEVER
var p={};for(i=0;i<72;i++){p[piano[i]]=piano[71-i]}selectAll();for(i=0;i<selectedNotes.length;i++){n=selectedNotes[i];song.moveNote(n,n.instrument,n.instrument,n.time,n.time,n.type,p[n.type])}deleteSelection();
undoChange();

MAJOR EDIT: THANK YOU JACOB_ THIS MAY BE A FEATURE FOR SOME REASON I ALSO SUGGEST YOU ADD HORIZONTAL FLIP AS WELL BTW
Press delete and then undo after inputting the code, it fixes the visual glitch.
Ayy, clever!
Now I will find the undo code!
Reformatted for readability
Edit: Added delete and undo fix

Code:
var p={};

for(i = 0; i < 72; i++){
   p[piano[i]] = piano[71 - i]
}
selectAll();

for(i = 0; i < selectedNotes.length; i++){
   n = selectedNotes[i];
   song.moveNote(n, n.instrument, n.instrument, n.time, n.time, n.type, p[n.type])
}

deleteSelection();
undoChange();
Aw, you beat me to the punch. Unformatted code:
var p={};for(i=0;i<72;i++){p[piano[i]]=piano[71-i]}selectAll();for(i=0;i<selectedNotes.length;i++){n=selectedNotes[i];song.moveNote(n,n.instrument,n.instrument,n.time,n.time,n.type,p[n.type])}deleteSelection();
undoChange();
lol wtf it makes my songs sound happy
for example this:
Major and Minor are inversions of each other. (Dim. and Aug. are self-dual.)
Thanks for using your coding skills for good! Fixed and cleaned up:


Code:
var inversePiano = {};
for (i = 0; i < 72; i++) {
   inversePiano[piano[i]] = piano[71 - i]
}
for (i = 0; i < song.notes.length; i++) {
   n = song.notes[i];
   song.moveNote(n, n.instrument, n.instrument, n.time, n.time, n.type, inversePiano[n.type])
   song.update(n);
}

Can I add this to the site?
It would be my pleasure.
Pages: 1 2