Skip to content
Permalink
Browse files

add held loop recording to loop-grid (hold loop button while playing)

  • Loading branch information...
mmckegg committed Nov 16, 2017
1 parent aaa0757 commit 31def0b200c5cd6adbda70cdb578b83f7bb920be
Showing with 318 additions and 189 deletions.
  1. +1 −15 lib/param-looper.js
  2. +16 −0 lib/quantize-duration.js
  3. +17 −0 lib/quantize-to-square.js
  4. +140 −84 nodes/loop-grid-launchpad-mk2/object.js
  5. +143 −89 nodes/loop-grid-launchpad/object.js
  6. +1 −1 package.json
@@ -6,6 +6,7 @@ var computed = require('mutant/computed')

var getEvents = require('lib/get-events')
var ParamSource = require('lib/param-source')
var quantizeDuration = require('lib/quantize-duration')

module.exports = ParamLooper

@@ -114,18 +115,3 @@ function getLoop (events, startPos, endPos) {

return loop
}

function getGrid (duration) {
if (duration < 0.7) {
return 0.5
} else if (duration < 1.7) {
return 1
} else {
return 2
}
}

function quantizeDuration (value) {
var grid = getGrid(value)
return Math.round(value / grid) * grid
}
@@ -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
}
}
@@ -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
}
}

0 comments on commit 31def0b

Please sign in to comment.
You can’t perform that action at this time.