From b6e277f1ea76eaea8ccfa67d73776eb4e92a2e65 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 2 Jun 2024 14:03:05 +0200 Subject: [PATCH] use inline scope in examples --- packages/core/controls.mjs | 16 ++++++++++------ test/runtime.mjs | 4 ++++ website/src/pages/learn/synths.mdx | 23 ++++++++++++----------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 2e8d40f7..82f94394 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -191,7 +191,7 @@ export const { attack, att } = registerControl('attack', 'att'); * note("c e g b g e") * .fm(4) * .fmh("<1 2 1.5 1.61>") - * .scope() + * ._scope() * */ export const { fmh } = registerControl(['fmh', 'fmi'], 'fmh'); @@ -205,7 +205,7 @@ export const { fmh } = registerControl(['fmh', 'fmi'], 'fmh'); * @example * note("c e g b g e") * .fm("<0 1 2 8 32>") - * .scope() + * ._scope() * */ export const { fmi, fm } = registerControl(['fmi', 'fmh'], 'fm'); @@ -221,7 +221,7 @@ export const { fmi, fm } = registerControl(['fmi', 'fmh'], 'fm'); * .fmdecay(.2) * .fmsustain(0) * .fmenv("") - * .scope() + * ._scope() * */ export const { fmenv } = registerControl('fmenv'); @@ -234,7 +234,7 @@ export const { fmenv } = registerControl('fmenv'); * note("c e g b g e") * .fm(4) * .fmattack("<0 .05 .1 .2>") - * .scope() + * ._scope() * */ export const { fmattack } = registerControl('fmattack'); @@ -248,7 +248,7 @@ export const { fmattack } = registerControl('fmattack'); * .fm(4) * .fmdecay("<.01 .05 .1 .2>") * .fmsustain(.4) - * .scope() + * ._scope() * */ export const { fmdecay } = registerControl('fmdecay'); @@ -262,7 +262,7 @@ export const { fmdecay } = registerControl('fmdecay'); * .fm(4) * .fmdecay(.1) * .fmsustain("<1 .75 .5 0>") - * .scope() + * ._scope() * */ export const { fmsustain } = registerControl('fmsustain'); @@ -800,10 +800,12 @@ export const { fanchor } = registerControl('fanchor'); * @example * note("a e") * .vib("<.5 1 2 4 8 16>") + * ._scope() * @example * // change the modulation depth with ":" * note("a e") * .vib("<.5 1 2 4 8 16>:12") + * ._scope() */ export const { vib, vibrato, v } = registerControl(['vib', 'vibmod'], 'vibrato', 'v'); /** @@ -824,10 +826,12 @@ export const { noise } = registerControl('noise'); * @example * note("a e").vib(4) * .vibmod("<.25 .5 1 2 12>") + * ._scope() * @example * // change the vibrato frequency with ":" * note("a e") * .vibmod("<.25 .5 1 2 12>:8") + * ._scope() */ export const { vibmod, vmod } = registerControl(['vibmod', 'vib'], 'vmod'); export const { hcutoff, hpf, hp } = registerControl(['hcutoff', 'hresonance', 'hpenv'], 'hpf', 'hp'); diff --git a/test/runtime.mjs b/test/runtime.mjs index f14e18e2..7b9350eb 100644 --- a/test/runtime.mjs +++ b/test/runtime.mjs @@ -122,6 +122,10 @@ strudel.Pattern.prototype.midi = function () { return this; }; +strudel.Pattern.prototype._scope = function () { + return this; +}; + const uiHelpersMocked = { backgroundImage: id, }; diff --git a/website/src/pages/learn/synths.mdx b/website/src/pages/learn/synths.mdx index 36385d54..21a9b917 100644 --- a/website/src/pages/learn/synths.mdx +++ b/website/src/pages/learn/synths.mdx @@ -18,7 +18,7 @@ The basic waveforms are `sine`, `sawtooth`, `square` and `triangle`, which can b client:idle tune={`note("c2 >".fast(2)) .sound("") -.scope()`} +._scope()`} /> If you don't set a `sound` but a `note` the default value for `sound` is `triangle`! @@ -28,23 +28,23 @@ If you don't set a `sound` but a `note` the default value for `sound` is `triang You can also use noise as a source by setting the waveform to: `white`, `pink` or `brown`. These are different flavours of noise, here written from hard to soft. -").scope()`} /> +")._scope()`} /> Here's a more musical example of how to use noise for hihats: *8") -.decay(.04).sustain(0).scope()`} +.decay(.04).sustain(0)._scope()`} /> Some amount of pink noise can also be added to any oscillator by using the `noise` paremeter: -").scope()`} /> +")._scope()`} /> You can also use the `crackle` type to play some subtle noise crackles. You can control noise amount by using the `density` parameter: -".slow(2)).scope()`} /> +".slow(2))._scope()`} /> ### Additive Synthesis @@ -55,7 +55,7 @@ To tame the harsh sound of the basic waveforms, we can set the `n` control to li tune={`note("c2 >".fast(2)) .sound("sawtooth") .n("<32 16 8 4>") -.scope()`} +._scope()`} /> When the `n` control is used on a basic waveform, it defines the number of harmonic partials the sound is getting. @@ -65,7 +65,7 @@ You can also set `n` directly in mini notation with `sound`: client:idle tune={`note("c2 >".fast(2)) .sound("sawtooth:<32 16 8 4>") -.scope()`} +._scope()`} /> Note for tidal users: `n` in tidal is synonymous to `note` for synths only. @@ -119,13 +119,14 @@ Any sample preceded by the `wt_` prefix will be loaded as a wavetable. This mean ") .n("<1 2 3 4 5 6 7 8 9 10>/2").room(0.5).size(0.9) .s('wt_flute').velocity(0.25).often(n => n.ply(2)) .release(0.125).decay("<0.1 0.25 0.3 0.4>").sustain(0) -.cutoff(2000).scope({}).cutoff("<1000 2000 4000>").fast(4)`} +.cutoff(2000).cutoff("<1000 2000 4000>").fast(4) +._scope() +`} /> ## ZZFX @@ -159,7 +160,7 @@ It has 20 parameters in total, here is a snippet that uses all: .tremolo(0) // 0-1 lfo volume modulation amount //.duration(.2) // overwrite strudel event duration //.gain(1) // change volume - .scope() // vizualise waveform (not zzfx related) + ._scope() // vizualise waveform (not zzfx related) `} />