From 54a61dcdaefb2dfeaa1241011baefc2fc17e1fbb Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 1 Feb 2023 16:29:18 +0100 Subject: [PATCH] overhaul the remaining readmes --- packages/core/examples/vanilla.html | 5 +--- packages/react/README.md | 9 +----- .../react/examples/nano-repl/package.json | 4 +-- packages/serial/README.md | 1 - packages/tone/README.md | 9 +++--- packages/transpiler/README.md | 2 -- packages/webaudio/README.md | 30 +++++++++++-------- packages/webdirt/README.md | 8 ++--- packages/xen/README.md | 2 +- 9 files changed, 29 insertions(+), 41 deletions(-) diff --git a/packages/core/examples/vanilla.html b/packages/core/examples/vanilla.html index 233f76f7..b1baf4f7 100644 --- a/packages/core/examples/vanilla.html +++ b/packages/core/examples/vanilla.html @@ -43,10 +43,7 @@ getTime: () => ctx.currentTime, transpiler, }); - document.getElementById('start').addEventListener('click', () => { - ctx.resume(); - evaluate(input.value); - }); + document.getElementById('start').addEventListener('click', () => evaluate(input.value)); function getTune() { return `await samples('github:tidalcycles/Dirt-Samples/master') diff --git a/packages/react/README.md b/packages/react/README.md index a03dbf4d..cd2f50f0 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -33,11 +33,4 @@ export function Repl({ tune }) { } ``` -## 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 -``` +For a more sophisticated example, check out the [nano-repl](./examples/nano-repl/)! diff --git a/packages/react/examples/nano-repl/package.json b/packages/react/examples/nano-repl/package.json index a6164827..7154815b 100644 --- a/packages/react/examples/nano-repl/package.json +++ b/packages/react/examples/nano-repl/package.json @@ -1,7 +1,7 @@ { - "name": "nano-repl", + "name": "@strudel.cycles/nano-repl", "private": true, - "version": "0.0.0", + "version": "0.6.0", "type": "module", "scripts": { "dev": "vite", diff --git a/packages/serial/README.md b/packages/serial/README.md index 5adb2282..5246c2f8 100644 --- a/packages/serial/README.md +++ b/packages/serial/README.md @@ -1,4 +1,3 @@ # @strudel.cycles/serial This package adds webserial functionality to strudel Patterns, for e.g. sending messages to arduino microcontrollers. - diff --git a/packages/tone/README.md b/packages/tone/README.md index 9df4f7c7..90e4385f 100644 --- a/packages/tone/README.md +++ b/packages/tone/README.md @@ -1,9 +1,11 @@ # @strudel.cycles/tone -Note: This package still works but is no longer maintained in favor of `@strudel.cycles/webaudio`. - This package adds Tone.js functions to strudel Patterns. +## Deprecation Note + +This package will not be developed further. Consider using `@strudel.cycles/webaudio` as a replacement. + ## Install ```sh @@ -30,6 +32,3 @@ document.getElementById('play').addEventListener('click', async () => { Tone.getTransport().start('+0.1'); }); ``` - -[open in codesandbox](https://codesandbox.io/s/strudel-tone-example-5ph2te?file=/src/index.js:0-708) - diff --git a/packages/transpiler/README.md b/packages/transpiler/README.md index 3a0f5549..1b0ed365 100644 --- a/packages/transpiler/README.md +++ b/packages/transpiler/README.md @@ -6,8 +6,6 @@ This package contains a JS code transpiler with the following features: - converts pseudo note variables to note strings - adds return statement to the last expression -The transpiler is written with [acorn](https://github.com/acornjs/acorn) and aims to replace the `@strudel.cycles/eval` package, which uses [shift-ast](https://www.npmjs.com/package/shift-ast). - ## Install ```sh diff --git a/packages/webaudio/README.md b/packages/webaudio/README.md index e91086cd..4f2f8865 100644 --- a/packages/webaudio/README.md +++ b/packages/webaudio/README.md @@ -1,7 +1,6 @@ # @strudel.cycles/webaudio -This package contains a scheduler + a clockworker and synths based on the Web Audio API. -It's an alternative to `@strudel.cycles/tone`, with better performance, but less features. +This package contains helpers to make music with strudel and the Web Audio API. ## Install @@ -12,18 +11,25 @@ npm i @strudel.cycles/webaudio --save ## Example ```js -import { Scheduler, getAudioContext } from '@strudel.cycles/webaudio'; +import { repl, controls } from "@strudel.cycles/core"; +import { initAudioOnFirstClick, getAudioContext, webaudioOutput } from "@strudel.cycles/webaudio"; +const { note } = controls; -const scheduler = new Scheduler({ - audioContext: getAudioContext(), - interval: 0.1, - onEvent: (e) => e.context?.createAudioNode?.(e), +initAudioOnFirstClick(); +const ctx = getAudioContext(); + +const { scheduler } = repl({ + defaultOutput: webaudioOutput, + getTime: () => ctx.currentTime }); -const pattern = sequence([55, 99], 110).osc('sawtooth'); + +const pattern = note("c3", ["eb3", "g3"]).s("sawtooth"); + scheduler.setPattern(pattern); -scheduler.start(); -//scheduler.stop() +document.getElementById("start").addEventListener("click", () => scheduler.start()); +document.getElementById("stop").addEventListener("click", () => scheduler.stop()); ``` -A more sophisticated example can be found in [examples/repl.html](./examples/repl.html). -You can run it by opening the html file with your browser, or by clicking [this link](https://raw.githack.com/tidalcycles/strudel/main/packages/webaudio/examples/repl.html) +[Play with the example codesandbox](https://codesandbox.io/s/amazing-dawn-gclfwg?file=/src/index.js). + +Read more in the docs about [samples](https://strudel.tidalcycles.org/learn/samples/), [synths](https://strudel.tidalcycles.org/learn/synths/) and [effects](https://strudel.tidalcycles.org/learn/effects/). diff --git a/packages/webdirt/README.md b/packages/webdirt/README.md index 26faed99..1cfc8396 100644 --- a/packages/webdirt/README.md +++ b/packages/webdirt/README.md @@ -2,10 +2,6 @@ This package adds [webdirt](https://github.com/dktr0/WebDirt) support to strudel! -## Dev Notes +## Deprecation Note -Add default samples to repl: - -1. move samples to `repl/public` folder. the samples folder is expected to have subfolders, with samples in it. the subfolders will be the names of the samples. -2. run `./makeSampleMap.sh ../../repl/public/EmuSP12 > ../../repl/public/EmuSP12.json` -3. adapt `loadWebDirt` in App.jsx + MiniRepl.jsx to use the generated json file +This package will not be developed further. Consider using `@strudel.cycles/webaudio` as a replacement. diff --git a/packages/xen/README.md b/packages/xen/README.md index 3710be4a..aed60e4d 100644 --- a/packages/xen/README.md +++ b/packages/xen/README.md @@ -1,6 +1,6 @@ # @strudel.cycles/xen -This package adds xenharmonic / microtonal functions to strudel Patterns. +This package adds xenharmonic / microtonal functions to strudel Patterns. Further documentation + examples will follow. ## Install