use inline scope in examples

This commit is contained in:
Felix Roos 2024-06-02 14:03:05 +02:00
parent d0510f862a
commit b6e277f1ea
3 changed files with 26 additions and 17 deletions

View File

@ -191,7 +191,7 @@ export const { attack, att } = registerControl('attack', 'att');
* note("c e g b g e") * note("c e g b g e")
* .fm(4) * .fm(4)
* .fmh("<1 2 1.5 1.61>") * .fmh("<1 2 1.5 1.61>")
* .scope() * ._scope()
* *
*/ */
export const { fmh } = registerControl(['fmh', 'fmi'], 'fmh'); export const { fmh } = registerControl(['fmh', 'fmi'], 'fmh');
@ -205,7 +205,7 @@ export const { fmh } = registerControl(['fmh', 'fmi'], 'fmh');
* @example * @example
* note("c e g b g e") * note("c e g b g e")
* .fm("<0 1 2 8 32>") * .fm("<0 1 2 8 32>")
* .scope() * ._scope()
* *
*/ */
export const { fmi, fm } = registerControl(['fmi', 'fmh'], 'fm'); export const { fmi, fm } = registerControl(['fmi', 'fmh'], 'fm');
@ -221,7 +221,7 @@ export const { fmi, fm } = registerControl(['fmi', 'fmh'], 'fm');
* .fmdecay(.2) * .fmdecay(.2)
* .fmsustain(0) * .fmsustain(0)
* .fmenv("<exp lin>") * .fmenv("<exp lin>")
* .scope() * ._scope()
* *
*/ */
export const { fmenv } = registerControl('fmenv'); export const { fmenv } = registerControl('fmenv');
@ -234,7 +234,7 @@ export const { fmenv } = registerControl('fmenv');
* note("c e g b g e") * note("c e g b g e")
* .fm(4) * .fm(4)
* .fmattack("<0 .05 .1 .2>") * .fmattack("<0 .05 .1 .2>")
* .scope() * ._scope()
* *
*/ */
export const { fmattack } = registerControl('fmattack'); export const { fmattack } = registerControl('fmattack');
@ -248,7 +248,7 @@ export const { fmattack } = registerControl('fmattack');
* .fm(4) * .fm(4)
* .fmdecay("<.01 .05 .1 .2>") * .fmdecay("<.01 .05 .1 .2>")
* .fmsustain(.4) * .fmsustain(.4)
* .scope() * ._scope()
* *
*/ */
export const { fmdecay } = registerControl('fmdecay'); export const { fmdecay } = registerControl('fmdecay');
@ -262,7 +262,7 @@ export const { fmdecay } = registerControl('fmdecay');
* .fm(4) * .fm(4)
* .fmdecay(.1) * .fmdecay(.1)
* .fmsustain("<1 .75 .5 0>") * .fmsustain("<1 .75 .5 0>")
* .scope() * ._scope()
* *
*/ */
export const { fmsustain } = registerControl('fmsustain'); export const { fmsustain } = registerControl('fmsustain');
@ -800,10 +800,12 @@ export const { fanchor } = registerControl('fanchor');
* @example * @example
* note("a e") * note("a e")
* .vib("<.5 1 2 4 8 16>") * .vib("<.5 1 2 4 8 16>")
* ._scope()
* @example * @example
* // change the modulation depth with ":" * // change the modulation depth with ":"
* note("a e") * note("a e")
* .vib("<.5 1 2 4 8 16>:12") * .vib("<.5 1 2 4 8 16>:12")
* ._scope()
*/ */
export const { vib, vibrato, v } = registerControl(['vib', 'vibmod'], 'vibrato', 'v'); export const { vib, vibrato, v } = registerControl(['vib', 'vibmod'], 'vibrato', 'v');
/** /**
@ -824,10 +826,12 @@ export const { noise } = registerControl('noise');
* @example * @example
* note("a e").vib(4) * note("a e").vib(4)
* .vibmod("<.25 .5 1 2 12>") * .vibmod("<.25 .5 1 2 12>")
* ._scope()
* @example * @example
* // change the vibrato frequency with ":" * // change the vibrato frequency with ":"
* note("a e") * note("a e")
* .vibmod("<.25 .5 1 2 12>:8") * .vibmod("<.25 .5 1 2 12>:8")
* ._scope()
*/ */
export const { vibmod, vmod } = registerControl(['vibmod', 'vib'], 'vmod'); export const { vibmod, vmod } = registerControl(['vibmod', 'vib'], 'vmod');
export const { hcutoff, hpf, hp } = registerControl(['hcutoff', 'hresonance', 'hpenv'], 'hpf', 'hp'); export const { hcutoff, hpf, hp } = registerControl(['hcutoff', 'hresonance', 'hpenv'], 'hpf', 'hp');

View File

@ -122,6 +122,10 @@ strudel.Pattern.prototype.midi = function () {
return this; return this;
}; };
strudel.Pattern.prototype._scope = function () {
return this;
};
const uiHelpersMocked = { const uiHelpersMocked = {
backgroundImage: id, backgroundImage: id,
}; };

View File

@ -18,7 +18,7 @@ The basic waveforms are `sine`, `sawtooth`, `square` and `triangle`, which can b
client:idle client:idle
tune={`note("c2 <eb2 <g2 g1>>".fast(2)) tune={`note("c2 <eb2 <g2 g1>>".fast(2))
.sound("<sawtooth square triangle sine>") .sound("<sawtooth square triangle sine>")
.scope()`} ._scope()`}
/> />
If you don't set a `sound` but a `note` the default value for `sound` is `triangle`! 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 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. flavours of noise, here written from hard to soft.
<MiniRepl client:idle tune={`sound("<white pink brown>").scope()`} /> <MiniRepl client:idle tune={`sound("<white pink brown>")._scope()`} />
Here's a more musical example of how to use noise for hihats: Here's a more musical example of how to use noise for hihats:
<MiniRepl <MiniRepl
client:idle client:idle
tune={`sound("bd*2,<white pink brown>*8") tune={`sound("bd*2,<white pink brown>*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: Some amount of pink noise can also be added to any oscillator by using the `noise` paremeter:
<MiniRepl client:idle tune={`note("c3").noise("<0.1 0.25 0.5>").scope()`} /> <MiniRepl client:idle tune={`note("c3").noise("<0.1 0.25 0.5>")._scope()`} />
You can also use the `crackle` type to play some subtle noise crackles. You can control noise amount by using the `density` parameter: You can also use the `crackle` type to play some subtle noise crackles. You can control noise amount by using the `density` parameter:
<MiniRepl client:idle tune={`s("crackle*4").density("<0.01 0.04 0.2 0.5>".slow(2)).scope()`} /> <MiniRepl client:idle tune={`s("crackle*4").density("<0.01 0.04 0.2 0.5>".slow(2))._scope()`} />
### Additive Synthesis ### 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 <eb2 <g2 g1>>".fast(2)) tune={`note("c2 <eb2 <g2 g1>>".fast(2))
.sound("sawtooth") .sound("sawtooth")
.n("<32 16 8 4>") .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. 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 client:idle
tune={`note("c2 <eb2 <g2 g1>>".fast(2)) tune={`note("c2 <eb2 <g2 g1>>".fast(2))
.sound("sawtooth:<32 16 8 4>") .sound("sawtooth:<32 16 8 4>")
.scope()`} ._scope()`}
/> />
Note for tidal users: `n` in tidal is synonymous to `note` for synths only. 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
<MiniRepl <MiniRepl
client:idle client:idle
tune={`samples('github:Bubobubobubobubo/Dough-Waveforms/main/'); tune={`samples('bubo:waveforms');
note("<[g3,b3,e4]!2 [a3,c3,e4] [b3,d3,f#4]>") note("<[g3,b3,e4]!2 [a3,c3,e4] [b3,d3,f#4]>")
.n("<1 2 3 4 5 6 7 8 9 10>/2").room(0.5).size(0.9) .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)) .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) .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 ## 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 .tremolo(0) // 0-1 lfo volume modulation amount
//.duration(.2) // overwrite strudel event duration //.duration(.2) // overwrite strudel event duration
//.gain(1) // change volume //.gain(1) // change volume
.scope() // vizualise waveform (not zzfx related) ._scope() // vizualise waveform (not zzfx related)
`} `}
/> />