Console Commands: Difference between revisions

Add a tweakNotes example showing how to quantize notes
(Update fade notes section to mention fadeNotesIn and fadeNotesOut)
(Add a tweakNotes example showing how to quantize notes)
Line 178: Line 178:
For example, you can halve the volume like this (eg for a custom delay effect, copy, shift, then tweak the volume):
For example, you can halve the volume like this (eg for a custom delay effect, copy, shift, then tweak the volume):
  tweakNotes(n => n.volume *= 0.5)
  tweakNotes(n => n.volume *= 0.5)
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)
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) {