From 6da98a5f318784752b5badffcd0458be9a9073d9 Mon Sep 17 00:00:00 2001 From: Enelg52 Date: Tue, 23 Jan 2024 16:47:46 +0100 Subject: [PATCH 01/27] fix midi issue on firefox and quote error --- packages/midi/midi.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index f40a5049..7d253114 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -167,10 +167,16 @@ let listeners = {}; const refs = {}; export async function midin(input) { + if (isPattern(input)) { + throw new Error( + `.midi does not accept Pattern input. Make sure to pass device name with single quotes. Example: .midi('${ + WebMidi.outputs?.[0]?.name || 'IAC Driver Bus 1' + }')`, + ); + } const initial = await enableWebMidi(); // only returns on first init const device = getDevice(input, WebMidi.inputs); - - if (initial) { + if (initial || WebMidi.enabled) { const otherInputs = WebMidi.inputs.filter((o) => o.name !== device.name); logger( `Midi enabled! Using "${device.name}". ${ From fb7c2b61d3fce9ca7674a5f0214dc92ea7420677 Mon Sep 17 00:00:00 2001 From: Michael Hetrick Date: Fri, 26 Jan 2024 07:13:09 -0800 Subject: [PATCH 02/27] Update first-sounds.mdx Update the tutorial text to reflect that the default cpm setting has changed from 60 to 30. --- website/src/pages/workshop/first-sounds.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/workshop/first-sounds.mdx b/website/src/pages/workshop/first-sounds.mdx index c8f321b8..eece6a3f 100644 --- a/website/src/pages/workshop/first-sounds.mdx +++ b/website/src/pages/workshop/first-sounds.mdx @@ -139,7 +139,7 @@ The content of a sequence will be squished into what's called a cycle. cpm = cycles per minute -By default, the tempo is 60 cycles per minute = 1 cycle per second. +By default, the tempo is 30 cycles per minute = 1 half cycle per second. From d2bf9370eae184bb167f6270561e7069cc9aaa7a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 4 Feb 2024 23:24:43 +0100 Subject: [PATCH 03/27] Update README.md add link to usage example for repl package --- packages/repl/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/repl/README.md b/packages/repl/README.md index ff310948..b4cbf37c 100644 --- a/packages/repl/README.md +++ b/packages/repl/README.md @@ -1,3 +1,5 @@ # @strudel/repl The Strudel REPL as a web component. + +[Usage example](https://github.com/tidalcycles/strudel/blob/main/examples/buildless/web-component-no-iframe.html) From 60129413d3a89877f3457d878519697a4e3ca8a1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 12:19:11 +0100 Subject: [PATCH 04/27] remove cjs builds + add type module everywhere --- packages/codemirror/package.json | 1 - packages/codemirror/vite.config.js | 4 ++-- packages/core/package.json | 1 - packages/core/vite.config.js | 4 ++-- packages/csound/package.json | 2 +- packages/csound/vite.config.js | 4 ++-- packages/hydra/package.json | 2 +- packages/hydra/vite.config.js | 4 ++-- packages/midi/package.json | 2 +- packages/midi/vite.config.js | 4 ++-- packages/mini/package.json | 1 - packages/mini/vite.config.js | 4 ++-- packages/osc/package.json | 2 +- packages/osc/vite.config.js | 4 ++-- packages/repl/package.json | 1 - packages/serial/package.json | 2 +- packages/serial/vite.config.js | 4 ++-- packages/soundfonts/package.json | 1 - packages/soundfonts/vite.config.js | 4 ++-- packages/superdough/vite.config.js | 2 +- packages/tonal/package.json | 1 - packages/tonal/vite.config.js | 4 ++-- packages/transpiler/package.json | 2 +- packages/transpiler/vite.config.js | 4 ++-- packages/web/package.json | 1 - packages/web/vite.config.js | 4 ++-- packages/webaudio/package.json | 1 - packages/webaudio/vite.config.js | 4 ++-- packages/xen/package.json | 2 +- packages/xen/vite.config.js | 4 ++-- 30 files changed, 36 insertions(+), 44 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index c45fa2e2..d310225a 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -4,7 +4,6 @@ "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/codemirror/vite.config.js b/packages/codemirror/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/codemirror/vite.config.js +++ b/packages/codemirror/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/core/package.json b/packages/core/package.json index 158e51bf..79557c51 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,6 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/core/vite.config.js b/packages/core/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/core/vite.config.js +++ b/packages/core/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/csound/package.json b/packages/csound/package.json index 33372886..996cf401 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "csound bindings for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/csound/vite.config.js b/packages/csound/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/csound/vite.config.js +++ b/packages/csound/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 97432f67..7329e88d 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Hydra integration for strudel", "main": "hydra.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/hydra/vite.config.js b/packages/hydra/vite.config.js index 215a9114..0caf1d2f 100644 --- a/packages/hydra/vite.config.js +++ b/packages/hydra/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'hydra.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/midi/package.json b/packages/midi/package.json index aea88d13..ec14e59c 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Midi API for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/midi/vite.config.js b/packages/midi/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/midi/vite.config.js +++ b/packages/midi/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/mini/package.json b/packages/mini/package.json index 080c42d9..781e0a3f 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -5,7 +5,6 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/mini/vite.config.js b/packages/mini/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/mini/vite.config.js +++ b/packages/mini/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/osc/package.json b/packages/osc/package.json index 9e06bd97..1982fd6e 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "OSC messaging for strudel", "main": "osc.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/osc/vite.config.js b/packages/osc/vite.config.js index 23e7bb4e..88e673b3 100644 --- a/packages/osc/vite.config.js +++ b/packages/osc/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'osc.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/repl/package.json b/packages/repl/package.json index 009d33d1..fd6f3354 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -4,7 +4,6 @@ "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/serial/package.json b/packages/serial/package.json index 92741448..b02da3ff 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Webserial API for strudel", "main": "serial.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/serial/vite.config.js b/packages/serial/vite.config.js index 2f5dcc39..9e2c287d 100644 --- a/packages/serial/vite.config.js +++ b/packages/serial/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'serial.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index dee0ca64..08f18f46 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -4,7 +4,6 @@ "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/soundfonts/vite.config.js b/packages/soundfonts/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/soundfonts/vite.config.js +++ b/packages/soundfonts/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/superdough/vite.config.js b/packages/superdough/vite.config.js index dd71cf67..d94e37f4 100644 --- a/packages/superdough/vite.config.js +++ b/packages/superdough/vite.config.js @@ -8,7 +8,7 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], + formats: ['es'], fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.cjs' })[ext], }, rollupOptions: { diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 918f9965..3677e295 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -4,7 +4,6 @@ "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/tonal/vite.config.js b/packages/tonal/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/tonal/vite.config.js +++ b/packages/tonal/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 662565a9..29ebdebc 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/transpiler/vite.config.js b/packages/transpiler/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/transpiler/vite.config.js +++ b/packages/transpiler/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/web/package.json b/packages/web/package.json index 10e50290..9732b526 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -4,7 +4,6 @@ "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/web/vite.config.js b/packages/web/vite.config.js index 02873d65..7fe99498 100644 --- a/packages/web/vite.config.js +++ b/packages/web/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'web.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index b27ea94b..217a197f 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -8,7 +8,6 @@ "example": "examples" }, "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/webaudio/vite.config.js b/packages/webaudio/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/webaudio/vite.config.js +++ b/packages/webaudio/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/xen/package.json b/packages/xen/package.json index 8f328ba7..34053629 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Xenharmonic API for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/xen/vite.config.js b/packages/xen/vite.config.js index c1d1a2ee..5df3edc1 100644 --- a/packages/xen/vite.config.js +++ b/packages/xen/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], From 5dc04d9574da43e6c32fa583a9c159570a8031f9 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 12:36:04 +0100 Subject: [PATCH 05/27] make sure to overwrite main field --- packages/codemirror/package.json | 2 +- packages/core/package.json | 2 +- packages/csound/package.json | 2 +- packages/hydra/package.json | 2 +- packages/midi/package.json | 2 +- packages/mini/package.json | 2 +- packages/osc/package.json | 2 +- packages/repl/package.json | 2 +- packages/serial/package.json | 2 +- packages/soundfonts/package.json | 2 +- packages/superdough/package.json | 2 +- packages/tonal/package.json | 2 +- packages/transpiler/package.json | 2 +- packages/web/package.json | 2 +- packages/webaudio/package.json | 2 +- packages/xen/package.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index d310225a..90360abb 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -4,7 +4,7 @@ "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/core/package.json b/packages/core/package.json index 79557c51..5e0f7eed 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "test": "vitest run", diff --git a/packages/csound/package.json b/packages/csound/package.json index 996cf401..8bd6394b 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 7329e88d..3a863862 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -5,7 +5,7 @@ "main": "hydra.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "server": "node server.js", diff --git a/packages/midi/package.json b/packages/midi/package.json index ec14e59c..fb92b4a3 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/mini/package.json b/packages/mini/package.json index 781e0a3f..21fd9ef2 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "test": "vitest run", diff --git a/packages/osc/package.json b/packages/osc/package.json index 1982fd6e..8567a013 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -5,7 +5,7 @@ "main": "osc.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "server": "node server.js", diff --git a/packages/repl/package.json b/packages/repl/package.json index fd6f3354..086f7851 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -4,7 +4,7 @@ "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/serial/package.json b/packages/serial/package.json index b02da3ff..fba52514 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -5,7 +5,7 @@ "main": "serial.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index 08f18f46..0a7c3797 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -4,7 +4,7 @@ "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/superdough/package.json b/packages/superdough/package.json index deb75784..a2308be8 100644 --- a/packages/superdough/package.json +++ b/packages/superdough/package.json @@ -6,7 +6,7 @@ "type": "module", "publishConfig": { "main": "dist/index.cjs", - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "directories": { "example": "examples" diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 3677e295..756f84cd 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -4,7 +4,7 @@ "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 29ebdebc..0a2d68d9 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/web/package.json b/packages/web/package.json index 9732b526..900398dc 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -4,7 +4,7 @@ "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index 217a197f..0f12e1f5 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -8,7 +8,7 @@ "example": "examples" }, "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "example": "npx parcel examples/repl.html", diff --git a/packages/xen/package.json b/packages/xen/package.json index 34053629..ea3aa55c 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", From 051bdaccc75ba3f14026e3b652d5e3ff97b83aa6 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 13:04:25 +0100 Subject: [PATCH 06/27] Publish - @strudel/codemirror@1.0.1 - @strudel/core@1.0.1 - @strudel/csound@1.0.1 - @strudel/hydra@1.0.1 - @strudel/midi@1.0.1 - @strudel/mini@1.0.1 - @strudel/osc@1.0.1 - @strudel/repl@1.0.1 - @strudel/serial@1.0.1 - @strudel/soundfonts@1.0.1 - superdough@1.0.1 - @strudel/tonal@1.0.1 - @strudel/transpiler@1.0.1 - @strudel/web@1.0.1 - @strudel/webaudio@1.0.1 - @strudel/xen@1.0.1 --- packages/codemirror/package.json | 2 +- packages/core/package.json | 2 +- packages/csound/package.json | 2 +- packages/hydra/package.json | 2 +- packages/midi/package.json | 2 +- packages/mini/package.json | 2 +- packages/osc/package.json | 2 +- packages/repl/package.json | 2 +- packages/serial/package.json | 2 +- packages/soundfonts/package.json | 2 +- packages/superdough/package.json | 3 +-- packages/tonal/package.json | 2 +- packages/transpiler/package.json | 2 +- packages/web/package.json | 2 +- packages/webaudio/package.json | 2 +- packages/xen/package.json | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index 90360abb..22213ac7 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/codemirror", - "version": "1.0.0", + "version": "1.0.1", "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/core/package.json b/packages/core/package.json index 5e0f7eed..7f59ed41 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/core", - "version": "1.0.0", + "version": "1.0.1", "description": "Port of Tidal Cycles to JavaScript", "main": "index.mjs", "type": "module", diff --git a/packages/csound/package.json b/packages/csound/package.json index 8bd6394b..e0811208 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/csound", - "version": "1.0.0", + "version": "1.0.1", "description": "csound bindings for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 3a863862..48189663 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/hydra", - "version": "1.0.0", + "version": "1.0.1", "description": "Hydra integration for strudel", "main": "hydra.mjs", "type": "module", diff --git a/packages/midi/package.json b/packages/midi/package.json index fb92b4a3..4cc2dddb 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/midi", - "version": "1.0.0", + "version": "1.0.1", "description": "Midi API for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/mini/package.json b/packages/mini/package.json index 21fd9ef2..cb4f459c 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/mini", - "version": "1.0.0", + "version": "1.0.1", "description": "Mini notation for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/osc/package.json b/packages/osc/package.json index 8567a013..92725cd4 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/osc", - "version": "1.0.0", + "version": "1.0.1", "description": "OSC messaging for strudel", "main": "osc.mjs", "type": "module", diff --git a/packages/repl/package.json b/packages/repl/package.json index 086f7851..eae203f1 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/repl", - "version": "1.0.0", + "version": "1.0.1", "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { diff --git a/packages/serial/package.json b/packages/serial/package.json index fba52514..9a98a253 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/serial", - "version": "1.0.0", + "version": "1.0.1", "description": "Webserial API for strudel", "main": "serial.mjs", "type": "module", diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index 0a7c3797..db8370c3 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/soundfonts", - "version": "1.0.0", + "version": "1.0.1", "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/superdough/package.json b/packages/superdough/package.json index a2308be8..f1abd95b 100644 --- a/packages/superdough/package.json +++ b/packages/superdough/package.json @@ -1,11 +1,10 @@ { "name": "superdough", - "version": "1.0.0", + "version": "1.0.1", "description": "simple web audio synth and sampler intended for live coding. inspired by superdirt and webdirt.", "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.cjs", "main": "dist/index.mjs" }, "directories": { diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 756f84cd..e4418228 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/tonal", - "version": "1.0.0", + "version": "1.0.1", "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 0a2d68d9..12038fc4 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/transpiler", - "version": "1.0.0", + "version": "1.0.1", "description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.", "main": "index.mjs", "type": "module", diff --git a/packages/web/package.json b/packages/web/package.json index 900398dc..68ced2d2 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/web", - "version": "1.0.0", + "version": "1.0.1", "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index 0f12e1f5..dce53961 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/webaudio", - "version": "1.0.0", + "version": "1.0.1", "description": "Web Audio helpers for Strudel", "main": "index.mjs", "type": "module", diff --git a/packages/xen/package.json b/packages/xen/package.json index ea3aa55c..8ee5d8a3 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/xen", - "version": "1.0.0", + "version": "1.0.1", "description": "Xenharmonic API for strudel", "main": "index.mjs", "type": "module", From c06a3710c148fbb96f283d6a802b5c833d252574 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Mon, 19 Feb 2024 23:43:35 -0500 Subject: [PATCH 07/27] fixed --- packages/desktopbridge/midibridge.mjs | 4 ++-- packages/midi/midi.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/desktopbridge/midibridge.mjs b/packages/desktopbridge/midibridge.mjs index 6959a5bb..ebbb185b 100644 --- a/packages/desktopbridge/midibridge.mjs +++ b/packages/desktopbridge/midibridge.mjs @@ -6,11 +6,11 @@ const OFF_MESSAGE = 0x80; const CC_MESSAGE = 0xb0; Pattern.prototype.midi = function (output) { - return this.onTrigger((time, hap, currentTime) => { + return this.onTrigger((time, hap, currentTime, cps) => { const { note, nrpnn, nrpv, ccn, ccv } = hap.value; const offset = (time - currentTime) * 1000; const velocity = Math.floor((hap.context?.velocity ?? 0.9) * 100); // TODO: refactor velocity - const duration = Math.floor(hap.duration.valueOf() * 1000 - 10); + const duration = Math.floor((hap.duration.valueOf() / cps) * 1000 - 10); const roundedOffset = Math.round(offset); const midichan = (hap.value.midichan ?? 1) - 1; const requestedport = output ?? 'IAC'; diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index f40a5049..96a29c27 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -129,7 +129,7 @@ Pattern.prototype.midi = function (output) { const velocity = hap.context?.velocity ?? 0.9; // TODO: refactor velocity // note off messages will often a few ms arrive late, try to prevent glitching by subtracting from the duration length - const duration = Math.floor(hap.duration.valueOf() * 1000 - 10); + const duration = Math.floor((hap.duration.valueOf() / cps) * 1000 - 10); if (note != null) { const midiNumber = typeof note === 'number' ? note : noteToMidi(note); const midiNote = new Note(midiNumber, { attack: velocity, duration }); From ebdca32c806e89d6d5648462b7c200ae2c9226c5 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 09:48:26 +0100 Subject: [PATCH 08/27] automatically add await to samples call --- packages/transpiler/transpiler.mjs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/transpiler/transpiler.mjs b/packages/transpiler/transpiler.mjs index aedf8f3a..72f2e851 100644 --- a/packages/transpiler/transpiler.mjs +++ b/packages/transpiler/transpiler.mjs @@ -1,8 +1,7 @@ -import escodegen from 'escodegen'; -import { parse } from 'acorn'; -import { walk } from 'estree-walker'; -import { isNoteWithOctave } from '@strudel/core'; import { getLeafLocations } from '@strudel/mini'; +import { parse } from 'acorn'; +import escodegen from 'escodegen'; +import { walk } from 'estree-walker'; export function transpiler(input, options = {}) { const { wrapAsync = false, addReturn = true, emitMiniLocations = true, emitWidgets = true } = options; @@ -47,6 +46,9 @@ export function transpiler(input, options = {}) { }); return this.replace(widgetWithLocation(node)); } + if (isBareSamplesCall(node, parent)) { + return this.replace(withAwait(node)); + } }, leave(node, parent, prop, index) {}, }); @@ -119,3 +121,14 @@ function widgetWithLocation(node) { node.callee.name = 'sliderWithID'; return node; } + +function isBareSamplesCall(node, parent) { + return node.type === 'CallExpression' && node.callee.name === 'samples' && parent.type !== 'AwaitExpression'; +} + +function withAwait(node) { + return { + type: 'AwaitExpression', + argument: node, + }; +} From 38d389b83899046b190f594155fb7c374d4b596f Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 09:50:21 +0100 Subject: [PATCH 09/27] add test --- packages/transpiler/test/transpiler.test.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/transpiler/test/transpiler.test.mjs b/packages/transpiler/test/transpiler.test.mjs index 5f1b754f..988479b4 100644 --- a/packages/transpiler/test/transpiler.test.mjs +++ b/packages/transpiler/test/transpiler.test.mjs @@ -23,6 +23,9 @@ describe('transpiler', () => { it('supports top level await', () => { expect(transpiler("await samples('xxx');", simple).output).toEqual("await samples('xxx');"); }); + it('adds await to bare samples call', () => { + expect(transpiler("samples('xxx');", simple).output).toEqual("await samples('xxx');"); + }); /* it('parses dynamic imports', () => { expect( transpiler("const { default: foo } = await import('https://bar.com/foo.js');", { From bf63b716af91cf512f3de83758a3b8463f346a0d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 10:17:45 +0100 Subject: [PATCH 10/27] refactor: remove await before samples calls in docs etc.. + remove /master from dirt-samples calls (there is now a main branch) + remove /main endings from some places --- examples/buildless/headless-with-samples.html | 2 +- examples/buildless/minimal-repl.html | 2 +- examples/codemirror-repl/tunes.mjs | 12 +++++------ examples/headless-repl/index.html | 2 +- examples/minimal-repl/tune.mjs | 2 +- examples/superdough/index.html | 2 +- packages/core/controls.mjs | 2 +- packages/core/pattern.mjs | 6 +++--- packages/superdough/README.md | 4 ++-- packages/superdough/sampler.mjs | 2 +- packages/web/README.md | 2 +- .../blog/release-0.8.0-himbeermuffin.mdx | 2 +- website/src/examples.mjs | 4 ++-- website/src/pages/learn/getting-started.mdx | 2 +- website/src/pages/learn/samples.mdx | 20 +++++++++---------- website/src/pages/recipes/recipes.mdx | 20 +++++++++---------- website/src/pages/recipes/rhythms.mdx | 2 +- website/src/repl/prebake.mjs | 3 +-- website/src/repl/tunes.mjs | 10 +++++----- 19 files changed, 50 insertions(+), 51 deletions(-) diff --git a/examples/buildless/headless-with-samples.html b/examples/buildless/headless-with-samples.html index 40073d70..2ac7aa71 100644 --- a/examples/buildless/headless-with-samples.html +++ b/examples/buildless/headless-with-samples.html @@ -6,7 +6,7 @@ + + From 2854f0cf347e38413989e420bf803bffe3a67e7b Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:28:43 +0100 Subject: [PATCH 17/27] try different main / module setting + bump --- packages/web/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/web/package.json b/packages/web/package.json index 3ce40736..45946398 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,10 +1,11 @@ { "name": "@strudel/web", - "version": "1.0.2", + "version": "1.0.3", "description": "Easy to setup, opiniated bundle of Strudel for the browser.", - "main": "web.mjs", + "module": "web.mjs", "publishConfig": { - "main": "dist/index.mjs" + "main": "dist/index.js", + "module": "dist/index.mjs" }, "scripts": { "build": "vite build", From c23d7850c79a426a5cd6a78f06cbb465480de00a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:30:07 +0100 Subject: [PATCH 18/27] simplify web example --- examples/buildless/web.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/buildless/web.html b/examples/buildless/web.html index 785a6071..dc2a4c33 100644 --- a/examples/buildless/web.html +++ b/examples/buildless/web.html @@ -1,9 +1,8 @@ - + From 6d9327aebc2eec1be619f56112d6d5d0475769b1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:30:29 +0100 Subject: [PATCH 19/27] adapt repl package similar to web package --- packages/repl/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/repl/package.json b/packages/repl/package.json index eae203f1..e6bce6d5 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -1,10 +1,11 @@ { "name": "@strudel/repl", - "version": "1.0.1", + "version": "1.0.2", "description": "Strudel REPL as a Web Component", - "main": "index.mjs", + "module": "index.mjs", "publishConfig": { - "main": "dist/index.mjs" + "main": "dist/index.js", + "module": "dist/index.mjs" }, "scripts": { "build": "vite build", From 058e554b0f78a464059e6ddf515c22071014b7d6 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:33:07 +0100 Subject: [PATCH 20/27] update example --- examples/buildless/web-component-no-iframe.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/buildless/web-component-no-iframe.html b/examples/buildless/web-component-no-iframe.html index 6c86d282..8afa85cb 100644 --- a/examples/buildless/web-component-no-iframe.html +++ b/examples/buildless/web-component-no-iframe.html @@ -1,4 +1,4 @@ - +