Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add held loop recording to loop-grid (hold loop button while playing)
- Loading branch information
Showing
6 changed files
with
318 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = quantizeDuration | ||
|
||
function quantizeDuration (value) { | ||
var grid = getGrid(value) | ||
return Math.round(value / grid) * grid | ||
} | ||
|
||
function getGrid (duration) { | ||
if (duration < 0.7) { | ||
return 0.5 | ||
} else if (duration < 1.7) { | ||
return 1 | ||
} else { | ||
return 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function quantizeToSquare (value) { | ||
if (value > 16) { | ||
return Math.floor(value / 16) * 16 | ||
} else if (value > 8) { | ||
return Math.floor(value / 8) * 8 | ||
} else if (value > 4) { | ||
return Math.floor(value / 4) * 4 | ||
} else if (value > 2) { | ||
return Math.floor(value / 2) * 2 | ||
} else if (value > 1) { | ||
return Math.floor(value / 1) * 1 | ||
} else if (value > 0.5) { | ||
return Math.floor(value / 0.5) * 0.5 | ||
} else { | ||
return value | ||
} | ||
} |
Oops, something went wrong.