Permalink
Browse files

tool fixes

  • Loading branch information...
wizgrav committed Dec 28, 2017
1 parent 8529541 commit 8f0e6f48b910a2b0d0c0356510f0570e34a6a923
Showing with 70 additions and 28 deletions.
  1. +21 −6 dist/clubber.js
  2. +1 −1 dist/clubber.min.js
  3. +1 −1 dist/clubber.min.js.map
  4. +21 −6 index.js
  5. +6 −2 lib/common.js
  6. +1 −1 package.json
  7. +2 −4 tool/main.js
  8. +17 −7 tool/tool.html
View
@@ -45,8 +45,8 @@
/***/ (function(module, exports) {
/*
* clubber.js 1.7.0 Copyright (c) 2016-2017, Yannis Gravezas All Rights Reserved.
* Available via the MIT license. Check http://github.com/wizgrav/clubber for info.
* clubber.js 1.7.1 Copyright (c) 2016-2017, Yannis Gravezas All Rights Reserved.
* Available under the MIT license. See http://github.com/wizgrav/clubber for info.
*/
var Clubber = function (config) {
@@ -68,6 +68,15 @@
}
});
Object.defineProperty(this, 'fftSize', {
get: function() {
return analyser.fftSize;
},
set: function(value) {
analyser.fftSize = value;
}
});
this._muted = true;
Object.defineProperty(this, 'muted', {
@@ -87,10 +96,15 @@
}
}
});
Object.defineProperty(this, 'sampleRate', {
get: function() {
return this.context.sampleRate;
}
});
this.analyser = analyser;
this.rate = config.rate || this.context.sampleRate;
this.resize(analyser.frequencyBinCount);
this.muted = !!config.mute;
@@ -110,7 +124,7 @@
this.notes = new Uint8Array(128);
this.weights = new Uint8Array(128);
for(var i = 0, inc=(this.rate/2)/this.bufferLength; i < this.bufferLength;i++){
for(var i = 0, inc=(this.sampleRate/2)/this.bufferLength; i < this.bufferLength;i++){
var freq = (i+0.5)*inc;
this.maxBin = i;
if(freq > 13280) {
@@ -307,7 +321,7 @@
var c = this.cache, self=this;
if (data) {
if(isProcessed) {
if(isProcessed || data.length === 128) {
this.notes.set(data);
return;
}
@@ -316,6 +330,7 @@
this.analyser.getByteFrequencyData(this.data);
isProcessed = false;
data = this.data;
this.resize(this.analyser.frequencyBinCount);
}
// Calculate energy per midi note and fill holes in the lower octaves
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 8f0e6f4

Please sign in to comment.