Try the example first to see if webaudio and motion sensors work on your phone.
By the end of this lab, you will be able to:
- Create an interactive web application that connects a modality (e.g., phone sensors such as accelerometer, gyroscope, or touch) to sound control using Faust and WebAssembly (WASM).
- Build and test a Faust DSP module running in the browser.
- Integrate sensor data or other input modalities to control sound parameters in real time.
- Use Git, GitHub, and GitHub Pages to manage and publish your own version of the project.
- Install VScode or use another IDE you're comfortable with (we use VSCode)
- Use your KTH Git account.
- Fork this lab repository to your own GitHub account.
- Do not push to the teacher’s repository.
- Clone your forked repository to your local computer:
git clone <URL-of-your-fork>
- Generate the WebAssembly (WASM) file using Faust IDE. You can see how to do it at this link
- Enable GitHub Pages on your forked repository to host your project. You can see how to do it at this link
For each interaction:
-
Open
interaction-n.jsand locate the following:const dspName = "tuono";
-
Replace
"tuono"with the name of your generated WASM file (without the.wasmextension). -
Locate the following string and replace tuono with the name of your WASM file:
tuono.createDSP(audioContext, 1024) .then(node => {...
You have two options to run the project locally:
-
Option 1 (Recommended): Use Live Server in VS Code.
-
Option 2: Create a simple Python server from the terminal:
python3 -m http.server
If you already forked the repo, you don’t need to clone again. To keep your local version updated with your fork, use:
git pull- Go to Settings → Developer settings → Personal access tokens → Tokens (classic).
- Create a new access token with permissions for your repository.
- When prompted to log in via terminal, use your token instead of your password.
git add .
git commit -m "your commit message"
git push -u origin main- You must fork the repository and work on your own copy.
- Do not push to the teacher’s repository.
- Ensure your project is published on GitHub Pages from your fork.
- Submit the link to your GitHub Pages site and your repository URL as your lab submission on Canvas.