@kano/stem-daw 0.1.0

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 (67) hide show
  1. package/README.md +253 -0
  2. package/dist/chat-actions-54Z6URC4.js +7 -0
  3. package/dist/chat-actions-54Z6URC4.js.map +1 -0
  4. package/dist/chunk-56PWIP7O.js +1029 -0
  5. package/dist/chunk-56PWIP7O.js.map +1 -0
  6. package/dist/chunk-AAVC7KUW.js +145 -0
  7. package/dist/chunk-AAVC7KUW.js.map +1 -0
  8. package/dist/chunk-KCOOE2OP.js +1764 -0
  9. package/dist/chunk-KCOOE2OP.js.map +1 -0
  10. package/dist/chunk-LO74ZJ4H.js +23923 -0
  11. package/dist/chunk-LO74ZJ4H.js.map +1 -0
  12. package/dist/chunk-OFGZURP6.js +247 -0
  13. package/dist/chunk-OFGZURP6.js.map +1 -0
  14. package/dist/chunk-OYNES5W3.js +3085 -0
  15. package/dist/chunk-OYNES5W3.js.map +1 -0
  16. package/dist/chunk-QQ5NZTHT.js +336 -0
  17. package/dist/chunk-QQ5NZTHT.js.map +1 -0
  18. package/dist/chunk-TBXCZFAY.js +13713 -0
  19. package/dist/chunk-TBXCZFAY.js.map +1 -0
  20. package/dist/chunk-U44X6QP5.js +281 -0
  21. package/dist/chunk-U44X6QP5.js.map +1 -0
  22. package/dist/chunk-UKMELGZL.js +27 -0
  23. package/dist/chunk-UKMELGZL.js.map +1 -0
  24. package/dist/components/DAWView.d.ts +19 -0
  25. package/dist/components/DAWView.js +11 -0
  26. package/dist/components/DAWView.js.map +1 -0
  27. package/dist/daw-controller-BjRWcTol.d.ts +339 -0
  28. package/dist/engine/daw-controller.d.ts +3 -0
  29. package/dist/engine/daw-controller.js +5 -0
  30. package/dist/engine/daw-controller.js.map +1 -0
  31. package/dist/engine/daw-import-stem-fm-config.d.ts +224 -0
  32. package/dist/engine/daw-import-stem-fm-config.js +7 -0
  33. package/dist/engine/daw-import-stem-fm-config.js.map +1 -0
  34. package/dist/fetchStationTracks-SKFT4V3U.js +3 -0
  35. package/dist/fetchStationTracks-SKFT4V3U.js.map +1 -0
  36. package/dist/index.d.ts +308 -0
  37. package/dist/index.js +332 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/interface-DaRj7RkY.d.ts +66 -0
  40. package/dist/interfaces-5ZlG0Y4Y.d.ts +549 -0
  41. package/dist/media-session-XTP6PP7Q.js +3 -0
  42. package/dist/media-session-XTP6PP7Q.js.map +1 -0
  43. package/dist/note-detection-PPLM7R2H.js +148 -0
  44. package/dist/note-detection-PPLM7R2H.js.map +1 -0
  45. package/dist/sampler-audio-B7MBG3YN.js +3 -0
  46. package/dist/sampler-audio-B7MBG3YN.js.map +1 -0
  47. package/dist/sampler-store-QPHANXYP.js +3 -0
  48. package/dist/sampler-store-QPHANXYP.js.map +1 -0
  49. package/dist/services/track-search-api.d.ts +152 -0
  50. package/dist/services/track-search-api.js +4 -0
  51. package/dist/services/track-search-api.js.map +1 -0
  52. package/dist/store/daw-auth-store.d.ts +31 -0
  53. package/dist/store/daw-auth-store.js +3 -0
  54. package/dist/store/daw-auth-store.js.map +1 -0
  55. package/dist/store/daw-session-store.d.ts +255 -0
  56. package/dist/store/daw-session-store.js +3 -0
  57. package/dist/store/daw-session-store.js.map +1 -0
  58. package/dist/vite/index.d.ts +46 -0
  59. package/dist/vite/index.js +94 -0
  60. package/dist/vite/index.js.map +1 -0
  61. package/dist/workers/analysis-worker.js +379 -0
  62. package/dist/workers/buffer-player-processor-202602.lavv8e32-ts.js +1 -0
  63. package/dist/workers/daw-stem-processor.js +228 -0
  64. package/dist/workers/manifest.json +10 -0
  65. package/dist/workers/phase-vocoder3.js +920 -0
  66. package/dist/workers/realtime-pitch-shift-processor.js +2 -0
  67. package/package.json +151 -0
package/README.md ADDED
@@ -0,0 +1,253 @@
1
+ # `@kano/stem-daw`
2
+
3
+ Stem DAW UI — React components, controller, and stores for the STEM
4
+ beat-quantized DAW. Renders the full DAW timeline, transports, sample
5
+ search, autotune & beats lab panels. Builds on top of the audio engine
6
+ that ships separately as `@kano/stem-web-audio-player` (this package
7
+ bundles the engine internals it needs, so you do **not** have to
8
+ install the engine package alongside).
9
+
10
+ This package is consumed by `stem-player-rd` behind the `/studio`
11
+ route. The same source tree also builds the standalone DAW web app at
12
+ `daw.html` (see `vite.config.daw.ts`).
13
+
14
+ > **CONSTRAINT** Publishing is purely a packaging change. The runtime
15
+ > behaviour — `DAWView`, the `DAWController` state machine, the
16
+ > `StemFmMixConfig` import contract — is identical to the standalone
17
+ > build.
18
+
19
+ ---
20
+
21
+ ## Local development (same pattern as `@kano/stem-web-audio-player`)
22
+
23
+ This is the workflow we use day-to-day. No npm publish required.
24
+
25
+ ### Option A — sibling `file:` install (recommended in the monorepo)
26
+
27
+ With `stem-player-rd` and `stem-studio` as siblings under `~/Code/`:
28
+
29
+ ```sh
30
+ # stem-studio — build the library once, rebuild after DAW changes
31
+ cd stem-studio
32
+ yarn install
33
+ yarn build:lib
34
+ # optional: rebuild on save
35
+ yarn watch
36
+
37
+ # stem-player-rd — point at the sibling package (package.json):
38
+ # "@kano/stem-daw": "file:../stem-studio"
39
+ cd ../stem-player-rd
40
+ npm install
41
+ STEM_DAW_LOCAL=1 npm run prod # hot-reload from stem-studio *source*
42
+ ```
43
+
44
+ `file:../stem-studio` resolves through this repo's `package.json` `exports`
45
+ → `dist/`. Run `yarn build:lib` (or `yarn watch`) whenever you change DAW
46
+ code and are **not** using `STEM_DAW_LOCAL=1`.
47
+
48
+ ### Option B — `yarn link`
49
+
50
+ ```sh
51
+ # stem-studio
52
+ yarn link
53
+ yarn install && yarn build:lib && yarn watch
54
+
55
+ # consumer (e.g. stem-player-rd)
56
+ yarn link @kano/stem-daw
57
+ yarn install
58
+ yarn prod # or your app's dev script
59
+ ```
60
+
61
+ ### Option C — live source in the consumer (like `STEM_ENGINE_LOCAL`)
62
+
63
+ In `stem-player-rd`, set `STEM_DAW_LOCAL=1` or `VITE_STEM_DAW_LOCAL=1`.
64
+ Vite aliases `@kano/stem-daw/*` to `../stem-studio/src/daw/*` and serves
65
+ worklets from `stem-studio/public/workers/` — no rebuild between edits.
66
+
67
+ ---
68
+
69
+ ## Install from npm (when published)
70
+
71
+ ```sh
72
+ yarn add @kano/stem-daw
73
+ yarn add react@^19 react-dom@^19 react-router-dom@^7 zustand@^5
74
+ ```
75
+
76
+ ### Peer dependencies (must be provided by the consumer)
77
+
78
+ | Package | Range | Why |
79
+ | ------------------ | ------- | ------------------------------------------------------ |
80
+ | `react` | `^19` | DAW UI |
81
+ | `react-dom` | `^19` | DAW UI |
82
+ | `react-router-dom` | `^7` | Used by some panels for in-app navigation |
83
+ | `zustand` | `^5` | DAW stores; **must be the same instance** as your app |
84
+
85
+ Other heavyweight deps (`d3`, `framer-motion`, `hls.js`,
86
+ `@spotify/basic-pitch`, the Radix primitives, …) ship as regular
87
+ `dependencies` — npm/yarn installs them transitively.
88
+
89
+ The DAW does **not** add `@kano/stem-web-audio-player` to its peer
90
+ deps: the engine internals the DAW needs are bundled into this
91
+ package's `dist/`. Consumers that also use the engine directly (e.g.
92
+ `stem-player-rd`'s session view) install it separately; the two
93
+ copies are intentional and isolated.
94
+
95
+ ---
96
+
97
+ ## Exports map
98
+
99
+ Sub-path imports match the layout `stem-player-rd` consumes:
100
+
101
+ ```ts
102
+ import { DAWView } from '@kano/stem-daw/components/DAWView';
103
+ import { DAWController } from '@kano/stem-daw/engine/daw-controller';
104
+ import { fetchTrackForDAW } from '@kano/stem-daw/services/track-search-api';
105
+ import { useDAWSessionStore } from '@kano/stem-daw/store/daw-session-store';
106
+ import { useDAWAuthStore } from '@kano/stem-daw/store/daw-auth-store';
107
+ import {
108
+ importStemFmMixConfig,
109
+ type StemFmMixConfig,
110
+ } from '@kano/stem-daw/engine/daw-import-stem-fm-config';
111
+
112
+ // Optional barrel — everything above plus extra primitives:
113
+ import { DAWView, DAWController } from '@kano/stem-daw';
114
+ ```
115
+
116
+ The full machine-readable map lives in [`package.json`](./package.json)
117
+ under `"exports"`.
118
+
119
+ ---
120
+
121
+ ## Worklets — required runtime setup
122
+
123
+ `DAWController` boots four `AudioWorklet`s that the browser fetches by
124
+ URL at start-up:
125
+
126
+ - `/workers/daw-stem-processor.js`
127
+ - `/workers/realtime-pitch-shift-processor.js` (Rubberband)
128
+ - `/workers/phase-vocoder3.js` (mobile fallback)
129
+ - `/workers/buffer-player-processor-202602.lavv8e32-ts.js`
130
+
131
+ The package ships these files in `dist/workers/`. You **must** serve
132
+ them at the matching `/workers/<name>.js` paths or the DAW will fail
133
+ to initialise. Pick **one** of the two strategies below.
134
+
135
+ ### Option A — Vite plugin (recommended)
136
+
137
+ ```ts
138
+ // vite.config.ts
139
+ import { defineConfig } from 'vite';
140
+ import { dawWorklets } from '@kano/stem-daw/vite';
141
+
142
+ export default defineConfig({
143
+ plugins: [dawWorklets()],
144
+ });
145
+ ```
146
+
147
+ What it does:
148
+
149
+ - **Dev (`vite`):** middleware streams the worklet files out of
150
+ `node_modules/@kano/stem-daw/dist/workers/` at `/workers/<name>.js`.
151
+ - **Build (`vite build`):** the same files are emitted into the
152
+ consumer's `dist/workers/` so the production bundle is self-contained.
153
+
154
+ The plugin never overwrites a same-named file already in the
155
+ consumer's `public/workers/` — host app wins, the DAW only fills
156
+ gaps. Pass `{ publicPath: '/custom-workers' }` if you serve them
157
+ under a different URL prefix.
158
+
159
+ ### Option B — Asset URL imports
160
+
161
+ If you'd rather drive the URL yourself (e.g. you bundle the DAW into a
162
+ non-Vite build), each worklet is reachable through the package's
163
+ `./workers/*` subpath export:
164
+
165
+ ```ts
166
+ import dawProcessorUrl from '@kano/stem-daw/workers/daw-stem-processor.js?url';
167
+ import pitchProcessorUrl from '@kano/stem-daw/workers/realtime-pitch-shift-processor.js?url';
168
+ // …
169
+ // Then make sure your bundler emits those URLs at /workers/<name>.js,
170
+ // or override DAWController's worklet-path constants at startup.
171
+ ```
172
+
173
+ `stem-player-rd` currently uses **Option A**.
174
+
175
+ ---
176
+
177
+ ## Local development against a consumer (`yarn link`)
178
+
179
+ Iterating on the DAW UI while running it inside `stem-player-rd`:
180
+
181
+ ```sh
182
+ # in stem-studio (this repo)
183
+ yarn install
184
+ yarn build:lib
185
+ yarn link
186
+
187
+ # in stem-player-rd
188
+ yarn link @kano/stem-daw
189
+ yarn dev
190
+ ```
191
+
192
+ `yarn build:lib` runs `tsup` + the worklet copy step (see
193
+ `scripts/copy-daw-workers.mjs`). Re-run it after any change you want
194
+ to hot-pick up in the linked consumer.
195
+
196
+ You can also point a single consumer at a sibling working copy via
197
+ its own Vite alias instead of linking globally — that's how
198
+ `stem-player-rd`'s `vite.config.ts` already wires the `@studio`
199
+ alias when the submodule is present.
200
+
201
+ ---
202
+
203
+ ## Publish workflow
204
+
205
+ Releases run from [`.github/workflows/publish.yml`](.github/workflows/publish.yml)
206
+ on tag push (`v<major>.<minor>.<patch>`). The workflow:
207
+
208
+ 1. Checks the tag version matches `package.json`'s `version`.
209
+ 2. `yarn install --frozen-lockfile`.
210
+ 3. `yarn build:lib` (tsup + worklet copy).
211
+ 4. Sanity-checks every entry in the `exports` map exists in `dist/`.
212
+ 5. `npm publish --access public --provenance` using `secrets.NPM_TOKEN`.
213
+
214
+ To cut a release:
215
+
216
+ ```sh
217
+ yarn version --new-version 0.2.0 # bumps package.json + creates the tag
218
+ git push --follow-tags
219
+ ```
220
+
221
+ Manual dispatch is also supported via the **Run workflow** button
222
+ (useful for re-publishing the same version after a build infra fix).
223
+
224
+ ---
225
+
226
+ ## Verifying a build before publishing
227
+
228
+ ```sh
229
+ yarn build:lib
230
+ npm pack # produces kano-stem-daw-<version>.tgz
231
+
232
+ # in a fresh vite app:
233
+ yarn add ../path/to/kano-stem-daw-0.1.0.tgz
234
+ yarn add react@^19 react-dom@^19 react-router-dom@^7 zustand@^5
235
+ ```
236
+
237
+ Then mount `<DAWView />`, confirm the worklets resolve from
238
+ `/workers/*`, and that `import('@kano/stem-daw/engine/daw-controller')`
239
+ yields a typed `DAWController` class.
240
+
241
+ ---
242
+
243
+ ## Non-goal
244
+
245
+ This package does **not** absorb the audio engine. `@kano/stem-web-audio-player`
246
+ stays a separate package with its own publish pipeline. Reasons:
247
+
248
+ - The engine is reusable headless (e.g. `stem-player-rd`'s session
249
+ view streams without ever mounting a DAW).
250
+ - The DAW is React UI that depends on a specific stack (Radix, framer,
251
+ etc.) that engine consumers don't want pulled in.
252
+
253
+ Keep them separate.
@@ -0,0 +1,7 @@
1
+ export { executeAllActions, executeDAWAction } from './chunk-AAVC7KUW.js';
2
+ import './chunk-OYNES5W3.js';
3
+ import './chunk-56PWIP7O.js';
4
+ import './chunk-TBXCZFAY.js';
5
+ import './chunk-KCOOE2OP.js';
6
+ //# sourceMappingURL=chat-actions-54Z6URC4.js.map
7
+ //# sourceMappingURL=chat-actions-54Z6URC4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chat-actions-54Z6URC4.js"}