Share a Tone.js sound demo as a link
AI tools write synths, drum machines and sound toys with Tone.js. Load Tone.js from a CDN in one HTML file, start the audio from a button click, then upload it and send the link.
Ask Claude or ChatGPT for a synth, a step sequencer or a sound effect and the code often uses Tone.js. It plays in the chat preview. Saved and opened somewhere else, the same code can load without a sound or stop on an error before anything appears.
Tone.js runs in the browser with no server, so one HTML file is enough. Load it from a CDN, start the audio from a click, and upload the file.
The file
Put the markup the AI tool wrote in an HTML file. At the end of the body add:
- ✓<script src="https://cdn.jsdelivr.net/npm/tone@15.1.22/build/Tone.js"></script>
- ✓A button, for example <button id="play">Play</button>.
- ✓Then a <script> that creates the instruments and, inside the button's click handler, runs await Tone.start(); before the first note.
- ✓Tested in Chrome with Tone.js 15.1.22: the audio context stayed "suspended" after the page loaded, switched to "running" after one click on the button, and a Tone.Synth played a C4 note.
No sound, warning "AudioContext was not allowed to start"
Browsers block sound until the visitor clicks or taps something on the page. Code that plays a note as soon as the page loads stays silent. Chrome logs "The AudioContext was not allowed to start" and Tone.js adds "The AudioContext is "suspended". Invoke Tone.start() from a user action".
Move the first note into a click handler and call await Tone.start() there. The browser warning also appears on a working page before the first click; it goes away once the visitor presses Play.
Nothing loads, error "Failed to resolve module specifier"
Code written for a build tool starts with import * as Tone from "tone". A browser does not know where "tone" lives, so the module stops on its first line with "Failed to resolve module specifier "tone"" in the console.
Two fixes, both tested. Delete the import line and load Tone.js with the script tag above; Tone becomes a global the code can use as written. Or keep the import and add an import map in the head: <script type="importmap">{ "imports": { "tone": "https://esm.sh/tone@15.1.22" } }</script>.
Upload it and send the link
Drag the file onto the FileShare Pro dashboard and copy the link. Viewers need no account; they press Play and hear what you hear.
Turn on comments and listeners can pin notes to a spot on the page after typing a name. When you change the tempo or the sound, upload the new file over the old one; the link stays the same: updating a shared link without changing it.
Related: sharing an HTML game as a link, sharing a p5.js or three.js sketch as a link and why a page that works in chat breaks when hosted.
Frequently asked
Yes. Tone.Player and Tone.Sampler load audio from a URL, so the files need a public address; links to files on your computer will not load for viewers.
Every major browser blocks audio until the visitor interacts with the page. No host can turn that off, so give the page a Play button.
Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free