docs: use note instead of n to mitigate confusion

This commit is contained in:
Felix Roos 2023-01-19 11:27:54 +01:00
parent 203ed88024
commit ffdfb07f72
5 changed files with 680 additions and 714 deletions

View File

@ -1736,27 +1736,6 @@ exports[`runs examples > example "fastGap" example index 0 1`] = `
]
`;
exports[`runs examples > example "fastcat" example index 0 1`] = `
[
"[ 0/1 → 1/3 | e5 ]",
"[ 1/3 → 2/3 | b4 ]",
"[ 2/3 → 5/6 | d5 ]",
"[ 5/6 → 1/1 | c5 ]",
"[ 1/1 → 4/3 | e5 ]",
"[ 4/3 → 5/3 | b4 ]",
"[ 5/3 → 11/6 | d5 ]",
"[ 11/6 → 2/1 | c5 ]",
"[ 2/1 → 7/3 | e5 ]",
"[ 7/3 → 8/3 | b4 ]",
"[ 8/3 → 17/6 | d5 ]",
"[ 17/6 → 3/1 | c5 ]",
"[ 3/1 → 10/3 | e5 ]",
"[ 10/3 → 11/3 | b4 ]",
"[ 11/3 → 23/6 | d5 ]",
"[ 23/6 → 4/1 | c5 ]",
]
`;
exports[`runs examples > example "firstOf" example index 0 1`] = `
[
"[ 3/4 → 1/1 | note:c3 ]",
@ -3484,19 +3463,6 @@ exports[`runs examples > example "sine" example index 0 1`] = `
]
`;
exports[`runs examples > example "size" example index 0 1`] = `
[
"[ 0/1 → 1/2 | s:bd room:0.8 size:0 ]",
"[ 1/2 → 1/1 | s:sd room:0.8 size:0 ]",
"[ 1/1 → 3/2 | s:bd room:0.8 size:1 ]",
"[ 3/2 → 2/1 | s:sd room:0.8 size:1 ]",
"[ 2/1 → 5/2 | s:bd room:0.8 size:2 ]",
"[ 5/2 → 3/1 | s:sd room:0.8 size:2 ]",
"[ 3/1 → 7/2 | s:bd room:0.8 size:4 ]",
"[ 7/2 → 4/1 | s:sd room:0.8 size:4 ]",
]
`;
exports[`runs examples > example "slow" example index 0 1`] = `
[
"[ 0/1 → 1/1 | s:bd ]",

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@ s("bd,[~ <sd!3 sd(3,4,2)>],hh*8") // drums
.off(1/8,x=>x.add(12).degradeBy(.5)) // random octave jumps
.add(perlin.range(0,.5)) // random pitch variation
.superimpose(add(.05)) // add second, slightly detuned voice
.n() // wrap in "n"
.note() // wrap in "note"
.decay(.15).sustain(0) // make each note of equal length
.s('sawtooth') // waveform
.gain(.4) // turn down
@ -68,7 +68,7 @@ s("bd,[~ <sd!3 sd(3,4,2)>],hh*8") // drums
,"<Am7!3 <Em7 E7b13 Em7 Ebm7b5>>".voicings('lefthand') // chords
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
.add(perlin.range(0,.5)) // random pitch variation
.n() // wrap in "n"
.note() // wrap in "note"
.s('sawtooth') // waveform
.gain(.16) // turn down
.cutoff(500) // fixed cutoff

View File

@ -20,15 +20,17 @@ You can learn more about both of these approaches in the pages [Synths](/learn/s
# Combining notes and sounds
In both of the above cases, we are no longer directly controlling the `note`/`n`/`freq` of the sound heard via `s`, as we were in the [Notes](/strudel/notes) page.
In both of the above cases, we are no longer directly controlling the `note`/`freq` of the sound heard via `s`, as we were in the [Notes](/strudel/notes) page.
So how can we both control the sound and the pitch? We can _combine_ `note`/`n`/`freq` with `s` to change the sound of our pitches:
So how can we both control the sound and the pitch? We can _combine_ `note`/`freq` with `s` to change the sound of our pitches:
<MiniRepl client:idle tune={`note("a3 c#4 e4 a4").s("sawtooth")`} />
<MiniRepl client:idle tune={`n("57 61 64 69").s("triangle")`} />
<MiniRepl client:idle tune={`note("57 61 64 69").s("sine")`} />
<MiniRepl client:idle tune={`freq("220 275 330 440").s("sine")`} />
<MiniRepl client:idle tune={`freq("220 275 330 440").s("triangle")`} />
The last example will actually sound the same with or without `s`, because `triangle` is the default value for `s`.
What about combining different notes with different sounds at the same time?
@ -37,5 +39,3 @@ What about combining different notes with different sounds at the same time?
Hmm, something interesting is going on there, related to there being five notes and three sounds.
Let's now take a step back and think about the Strudel [Code](/learn/code) we've been hearing so far.
<br />

View File

@ -466,14 +466,14 @@ samples({
stack(
"-7 0 -7 7".struct("x(5,8,1)").fast(2).sub(7)
.scale(scales)
.n()
.note()
.s("sawtooth,square")
.gain(.3).attack(0.01).decay(0.1).sustain(.5)
.apply(filter1),
"~@3 [<2 3>,<4 5>]"
.echo(4,1/16,.7)
.scale(scales)
.n()
.note()
.s('square').gain(.7)
.attack(0.01).decay(0.1).sustain(0)
.apply(filter1),
@ -484,7 +484,7 @@ stack(
.fast(2)
.echo(32, 1/8, .8)
.scale(scales)
.n()
.note()
.s("sawtooth")
.gain(sine.range(.1,.4).slow(8))
.attack(.001).decay(.2).sustain(0)
@ -527,7 +527,7 @@ stack(
.off(1/8,x=>x.add(12).degradeBy(.5)) // random octave jumps
.add(perlin.range(0,.5)) // random pitch variation
.superimpose(add(.05)) // add second, slightly detuned voice
.n() // wrap in "n"
.note() // wrap in "note"
.decay(.15).sustain(0) // make each note of equal length
.s('sawtooth') // waveform
.gain(.4) // turn down
@ -536,7 +536,7 @@ stack(
,"<Am7!3 <Em7 E7b13 Em7 Ebm7b5>>".voicings('lefthand') // chords
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
.add(perlin.range(0,.5)) // random pitch variation
.n() // wrap in "n"
.note() // wrap in "note"
.s('sawtooth') // waveform
.gain(.16) // turn down
.cutoff(500) // fixed cutoff
@ -545,7 +545,7 @@ stack(
,"a4 c5 <e6 a6>".struct("x(5,8,-1)")
.superimpose(x=>x.add(.04)) // add second, slightly detuned voice
.add(perlin.range(0,.5)) // random pitch variation
.n() // wrap in "n"
.note() // wrap in "note"
.decay(.1).sustain(0) // make notes short
.s('triangle') // waveform
.degradeBy(perlin.range(0,.5)) // randomly controlled random removal :)
@ -565,12 +565,12 @@ samples({
"C^7 Am7 Dm7 G7".slow(2).voicings('lefthand')
.stack("0@6 [<1 2> <2 0> 1]@2".scale('C5 major'))
.n().slow(4)
.note().slow(4)
.s('0040_FluidR3_GM_sf2_file')
.color('steelblue')
.stack(
"<-7 ~@2 [~@2 -7] -9 ~@2 [~@2 -9] -10!2 ~ [~@2 -10] -5 ~ [-3 -2 -10]@2>*2".scale('C3 major')
.n().s('sawtooth').color('brown')
.note().s('sawtooth').color('brown')
)
.attack(0.05).decay(.1).sustain(.7)
.cutoff(perlin.range(800,2000))