Skip to content

Commit

Permalink
Update Tone.js to bleeding edge. Closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLaumeister committed Dec 22, 2019
1 parent c34d8c3 commit 34d5197
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
28 changes: 21 additions & 7 deletions lib/Tone.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/NotePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NotePlayer {
rolloff: -12,
}).toMaster();

const synth = new Tone.PolySynth(16, Tone.Synth, {
const synth = new Tone.PolySynth(Tone.Synth, {
oscillator: {
type: 'sine',
},
Expand Down
8 changes: 2 additions & 6 deletions src/ToneMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,8 @@ class ToneMatrix {

const heatmap = this.getParticleHeatMap();

// Progress, adjusted for the latency hint
function positivemod(n, m) {
return ((n % m) + m) % m;
}
const adjustedSeconds = positivemod((Tone.Transport.seconds - this.SYNTHLATENCY),
(Tone.Transport.loopEnd - Tone.Transport.loopStart));
const adjustedSeconds = Tone.Transport.seconds
% (Tone.Transport.loopEnd - Tone.Transport.loopStart);
const adjustedProgress = adjustedSeconds / (Tone.Transport.loopEnd - Tone.Transport.loopStart);

const playheadx = Math.floor(adjustedProgress * this.WIDTH);
Expand Down

0 comments on commit 34d5197

Please sign in to comment.