Console Commands: Difference between revisions

Jump to navigation Jump to search
m
Added an example for using tweakNotes, showing how one can use it to also quantize note length instead of just time
No edit summary
m (Added an example for using tweakNotes, showing how one can use it to also quantize note length instead of just time)
 
Line 200: Line 200:
We can also use tweakNotes to quantize the note times. This code snaps the notes to the nearest grid line (grid is a global variable that contains the grid value, see setGrid above):
We can also use tweakNotes to quantize the note times. This code snaps the notes to the nearest grid line (grid is a global variable that contains the grid value, see setGrid above):
  tweakNotes(n=>n.time = Math.round(n.time * grid) / grid)
  tweakNotes(n=>n.time = Math.round(n.time * grid) / grid)
OR if you want to quantize note ''length'', just swap out where it says "n.time" for "n.length":
tweakNotes(n=>n.length = Math.round(n.length * grid) / grid)
Another example is the humanize function, which is built on tweakNotes (in fact, several of the other functions could be rewritten in terms of tweakNotes):
Another example is the humanize function, which is built on tweakNotes (in fact, several of the other functions could be rewritten in terms of tweakNotes):
  function humanize(volumeVariation = 0.2, timeVariation = 0.1) {
  function humanize(volumeVariation = 0.2, timeVariation = 0.1) {
6

edits

Navigation menu