Online Sequencer Make music online
  • Sequences
  • Members
  • Import MIDI
  • Forum

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

Online Sequencer Forums › Online Sequencer › Suggestions
« Previous 1 … 7 8 9 10 11 … 29 Next »

Time Tool

Thread tools
Time Tool
Frank Offline
Grey Hat Script Kiddie who can Compose Music
392 Posts:
 
#1
03-18-2018, 04:42 PM (This post was last modified: 03-18-2018, 04:43 PM by Frank.)
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
Tests Offline
Member
94 Posts:
 
#2
03-18-2018, 04:57 PM
Nice!


Reply
korwynkim Offline
cat
17 Posts:
 
#3
03-18-2018, 05:58 PM
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)
}


Trophy: https://imgur.com/a/4B0juxZ
Reply
Frank Offline
Grey Hat Script Kiddie who can Compose Music
392 Posts:
 
#4
03-18-2018, 09:01 PM
(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
  • x1
    • x1
    • Tests
Reply
environmentalSlimePreference Offline
Member
1 Posts:
 
#5
06-16-2021, 02:05 PM
updated selectedNotes to selection.notes and removed song.update apparently



multiplier = parseFloat(prompt("How much do you want to scale?"))

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


Reply
Liam Offline
Code Monkey
195 Posts:
 
#6
06-17-2021, 09:52 AM
This thread is super out of date. There's now an official console command for this:
stretchNotes(scaleFactor)

It can also handle markers, and negative stretching (tho markers can't be negatively stretched)


https://www.youtube.com/playlist?list=PL...v872SZVXzI

[Image: unknown.png]
Reply



Users browsing this thread:   1 Guest(s)


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