supersonic-scsynth 0.23.1 → 0.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- > **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.
1
+ > **Note: Still Alpha Status**: _SuperSonic is in active development._ The API may continue to evolve, but the core synthesis engine is solid and ready for experimentation. _Feedback and ideas are most welcome._
2
2
 
3
3
  ```
4
4
  ░█▀▀░█░█░█▀█░█▀▀░█▀▄░█▀▀░█▀█░█▀█░▀█▀░█▀▀
@@ -6,90 +6,64 @@
6
6
  ░▀▀▀░▀▀▀░▀░░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀
7
7
  ```
8
8
 
9
- **SuperSonic** - [SuperCollider](https://supercollider.github.io/)'s powerful audio synthesis engine scsynth running in the browser as an [AudioWorklet](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet).
9
+ Back in the late 90s James McCartney designed a series of live audio programming environments called [SuperCollider](https://en.wikipedia.org/wiki/SuperCollider). These were systems with both programming languages and audio runtimes carefully designed for live realtime modification at every level - from high sweeping programming language abstractions all the way down to the fine control of the low-level synthesis components of the audio chain.
10
10
 
11
- - _AudioWorklet_ - runs in a dedicated high priority audio thread
12
- - _WebAssembly_ - scsynth's C++ code compiled for the web
13
- - _OSC API_ - talk to the scsynth server through its native OSC API
14
- - _Zero Config CDN_ - works directly from unpkg with no server setup
11
+ One of the many gifts from this work is **scsynth** - the core synthesis engine James created for version 3 of SuperCollider. It was at this point when he _formally separated the language from the synth engine_.
15
12
 
16
- **[Try the live demo](https://sonic-pi.net/supersonic/demo.html)**
13
+ This split made it possible to combine **scsynth**'s powerful audio synthesis capabilities with any existing - or yet to exist - programming language.
17
14
 
18
- ## Getting Started
15
+ This then led to a suite of powerful new live coding languages using **scsynth** for audio synthesis.
19
16
 
20
- ### CDN (Zero Config)
17
+ _What if you didn't just bring your language to scsynth? What if you brought scsynth to your environment?_
21
18
 
22
- The simplest way to use SuperSonic - no server setup required:
19
+ This is SuperSonic. All the synthesis power of **scsynth** - modified and augmented to run in your web browser.
23
20
 
24
- ```html
25
- <script type="module">
26
- import { SuperSonic } from "https://unpkg.com/supersonic-scsynth@latest";
21
+ # Welcome to SuperSonic
27
22
 
28
- const supersonic = new SuperSonic();
29
- await supersonic.init();
30
- await supersonic.loadSynthDef("sonic-pi-prophet");
31
- supersonic.send("/s_new", "sonic-pi-prophet", -1, 0, 0, "note", 60);
32
- </script>
33
- ```
23
+ **SuperSonic** is [SuperCollider](https://supercollider.github.io/)'s powerful audio synthesis engine **scsynth** running in the browser as an [AudioWorklet](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet).
34
24
 
35
- All URLs are auto-detected from the import path. See `example/cdn.html` for a working example.
25
+ Highlights:
36
26
 
37
- ### Self-Hosted
27
+ - **AudioWorklet** - runs in a dedicated high priority audio thread
28
+ - **WebAssembly** - scsynth's original C++ code compiled for the web
29
+ - **OSC API** - talk to the scsynth server through its native OSC API
30
+ - **Zero Config via CDN** - no installation necessary - works directly from CDNs such as unpkg.
31
+ - **Optional SAB mode** - can use a SharedArrayBuffer (SAB) for lower latency and reduced jitter with internal comms. Requires COOP/COEP headers to enable browsers to use the SAB
38
32
 
39
- You can also host the files yourself:
40
33
 
41
- ```javascript
42
- import { SuperSonic } from "./supersonic/supersonic.js";
34
+ ## Demo
43
35
 
44
- const supersonic = new SuperSonic(); // URLs auto-detected from import path
45
- await supersonic.init();
46
- ```
47
-
48
- Or with explicit configuration:
49
-
50
- ```javascript
51
- const supersonic = new SuperSonic({
52
- baseURL: "/supersonic/"
53
- });
54
- await supersonic.init();
55
- ```
36
+ Try the live demo: [**sonic-pi.net/supersonic/demo.html**](https://sonic-pi.net/supersonic/demo.html)
56
37
 
57
- ### Playing Sounds
58
38
 
59
- Load and play a synth:
39
+ ## Documentation
60
40
 
61
- ```javascript
62
- await supersonic.loadSynthDef("sonic-pi-prophet");
63
- supersonic.send("/s_new", "sonic-pi-prophet", -1, 0, 0, "note", 60);
64
- ```
41
+ - [API Reference](docs/API.md) - Methods, callbacks, and configuration
42
+ - [Server Command Reference](docs/SERVER_COMMAND_REFERENCE.md) - OSC commands for controlling scsynth
43
+ - [Deployment](docs/DEPLOYMENT.md) - CDN, self-hosting, browser requirements
44
+ - [Metrics](docs/METRICS.md) - Performance monitoring and debugging
45
+ - [Building from Source](docs/BUILDING.md) - Compiling the WASM yourself
65
46
 
66
- Load and play a sample:
67
47
 
68
- ```javascript
69
- await supersonic.loadSynthDef("sonic-pi-basic_stereo_player");
70
- await supersonic.loadSample(0, "loop_amen.flac");
71
- supersonic.send("/s_new", "sonic-pi-basic_stereo_player", -1, 0, 0, "buf", 0);
72
- ```
48
+ ## Getting Started
73
49
 
74
- See `example/simple.html` for a minimal working example.
50
+ In order to use SuperSonic, you need to first install it, configure it, boot it _then play_. Luckily these are all really easy. We'll go through each in turn:
75
51
 
76
- ## Installation
52
+ 1. Install
53
+ 2. Configure
54
+ 3. Boot & Play
77
55
 
78
- ### Option 1: CDN (Recommended for Getting Started)
56
+ ### 1. Install [Easy - CDN]
79
57
 
80
- No installation needed - just import directly:
58
+ Import SuperSonic directly from a CDN such as unpkg for the simplest way to get started:
81
59
 
82
60
  ```javascript
83
61
  import { SuperSonic } from "https://unpkg.com/supersonic-scsynth@latest";
84
62
  ```
85
63
 
86
- ### Option 2: npm
87
-
88
- ```bash
89
- npm install supersonic-scsynth
90
- ```
64
+ ### 1. Install [Advanced - Self-Hosted]
91
65
 
92
- ### Option 3: Self-Hosted Bundle
66
+ You can also host the source yourself:
93
67
 
94
68
  Download the pre-built distribution from [GitHub Releases](https://github.com/samaaron/supersonic/releases):
95
69
 
@@ -105,18 +79,101 @@ supersonic/
105
79
  ├── supersonic.js # Main library
106
80
  ├── wasm/ # WebAssembly binaries
107
81
  ├── workers/ # Web Workers
108
- ├── synthdefs/ # 127 synth definitions
109
- └── samples/ # 206 audio samples
82
+ ├── synthdefs/ # 127 (optional) synth definitions
83
+ └── samples/ # 206 (optional) audio samples
110
84
  ```
111
85
 
112
- ## Documentation
86
+ Then import from this directory:
87
+
88
+ ```javascript
89
+ import { SuperSonic } from "./supersonic/supersonic.js";
90
+ ```
91
+
92
+ ### 2. Configure [Easy - Use Defaults]
93
+
94
+ If you're using SuperSonic's bundled samples and synthdefs, then no config is necessary:
95
+
96
+ ```javascript
97
+ const supersonic = new SuperSonic();
98
+ ```
99
+
100
+ ### 2. Configure [Advanced - In Constructor]
101
+
102
+ If you want to point to your own assets, you can configure this when you create your SuperSonic instance:
103
+
104
+ A. Set a base URL (derives subdirectories automatically)
105
+ ```javascript
106
+ const supersonic = new SuperSonic({
107
+ baseURL: "/audio/supersonic/"
108
+ // Derives: /audio/supersonic/workers/, /audio/supersonic/wasm/, etc.
109
+ });
110
+ ```
111
+
112
+ B. Override individual paths
113
+ ```javascript
114
+ const supersonic = new SuperSonic({
115
+ workerBaseURL: "/my-workers/",
116
+ wasmBaseURL: "/my-wasm/",
117
+ synthdefBaseURL: "/my-synthdefs/",
118
+ sampleBaseURL: "/my-samples/"
119
+ });
120
+ ```
121
+
122
+ C. Enable SAB mode for lower latency (requires COOP/COEP headers)
123
+ ```javascript
124
+ const supersonic = new SuperSonic({
125
+ mode: "sab" // default is "postMessage"
126
+ });
127
+ ```
128
+
129
+ D. Enable debug logging
130
+ ```javascript
131
+ const supersonic = new SuperSonic({
132
+ debug: true // logs scsynth output, OSC in/out to console
133
+ });
134
+ ```
135
+
136
+ E. Configure scsynth server options
137
+ ```javascript
138
+ const supersonic = new SuperSonic({
139
+ scsynthOptions: {
140
+ numBuffers: 4096, // max audio buffers (default: 1024)
141
+ numAudioBusChannels: 256, // audio buses (default: 128)
142
+ realTimeMemorySize: 16384 // RT memory in KB (default: 8192)
143
+ }
144
+ });
145
+ ```
146
+ See [API Reference](docs/API.md) for all available options.
147
+
148
+ ### 3. Boot & Play
149
+
150
+ **Web browsers require you to press a button or make an explicit action before audio can start.**
151
+
152
+ The easiest way to boot SuperSonic is from a boot button handler. Consider we have the following HTML buttons:
153
+
154
+ ```html
155
+ <button id="boot-btn">boot</button>
156
+ <button id="trig-btn">trigger</button>
157
+ ```
158
+
159
+ We can then use the boot button for booting SuperSonic and the trigger button to trigger a synth:
160
+
161
+ ```javascript
162
+ const bootBtn = document.getElementById("boot-btn");
163
+ const trigBtn = document.getElementById("trig-btn");
164
+
165
+ bootBtn.onclick = async () => {
166
+ await supersonic.init();
167
+ await supersonic.loadSynthDefs(["sonic-pi-prophet"]);
168
+ };
169
+
170
+ trigBtn.onclick = async () => {
171
+ supersonic.send("/s_new", "sonic-pi-prophet", -1, 0, 0, "note", 28, "release", 8, "cutoff", 70);
172
+ };
173
+ ```
174
+
175
+ See `example/simple.html` for a minimal working example.
113
176
 
114
- - [API Reference](docs/API.md) - Methods, callbacks, and configuration
115
- - [Server Command Reference](docs/SERVER_COMMAND_REFERENCE.md) - OSC commands for controlling scsynth
116
- - [Metrics](docs/METRICS.md) - Performance monitoring and debugging
117
- - [Browser Setup](docs/BROWSER_SETUP.md) - Required headers and browser requirements
118
- - [CDN and Self-Hosting](docs/CDN.md) - Why self-hosting is required
119
- - [Building from Source](docs/BUILDING.md) - Compiling the WASM yourself
120
177
 
121
178
  ## Support
122
179
 
@@ -125,10 +182,12 @@ SuperSonic is brought to you by Sam Aaron. Please consider joining the community
125
182
  - [Patreon](https://patreon.com/samaaron)
126
183
  - [GitHub Sponsors](https://github.com/sponsors/samaaron)
127
184
 
185
+
128
186
  ## License
129
187
 
130
188
  GPL v3 - This is a derivative work of SuperCollider
131
189
 
190
+
132
191
  ## Credits
133
192
 
134
193
  Based on [SuperCollider](https://supercollider.github.io/) 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!
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supersonic-scsynth",
3
- "version": "0.23.1",
3
+ "version": "0.23.4",
4
4
  "description": "SuperCollider scsynth WebAssembly port for AudioWorklet - Run SuperCollider synthesis in the browser",
5
5
  "main": "dist/supersonic.js",
6
6
  "unpkg": "dist/supersonic.js",