From 4264f013af55443ae5b9d870d988002b501d85cb Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 27 Oct 2022 20:51:14 +0200 Subject: [PATCH] remove webdirt + tone from tutorial + do not load webdirt in repl --- repl/src/App.jsx | 7 -- tutorial/MiniRepl.jsx | 7 -- tutorial/old.mdx | 152 ++++++++++++++++++++++++++++++++++++++++++ tutorial/tutorial.mdx | 151 ----------------------------------------- 4 files changed, 152 insertions(+), 165 deletions(-) create mode 100644 tutorial/old.mdx diff --git a/repl/src/App.jsx b/repl/src/App.jsx index ae55fc78..7f308771 100644 --- a/repl/src/App.jsx +++ b/repl/src/App.jsx @@ -14,7 +14,6 @@ import logo from './logo.svg'; import * as tunes from './tunes.mjs'; import { prebake } from './prebake.mjs'; import * as WebDirt from 'WebDirt'; -import { loadWebDirt } from '@strudel.cycles/webdirt'; import { resetLoadedSamples, getAudioContext } from '@strudel.cycles/webaudio'; import { createClient } from '@supabase/supabase-js'; import { nanoid } from 'nanoid'; @@ -37,16 +36,10 @@ evalScope( import('@strudel.cycles/xen'), import('@strudel.cycles/webaudio'), import('@strudel.cycles/osc'), - import('@strudel.cycles/webdirt'), import('@strudel.cycles/serial'), import('@strudel.cycles/soundfonts'), ); -loadWebDirt({ - sampleMapUrl: 'EmuSP12.json', - sampleFolder: 'EmuSP12', -}); - prebake(); async function initCode() { diff --git a/tutorial/MiniRepl.jsx b/tutorial/MiniRepl.jsx index e46e35bc..295e2b99 100644 --- a/tutorial/MiniRepl.jsx +++ b/tutorial/MiniRepl.jsx @@ -2,7 +2,6 @@ import { Tone } from '@strudel.cycles/tone'; import { evalScope } from '@strudel.cycles/eval'; import { MiniRepl as _MiniRepl } from '@strudel.cycles/react'; import controls from '@strudel.cycles/core/controls.mjs'; -import { loadWebDirt } from '@strudel.cycles/webdirt'; import { samples } from '@strudel.cycles/webaudio'; export const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.Destination).set({ @@ -28,14 +27,8 @@ evalScope( import('@strudel.cycles/xen'), import('@strudel.cycles/webaudio'), import('@strudel.cycles/osc'), - import('@strudel.cycles/webdirt'), ); -loadWebDirt({ - sampleMapUrl: '../EmuSP12.json', - sampleFolder: '../EmuSP12', -}); - export function MiniRepl({ tune }) { return <_MiniRepl tune={tune} defaultSynth={defaultSynth} hideOutsideView={true} />; } diff --git a/tutorial/old.mdx b/tutorial/old.mdx new file mode 100644 index 00000000..c11e8e58 --- /dev/null +++ b/tutorial/old.mdx @@ -0,0 +1,152 @@ +# Old APIs + +These APIs are outdated and might break in the future. + +## Webdirt API (deprecated) + +You can use the powerful sampling engine [Webdirt](https://github.com/dktr0/WebDirt) with Strudel. + +{{ 'Pattern.webdirt' | jsdoc }} + +
+
+ +## Tone API (deprecated) + +The Tone API uses Tone.js instruments ands effects to create sounds. + + + +### tone(instrument) + +To change the instrument of a pattern, you can pass any [Tone.js Source](https://tonejs.github.io/docs/14.7.77/index.html) to .tone: + + + +While this works, it is a little bit verbose. To simplify things, all Tone Synths have a shortcut: + +```js +const amsynth = (options) => new AMSynth(options); +const duosynth = (options) => new DuoSynth(options); +const fmsynth = (options) => new FMSynth(options); +const membrane = (options) => new MembraneSynth(options); +const metal = (options) => new MetalSynth(options); +const monosynth = (options) => new MonoSynth(options); +const noise = (options) => new NoiseSynth(options); +const pluck = (options) => new PluckSynth(options); +const polysynth = (options) => new PolySynth(options); +const synth = (options) => new Synth(options); +const sampler = (options, baseUrl?) => new Sampler(options); // promisified, see below +const players = (options, baseUrl?) => new Sampler(options); // promisified, see below +``` + +### sampler + +With sampler, you can create tonal instruments from samples: + + + saw.struct("x*8").mul(16).round() + .legato(4).scale('D dorian').slow(2) + .tone(kalimba.toDestination()) +)`} +/> + +The sampler function promisifies [Tone.js Sampler](https://tonejs.github.io/docs/14.7.77/Sampler). + +Note that this function currently only works with this promise notation, but in the future, +it will be possible to use async instruments in a synchronous fashion. + +### players + +With players, you can create sound banks: + + + "bd hh sn hh".tone(drums.toDestination()) +) + `} +/> + +The sampler function promisifies [Tone.js Players](https://tonejs.github.io/docs/14.7.77/Players). + +Note that this function currently only works with this promise notation, but in the future, +it will be possible to use async instruments in a synchronous fashion. + +### out + +Shortcut for Tone.Destination. Intended to be used with Tone's .chain: + + + +This alone is not really useful, so read on.. + +### vol(volume) + +Helper that returns a Gain Node with the given volume. Intended to be used with Tone's .chain: + + + +### osc(type) + +Helper to set the waveform of a synth, monosynth or polysynth: + + + +The base types are `sine`, `square`, `sawtooth`, `triangle`. You can also append a number between 1 and 32 to reduce the harmonic partials. + +### lowpass(cutoff) + +Helper that returns a Filter Node of type lowpass with the given cutoff. Intended to be used with Tone's .chain: + + + +### highpass(cutoff) + +Helper that returns a Filter Node of type highpass with the given cutoff. Intended to be used with Tone's .chain: + + + +### adsr + +Helper to set the envelope of a Tone.js instrument. Intended to be used with Tone's .set: + + diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 45d82009..87432132 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -47,8 +47,6 @@ s("bd,[~ ],hh(3,4)") // drums .slow(3/2)`} /> -[Open this track in the REPL](https://strudel.tidalcycles.org/#KCkgPT4gewogIGNvbnN0IGRlbGF5ID0gbmV3IEZlZWRiYWNrRGVsYXkoMS84LCAuNCkuY2hhaW4odm9sKDAuNSksIG91dCk7CiAgY29uc3Qga2ljayA9IG5ldyBNZW1icmFuZVN5bnRoKCkuY2hhaW4odm9sKC44KSwgb3V0KTsKICBjb25zdCBzbmFyZSA9IG5ldyBOb2lzZVN5bnRoKCkuY2hhaW4odm9sKC44KSwgb3V0KTsKICBjb25zdCBoaWhhdCA9IG5ldyBNZXRhbFN5bnRoKCkuc2V0KGFkc3IoMCwgLjA4LCAwLCAuMSkpLmNoYWluKHZvbCguMykuY29ubmVjdChkZWxheSksb3V0KTsKICBjb25zdCBiYXNzID0gbmV3IFN5bnRoKCkuc2V0KHsgLi4ub3NjKCdzYXd0b290aCcpLCAuLi5hZHNyKDAsIC4xLCAuN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5lZGl0KHRocnUpLnRvbmUoYmFzcyksCiAgICAnPENtNyBCYjcgRm03IEc3YjEzPi8yJy5tLmdyb292ZSgnfiBbeEAwLjEgfl0nLm0uZmFzdCgyKSkudm9pY2luZ3MoKS5lZGl0KHRocnUpLmV2ZXJ5KDIsIGVhcmx5KDEvOCkpLnRvbmUoa2V5cykuYnlwYXNzKCc8MEA3IDE%2BLzgnLm0uZWFybHkoMS80KSkKICApCiAgcmV0dXJuIHN0YWNrKAogICAgZHJ1bXMuZmFzdCgyKSwgCiAgICBzeW50aHMKICApLnNsb3coMik7Cn0%3D) - ## Disclaimer - This project is still in its experimental state. In the future, parts of it might change significantly. @@ -722,152 +720,3 @@ The following functions can be used with superdirt: `s n note freq channel orbit cutoff resonance hcutoff hresonance bandf bandq djf vowel cut begin end loop fadeTime speed unitA gain amp accelerate crush coarse delay lock leslie lrate lsize pan panspan pansplay room size dry shape squiz waveloss attack decay octave detune tremolodepth` Please refer to [Tidal Docs](https://tidalcycles.org/) for more info. - -# Webdirt API (deprecated) - -You can use the powerful sampling engine [Webdirt](https://github.com/dktr0/WebDirt) with Strudel. - -{{ 'Pattern.webdirt' | jsdoc }} - -
-
- -# Tone API (deprecated) - -The Tone API uses Tone.js instruments ands effects to create sounds. - - - -### tone(instrument) - -To change the instrument of a pattern, you can pass any [Tone.js Source](https://tonejs.github.io/docs/14.7.77/index.html) to .tone: - - - -While this works, it is a little bit verbose. To simplify things, all Tone Synths have a shortcut: - -```js -const amsynth = (options) => new AMSynth(options); -const duosynth = (options) => new DuoSynth(options); -const fmsynth = (options) => new FMSynth(options); -const membrane = (options) => new MembraneSynth(options); -const metal = (options) => new MetalSynth(options); -const monosynth = (options) => new MonoSynth(options); -const noise = (options) => new NoiseSynth(options); -const pluck = (options) => new PluckSynth(options); -const polysynth = (options) => new PolySynth(options); -const synth = (options) => new Synth(options); -const sampler = (options, baseUrl?) => new Sampler(options); // promisified, see below -const players = (options, baseUrl?) => new Sampler(options); // promisified, see below -``` - -### sampler - -With sampler, you can create tonal instruments from samples: - - - saw.struct("x*8").mul(16).round() - .legato(4).scale('D dorian').slow(2) - .tone(kalimba.toDestination()) -)`} -/> - -The sampler function promisifies [Tone.js Sampler](https://tonejs.github.io/docs/14.7.77/Sampler). - -Note that this function currently only works with this promise notation, but in the future, -it will be possible to use async instruments in a synchronous fashion. - -### players - -With players, you can create sound banks: - - - "bd hh sn hh".tone(drums.toDestination()) -) - `} -/> - -The sampler function promisifies [Tone.js Players](https://tonejs.github.io/docs/14.7.77/Players). - -Note that this function currently only works with this promise notation, but in the future, -it will be possible to use async instruments in a synchronous fashion. - -### out - -Shortcut for Tone.Destination. Intended to be used with Tone's .chain: - - - -This alone is not really useful, so read on.. - -### vol(volume) - -Helper that returns a Gain Node with the given volume. Intended to be used with Tone's .chain: - - - -### osc(type) - -Helper to set the waveform of a synth, monosynth or polysynth: - - - -The base types are `sine`, `square`, `sawtooth`, `triangle`. You can also append a number between 1 and 32 to reduce the harmonic partials. - -### lowpass(cutoff) - -Helper that returns a Filter Node of type lowpass with the given cutoff. Intended to be used with Tone's .chain: - - - -### highpass(cutoff) - -Helper that returns a Filter Node of type highpass with the given cutoff. Intended to be used with Tone's .chain: - - - -### adsr - -Helper to set the envelope of a Tone.js instrument. Intended to be used with Tone's .set: - -