'live tone' is a web application that can run Tone.js calling code in browser.
This project is a proof of concept. Please use at your own risk.
- Clone this repository to local
- Open terminal and change current directory to repository clone directory
- Run
npm install
- Run on local, or deploy to a web server and access
Run npm run dev
.
- Run
npm run build
- Deploy build files (in
./dist
directory) to the web server - Access the web server
The web server controls whether or not the code you enter can be executed.
If you cannot execute the input code on the deployed web server, please check the configuration of Content Security Policy.
- Type the code using Tone.js in the text area
- Press
Run
button to run the code - Press
Stop
button to stop the sound
- Do not type and run a malicious code
- Do not type and run a code that ends up in an infinite loop
- Various
start
function (such as Tone.start()) don't call automatically. You must call theLiveTone.start()
function yourself instead of any other start function. - To set the bpm, please call the
LiveTone.setBpm(bpm: number)
function instead of updatingbpm.value
property. - If you start a sound that is not associated with
Tone.Transport
(such asOscillator
), register that instance using theLiveTone.registerPlaying()
function. If you don't register, you won't be able to stop. - If you run it without stopping, the new sound will overlap the previous sound.
If you have a WebSocket server (such as Azure Web PubSub) that you manage, you can share your code with other live tone users.
- Prepare the WebSocket server connection URL.
- Paste the URL to "WebSocket server URL" text input field.
- Enter your tag in the "Tag of your code" text input field.
- Press "Connect" button to connect WebSocket server.
- To share your code, press "Share" button.
- When you receive a code shared by another user, an additional tab will appear. You can browse receive codes to click tabs(read only).
- To execute all codes, press "Run" button.
- The BPM specified in your code will be used, The BPM specified in received codes will be ignored(as long as the BPM is specified using the
LiveTone.setBpm
function). - Ignore the
LiveTone.start()
function call in received codes.
MIT