diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b26f4cb4..7813cf60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [16, 17] + node-version: [18] steps: - uses: actions/checkout@v2 diff --git a/package-lock.json b/package-lock.json index d7a08feb..6a0ee9c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3314,9 +3314,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001341", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", - "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", + "version": "1.0.30001430", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001430.tgz", + "integrity": "sha512-IB1BXTZKPDVPM7cnV4iaKaHxckvdr/3xtctB3f7Hmenx3qYBhGtTZ//7EllK66aKXW98Lx0+7Yr0kxBtIt3tzg==", "funding": [ { "type": "opencollective", @@ -15537,9 +15537,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001341", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", - "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==" + "version": "1.0.30001430", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001430.tgz", + "integrity": "sha512-IB1BXTZKPDVPM7cnV4iaKaHxckvdr/3xtctB3f7Hmenx3qYBhGtTZ//7EllK66aKXW98Lx0+7Yr0kxBtIt3tzg==" }, "caseless": { "version": "0.12.0", diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index ca9bec08..fec6c39a 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -97,7 +97,7 @@ const generic_params = [ ], /** - * Select the sound bank to use. To be used together with `s`. The bank name (+ "_") will be prepended to the value of `s`. + * Select the sound bank to use. To be used together with `s`. The bank name (+ "_") will be prepended to the value of `s`. * * @name bank * @param {string | Pattern} bank the name of the bank @@ -105,11 +105,7 @@ const generic_params = [ * s("bd sd").bank('RolandTR909') // = s("RolandTR909_bd RolandTR909_sd") * */ - [ - 'f', - 'bank', - 'selects sound bank to use', - ], + ['f', 'bank', 'selects sound bank to use'], // TODO: find out how this works? /* diff --git a/packages/core/index.mjs b/packages/core/index.mjs index 49b7de19..bb45275b 100644 --- a/packages/core/index.mjs +++ b/packages/core/index.mjs @@ -4,10 +4,10 @@ Copyright (C) 2022 Strudel contributors - see . */ -export * from './controls.mjs'; +import controls from './controls.mjs'; export * from './euclid.mjs'; import Fraction from './fraction.mjs'; -export { Fraction }; +export { Fraction, controls }; export * from './hap.mjs'; export * from './pattern.mjs'; export * from './signal.mjs'; diff --git a/packages/embed/README.md b/packages/embed/README.md index b0ccf52b..f293c931 100644 --- a/packages/embed/README.md +++ b/packages/embed/README.md @@ -10,15 +10,22 @@ Either install with `npm i @strudel.cycles/embed` or just use a cdn to import th ``` diff --git a/packages/embed/example.html b/packages/embed/example.html index 9e6fca15..4470210b 100644 --- a/packages/embed/example.html +++ b/packages/embed/example.html @@ -2,14 +2,21 @@ diff --git a/packages/mini/README.md b/packages/mini/README.md index f5e6f4b5..755ba5df 100644 --- a/packages/mini/README.md +++ b/packages/mini/README.md @@ -33,3 +33,12 @@ yields: ## Mini Notation API See "Mini Notation" in the [Strudel Tutorial](https://strudel.tidalcycles.org/tutorial/) + +## Building the Parser + +The parser [krill-parser.js] is generated from [krill.pegjs](./krill.pegjs) using [peggy](https://peggyjs.org/). +To generate the parser, run + +```js +npm run build:parser +``` diff --git a/packages/mini/mini.mjs b/packages/mini/mini.mjs index 416203e2..82ed4b86 100644 --- a/packages/mini/mini.mjs +++ b/packages/mini/mini.mjs @@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th import * as krill from './krill-parser.js'; import * as strudel from '@strudel.cycles/core'; -import { addMiniLocations } from '@strudel.cycles/eval/shapeshifter.mjs'; +// import { addMiniLocations } from '@strudel.cycles/eval/shapeshifter.mjs'; const { pure, Pattern, Fraction, stack, slowcat, sequence, timeCat, silence, reify } = strudel; @@ -29,7 +29,10 @@ const applyOptions = (parent) => (pat, i) => { case 'bjorklund': return pat.euclid(operator.arguments_.pulse, operator.arguments_.step, operator.arguments_.rotation); case 'degradeBy': - return reify(pat)._degradeByWith(strudel.rand.early(randOffset * _nextSeed()).segment(1), operator.arguments_.amount); + return reify(pat)._degradeByWith( + strudel.rand.early(randOffset * _nextSeed()).segment(1), + operator.arguments_.amount, + ); // TODO: case 'fixed-step': "%" } console.warn(`operator "${operator.type_}" not implemented`); @@ -112,9 +115,9 @@ export function patternifyAST(ast) { return silence; } if (typeof ast.source_ !== 'object') { - if (!addMiniLocations) { + /* if (!addMiniLocations) { return ast.source_; - } + } */ if (!ast.location_) { console.warn('no location for', ast); return ast.source_; diff --git a/packages/osc/README.md b/packages/osc/README.md index cb48090d..61a125b5 100644 --- a/packages/osc/README.md +++ b/packages/osc/README.md @@ -35,3 +35,5 @@ s(" hh").osc() ``` or just [click here](http://localhost:3000/#cygiPGJkIHNkPiBoaCIpLm9zYygp)... + +You can read more about [how to use Superdirt with Strudel the Tutorial](https://strudel.tidalcycles.org/tutorial/#superdirt-api) diff --git a/packages/react/README.md b/packages/react/README.md index 4fc64a8e..ce2e5247 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -1,4 +1,44 @@ # @strudel.cycles/react -This package contains react hooks and components for strudel. -Example coming soon +This package contains react hooks and components for strudel. It is used internally by the Strudel REPL. + +## Install + +```js +npm i @strudel.cycles/react +``` + +## Usage + +Here is a minimal example of how to set up a MiniRepl: + +```jsx +import { evalScope } from '@strudel.cycles/eval'; +import { MiniRepl } from '@strudel.cycles/react'; +import controls from '@strudel.cycles/core/controls.mjs'; +import { prebake } from '../repl/src/prebake.mjs'; + +evalScope( + controls, + import('@strudel.cycles/core'), + import('@strudel.cycles/tonal'), + import('@strudel.cycles/mini'), + import('@strudel.cycles/webaudio'), + /* probably import other strudel packages */ +); + +prebake(); + +export function Repl({ tune }) { + return ; +} +``` + +## Development + +If you change something in here and want to see the changes in the repl, make sure to run `npm run build` inside this folder! + +```js +npm run dev # dev server +npm run build # build package +``` diff --git a/packages/react/src/App.jsx b/packages/react/src/App.jsx index 61e81f2d..7cec6382 100644 --- a/packages/react/src/App.jsx +++ b/packages/react/src/App.jsx @@ -16,7 +16,7 @@ evalScope( function App() { return (
- +
); } diff --git a/repl/src/App.jsx b/repl/src/App.jsx index a89c7a8f..54510857 100644 --- a/repl/src/App.jsx +++ b/repl/src/App.jsx @@ -4,7 +4,6 @@ Copyright (C) 2022 Strudel contributors - see . */ -import controls from '@strudel.cycles/core/controls.mjs'; import { evalScope, evaluate } from '@strudel.cycles/eval'; import { CodeMirror, cx, flash, useHighlighting, useRepl, useWebMidi } from '@strudel.cycles/react'; import { cleanupDraw, cleanupUi, Tone } from '@strudel.cycles/tone'; @@ -15,6 +14,7 @@ import * as tunes from './tunes.mjs'; import { prebake } from './prebake.mjs'; import * as WebDirt from 'WebDirt'; import { resetLoadedSamples, getAudioContext } from '@strudel.cycles/webaudio'; +import { controls } from '@strudel.cycles/core'; import { createClient } from '@supabase/supabase-js'; import { nanoid } from 'nanoid'; @@ -26,7 +26,7 @@ const supabase = createClient( evalScope( Tone, - controls, + controls, // sadly, this cannot be exported from core direclty { WebDirt }, import('@strudel.cycles/core'), import('@strudel.cycles/tone'),