Skip to content

Commit

Permalink
Bug fix upsampling - fixes #26 (#27)
Browse files Browse the repository at this point in the history
* update git-ignore for vscode and macos

* proposed fix for when sampling lines - fixes bug #26
  • Loading branch information
tremblap authored Aug 14, 2023
1 parent 840beda commit 5d2ecf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules
fluid.waveform.tar.gz
/**/fav-max.js
pnpm-lock.yaml
.vscode
.DS_Store
2 changes: 1 addition & 1 deletion src/api-max.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Signal.prototype['sample'] = function(step, method = "mean"){
if(bucketStart > this.data.length - 1 ) bucketStart = this.data.length -1;
if(bucketEnd > this.data.length -1 ) bucketEnd = this.data.length -1;
if(bucketStart === bucketEnd) {
newData[i] = i > 0 ? newData[i-1] : this.data[i]; //<------- diff
newData[i] = this.data[bucketStart];
}
else newData[i] = stats[method](this.data.slice(bucketStart, bucketEnd));
}
Expand Down

0 comments on commit 5d2ecf3

Please sign in to comment.