Remove Tone.js from JavaScript package?
See original GitHub issueThe package at https://cdn.jsdelivr.net/npm/@magenta/music@0.0.5/dist/magentamusic.min.js now includes Tone.js as well, as the player using it is exported from core.ts
.
I don’t think this is something users would expect, and may cause issues with projects using other versions of Tone.
Issue Analytics
- State:
- Created 5 years ago
- Comments:27 (17 by maintainers)
Top Results From Across the Web
Remove Tone.js from JavaScript package? · Issue #56 - GitHub
I like having the player accessible from our package. ... Tone.js currently doesn't play too nice when it's loaded multiple times on a...
Read more >tone - npm
js is a Web Audio framework for creating interactive music in the browser. The architecture of Tone.js aims to be familiar to both...
Read more >Destination - Tone.js
Defined in: Tone/core/context/ToneWithContext.ts ... NOTE: this will disconnect any nodes which were previously chained in the master effects chain.
Read more >is Tone.js meant to be used within browser? - Google Groups
The library is made for using with the browser, once you install it with npm it should be in the modules folder of...
Read more >p5.js sound library: how to add/remove p5. Phrases() from p5 ...
You're right, there is a bug in p5.sound so that p5.Part.removePhrase does not work. Here's a fix: Add the following snippet at the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Haven’t done a ton of research into this, but shouldn’t tree-shaking remove the need for splitting apart @magenta/music into multiple packages?
In an ideal world
import { Coconet } from @magneta/music
would only pull in just the model and it’s dependency files, so if that model didn’t rely on anything with Web Audio / Tone.js, then it wouldn’t be compiled into your code. In practice i’ve found that you’ve got to deep require Coconet by doing something likeimport {Coconet} from @magenta/music/es5/coconet/Model
.Reading a little about tree-shaking with typescript just now, seems like maybe setting the tsconfig to export an
esnext
module with import/export statements instead of allrequire
statements would enable tree-shaking in compilers that support it (like webpack).I haven’t tested this out myself, just wondering if this might be a simpler direction that is better setup for future browser/ES6 developments vs reorganizing the codebase into multiple packages.
@teropa I agree, and ideally we could provide some sort of interface/adapters so one can bring their own player/lower level audio implementation.