supersonic-scsynth-synthdefs 0.2.2 → 0.2.3

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.
Files changed (2) hide show
  1. package/README.md +22 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,22 +16,24 @@ npm install supersonic-scsynth supersonic-scsynth-synthdefs
16
16
 
17
17
  ## Usage
18
18
 
19
- ### Browser with CDN
19
+ **Important:** SuperSonic cannot be loaded from a CDN. You must self-host the core library and serve it with COOP/COEP headers. Synthdefs can be loaded from a CDN.
20
+
21
+ ### Self-hosted core with CDN synthdefs
20
22
 
21
23
  ```javascript
22
- import { SuperSonic } from 'https://unpkg.com/supersonic-scsynth';
24
+ // Self-hosted core library
25
+ import { SuperSonic } from './dist/supersonic.js';
23
26
 
24
- const sonic = new SuperSonic();
27
+ const sonic = new SuperSonic({
28
+ synthdefBaseURL: 'https://unpkg.com/supersonic-scsynth-synthdefs/synthdefs/'
29
+ });
25
30
  await sonic.init();
26
31
 
27
32
  // Load synthdefs from CDN
28
- await sonic.loadSynthDefs(
29
- ['sonic-pi-beep', 'sonic-pi-tb303', 'sonic-pi-prophet'],
30
- 'https://unpkg.com/supersonic-scsynth-synthdefs/synthdefs/'
31
- );
33
+ await sonic.loadSynthDefs(['sonic-pi-beep', 'sonic-pi-tb303', 'sonic-pi-prophet']);
32
34
  ```
33
35
 
34
- ### Browser with Bundler (Vite/Webpack)
36
+ ### Self-hosted core and synthdefs
35
37
 
36
38
  Copy synthdefs to your public directory:
37
39
 
@@ -42,24 +44,27 @@ cp -r node_modules/supersonic-scsynth-synthdefs/synthdefs public/
42
44
  Then use:
43
45
 
44
46
  ```javascript
45
- import { SuperSonic } from 'supersonic-scsynth';
47
+ import { SuperSonic } from './dist/supersonic.js';
46
48
 
47
- const sonic = new SuperSonic();
49
+ const sonic = new SuperSonic({
50
+ synthdefBaseURL: '/synthdefs/'
51
+ });
48
52
  await sonic.init();
49
53
 
50
- await sonic.loadSynthDefs(
51
- ['sonic-pi-beep', 'sonic-pi-tb303'],
52
- '/synthdefs/'
53
- );
54
+ await sonic.loadSynthDefs(['sonic-pi-beep', 'sonic-pi-tb303']);
54
55
  ```
55
56
 
56
- ### Using Path Helper (Node.js)
57
+ ### Using the CDN path helper
57
58
 
58
59
  ```javascript
60
+ import { SuperSonic } from './dist/supersonic.js';
59
61
  import { SYNTHDEFS_CDN } from 'supersonic-scsynth-synthdefs';
60
62
 
61
- // Use CDN path for browser compatibility
62
- await sonic.loadSynthDefs(['sonic-pi-beep'], SYNTHDEFS_CDN);
63
+ const sonic = new SuperSonic({
64
+ synthdefBaseURL: SYNTHDEFS_CDN
65
+ });
66
+ await sonic.init();
67
+ await sonic.loadSynthDefs(['sonic-pi-beep']);
63
68
  ```
64
69
 
65
70
  ## Included Synthdefs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supersonic-scsynth-synthdefs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "All Sonic Pi synthdefs for SuperSonic scsynth",
5
5
  "main": "index.js",
6
6
  "type": "module",