Online Sequencer Make music online
  • Sequences
  • Members
  • Chat
  • Forum
  • Wiki

Existing user? Sign In Create account
Login at Online Sequencer Forums

Online Sequencer Forums › Online Sequencer › Suggestions
« Previous 1 … 40 41 42 43 44 … 48 Next »

#midiflip code

Pages (2): « Previous 1 2
Thread tools
#midiflip code
Jacob_ Offline
Administrator
343 Posts:
 
#11
03-10-2018, 11:43 AM
Here's another one that flips the song between major/minor. Make sure you have the right key selected first since auto-detect will always detect major.

Code:
if (keySelect.selectedIndex == 0) {
   message('Select a key first');
} else {
   var inverseKeyIndex = (keySelect.selectedIndex + 12) % 24;
   var inverseKey = settings.scales[inverseKeyIndex];
   for (i = 0; i < song.notes.length; i++) {
      var note = song.notes[i];
      var octave = note.type.substring(note.type.length-1);
      var noteInverseKeyIndex = scale.indexOf(note.type.substring(0, note.type.length-1));
      if (noteInverseKeyIndex != -1) {
          song.moveNote(note, note.instrument, note.instrument, note.time, note.time, note.type, inverseKey[noteInverseKeyIndex] + octave);
          song.update(note);
      }
   }
   keySelect.selectedIndex = inverseKeyIndex;
   keySelect.onchange();
}


Reply
Jacob_ Offline
Administrator
343 Posts:
 
#12
03-10-2018, 12:04 PM
Added both to the tools menu.


Reply
Kirbyderp Offline
kek
509 Posts:
 
#13
03-10-2018, 12:11 PM
(03-10-2018, 11:43 AM)Jacob_ Wrote: Here's another one that flips the song between major/minor. Make sure you have the right key selected first since auto-detect will always detect major.

Code:
if (keySelect.selectedIndex == 0) {
   message('Select a key first');
} else {
   var inverseKeyIndex = (keySelect.selectedIndex + 12) % 24;
   var inverseKey = settings.scales[inverseKeyIndex];
   for (i = 0; i < song.notes.length; i++) {
      var note = song.notes[i];
      var octave = note.type.substring(note.type.length-1);
      var noteInverseKeyIndex = scale.indexOf(note.type.substring(0, note.type.length-1));
      if (noteInverseKeyIndex != -1) {
          song.moveNote(note, note.instrument, note.instrument, note.time, note.time, note.type, inverseKey[noteInverseKeyIndex] + octave);
          song.update(note);
      }
   }
   keySelect.selectedIndex = inverseKeyIndex;
   keySelect.onchange();
}
Do you think you could make this so it doesn't affect percussion?


My Music! | High Quality Rips | Road to Remastery | Project Ultra
Reply
Kirbyderp Offline
kek
509 Posts:
 
#14
03-10-2018, 12:15 PM
Also I want to note, if you attempt to make the inverse go from major to minor (or minor to major) in will re-invert the music.


My Music! | High Quality Rips | Road to Remastery | Project Ultra
Reply
Kirbyderp Offline
kek
509 Posts:
 
#15
03-10-2018, 12:40 PM
Found a bug with the major to minor and vice versa code.
If it attempts to turn a C into a B one note lower, it will instead keep it in the same octave.
(C6--->B6 instead of C6--->B5)


My Music! | High Quality Rips | Road to Remastery | Project Ultra
Reply
Kirbyderp Offline
kek
509 Posts:
 
#16
03-10-2018, 01:01 PM
B major to B minor breaks the conversion tool.


My Music! | High Quality Rips | Road to Remastery | Project Ultra
Reply
HelpMe123Alt Offline
Banned
58 Posts:
 
#17
03-10-2018, 02:46 PM
Used same fundamental code to make an "autotuner":
Use this code on the modifier:
var a=Array(0);for(i=0;i<selectedNotes.length;i++){a.push(selectedNotes[i].type)}
Then use this code on the song you want to remix:
for(i=0;i<selectedNotes.length;i++){n=selectedNotes[i];song.moveNote(n,n.instrument,n.instrument,n.time,n.time,n.type,a[i%16].slice(0,-1)+n.type.slice(-1))}


Reply
Pages (2): « Previous 1 2



Users browsing this thread:   1 Guest(s)


  •  Return to Top
  •  Contact Us
  •   Home
  •  Lite mode
© Rush Crafted with ❤ by iAndrew
Powered By MyBB, © 2002-2025 MyBB Group.
Linear Mode
Threaded Mode
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend