diff options
| author | julian laplace <julescarbon@gmail.com> | 2025-07-07 12:13:51 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2025-07-07 12:13:51 +0200 |
| commit | 966e3b080f039fa1c62113e75e1e1481d7e19439 (patch) | |
| tree | d9b2145cf07ba64101be9ec62c83a947fdb3e720 /bundle.js | |
| parent | 784bf3ff435f5236c8d32e90cedd1a1e488c9159 (diff) | |
trigger index
Diffstat (limited to 'bundle.js')
| -rw-r--r-- | bundle.js | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -22520,7 +22520,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;(function(root, factory){ Object.defineProperty(exports, "__esModule", { value: true }); -exports.requestAudioContext = exports.roundFreq = exports.browser = exports.mod = exports.choice = undefined; +exports.requestAudioContext = exports.frequencyInRange = exports.roundFreq = exports.browser = exports.mod = exports.choice = undefined; var _tone = __webpack_require__(0); @@ -22556,6 +22556,9 @@ function mod(n, m) { function roundFreq(freq) { return Math.round(freq * 100); } +var frequencyInRange = function frequencyInRange(freq) { + return 20 < freq && freq < 15000; +}; function requestAudioContext(fn) { if (window.location.protocol !== "https:") { @@ -22604,6 +22607,7 @@ exports.choice = choice; exports.mod = mod; exports.browser = browser; exports.roundFreq = roundFreq; +exports.frequencyInRange = frequencyInRange; exports.requestAudioContext = requestAudioContext; /***/ }), @@ -23442,10 +23446,12 @@ function rebuild() { } function log() { var seen = {}; + console.log(notes); for (var i = 0; i < 8; i++) { for (var j = 0; j < 8; j++) { - var rounded = (0, _util.roundFreq)(notes[i][j].frequency); - if (!seen[rounded] && 20 < rounded && rounded < 12000) { + var frequency = notes[i][j].frequency; + var rounded = (0, _util.roundFreq)(frequency); + if (!seen[rounded] && (0, _util.frequencyInRange)(frequency)) { seen[rounded] = notes[i][j].frequency; } } @@ -23475,13 +23481,15 @@ function play(freq) { } } function trigger(freq) { - if (20 && freq.frequency && freq.frequency < 15000) { + if ((0, _util.frequencyInRange)(freq.frequency)) { instrument.play(freq.frequency); } } function trigger_index(index) { var frequency = frequencies[index]; - instrument.play(frequency); + if (frequency) { + instrument.play(frequency); + } } function pause(freq) { _organ2.default.pause(freq.frequency); |
