Time Tool
#1

Have you ever wanted to speed up or slow down a section you composed relative to other sections, but can't because tempo is the only way to control speed? Well, fear not, I have written a console script that does that!
Code:
n=parseFloat(prompt());
for(i=0;i<selectedNotes.length;i++){
j=selectedNotes[i];
song.moveNote(j,j.instrument,j.instrument,j.time,j.time*n,j.type,j.type)}
x=selectedNotes;deleteSelection();undoChange();selectedNotes=x;
Just paste this into the console after selecting the notes you want to change, and then just enter the tempo multiplier! Just remember that numbers greater than 1 REDUCE the tempo, and vice-versa. Note that parseFloat() returns NaN when you give it invalid stuff, so if you give it something like "Frank Sucks", then it will ruin all the notes by changing their time to NaN. Also, it changes tempo relative to the start of the song, but it is easy to move the notes back to their proper place.

NaN Note Documentation:
Never makes sound, can be moved around but to no avail.

Kim Wrote:https://js-game.glitch.me + Doesnt take peopel serious if their has badly speling gramer puntuatin
Reply
#2

Nice!
Reply
#3

You really should write cleaner code and use more descriptive variable names Tounge

Here it is cleaned up

Code:
multiplier  =  parseFloat(prompt("How much do you want to scale the note lengths?"))

for(i  =  0;  i  <  selectedNotes.length;  i++){
       note  =  selectedNotes[i]
       song.moveNote(note,  note.instrument,  note.instrument,  note.time,  note.time*multiplier,  note.type,  note.type)
       song.update(note)
}
Reply
#4

(03-18-2018, 05:58 PM)korwynkim Wrote:  You really should write cleaner code and use more descriptive variable names Tounge

Here it is cleaned up

Code:
multiplier  =  parseFloat(prompt("How much do you want to scale the note lengths?"))

for(i  =  0;  i  <  selectedNotes.length;  i++){
       note  =  selectedNotes[i]
       song.moveNote(note,  note.instrument,  note.instrument,  note.time,  note.time*multiplier,  note.type,  note.type)
       song.update(note)
}

What? No! Now it isn't as short as possible! /s

Kim Wrote:https://js-game.glitch.me + Doesnt take peopel serious if their has badly speling gramer puntuatin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
Expand chat