Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kamidev/supersonic

 
 

Repository files navigation

Note: Alpha Status: SuperSonic is in active development. The API may evolve, but the core synthesis engine is solid and ready for experimentation. Feedback and ideas are most welcome.

░█▀▀░█░█░█▀█░█▀▀░█▀▄░█▀▀░█▀█░█▀█░▀█▀░█▀▀
░▀▀█░█░█░█▀▀░█▀▀░█▀▄░▀▀█░█░█░█░█░░█░░█░░
░▀▀▀░▀▀▀░▀░░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀

SuperSonic - SuperCollider's powerful audio synthesis engine scsynth running in the browser as an AudioWorklet.

  • AudioWorklet - runs in a dedicated high priority audio thread
  • WebAssembly - scsynth's C++ code compiled for the web
  • OSC API - talk to the scsynth server through its native OSC API

Try the live demo

Getting Started

Injecting the full power of SuperCollider's scsynth audio engine into your browser is simple.

Import SuperSonic and initialise it:

import { SuperSonic } from "supersonic-scsynth";

const baseURL = "/supersonic"; // Configure for your setup
const sonic = new SuperSonic({
  workerBaseURL: `${baseURL}/workers/`,
  wasmBaseURL: `${baseURL}/wasm/`,
  synthdefBaseURL: `${baseURL}/synthdefs/`,
  sampleBaseURL: `${baseURL}/samples/`,
});
await sonic.init();

Load and play a synth:

await sonic.loadSynthDef("sonic-pi-prophet");
sonic.send("/s_new", "sonic-pi-prophet", -1, 0, 0, "note", 60);

Load and play a sample:

await sonic.loadSynthDef("sonic-pi-basic_stereo_player");
await sonic.loadSample(0, "loop_amen.flac");
sonic.send("/s_new", "sonic-pi-basic_stereo_player", -1, 0, 0, "buf", 0);

Take a look at example/simple.html for a minimal working example.

Installation

Grab the latest pre-built distribution and host it on your server:

curl -O https://samaaron.github.io/supersonic/supersonic-dist.zip
unzip supersonic-dist.zip

Or install via npm:

npm install supersonic-scsynth-bundle

Note: SuperSonic must be self-hosted due to browser security requirements around SharedArrayBuffer. It cannot be loaded from a CDN. See Browser Setup for the details.

Documentation

Support

SuperSonic is brought to you by Sam Aaron. Please consider joining the community of supporters enabling Sam's work on creative coding projects like this, Sonic Pi and Tau5.

License

GPL v3 - This is a derivative work of SuperCollider

Credits

Based on SuperCollider by James McCartney and the SuperCollider community. This AudioWorklet port was inspired by Hanns Holger Rutz who started the first port of scsynth to WASM and Dennis Scheiba who continued this work. Thank you to everyone in the SuperCollider community!

About

SuperCollider's scsynth audio engine as a web audioworklet

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.9%
  • C 1.1%
  • JavaScript 0.6%
  • HTML 0.3%
  • Shell 0.1%
  • CMake 0.0%