Upgrade Tone.js from v13 to v15 - #64
Merged
Merged
Conversation
Tone.js dropped its default export and removed several deprecated globals (Master, Transport, context) in favour of getDestination(), getTransport() and getContext(). PolySynth's constructor also dropped the leading polyphony argument in favour of a single options object. Also drops the startaudiocontext dependency, since Tone now ships its own Tone.start() for resuming the audio context on a user gesture.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tonefrom^13.8.34to^15.5.36(spans the v14 TypeScript rewrite and subsequent v15 releases)import * as Tone from 'tone'Tone.Master→Tone.getDestination(),Tone.Transport→Tone.getTransport(),Tone.context→Tone.start()where applicablestartaudiocontextdependency in favour of Tone's built-inTone.start()PolySynth's constructor call — v14.3+ removed the leadingpolyphonypositional argument in favour of a single options object ({ maxPolyphony, voice, options }); the old call form throws at runtime on the new versionChannel,Sampler,MembraneSynth,MetalSynth,NoiseSynth,PluckSynth,Sequence, and all effect types) against the v15 type declarations — all kept backwards-compatible positional signatures, no changes neededsrc/__mocks__/tone.ts) to the new named-export shape and re-enabled 3 previously-skippedEffecttests, fixing stale/incorrect assertions along the way (wrong mock reference, missingdisposekey)Test plan
npm test— all 14 tests pass (0 skipped)npm run lint— cleannpm run build— builds successfullyMetalSynth's default sonic parameters shifted somewhat between v13 and v15 even though the constructor call is unchanged)🤖 Generated with Claude Code