Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to tutorial documentation #162

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/core/pattern.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,13 +1014,6 @@ export class Pattern {
return this._chunk(n, func, true);
}

edit(...funcs) {
return stack(...funcs.map((func) => func(this)));
}
pipe(func) {
return func(this);
}

_bypass(on) {
on = Boolean(parseInt(on));
return on ? silence : this;
Expand Down
4 changes: 2 additions & 2 deletions repl/src/tunes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ const drums = stack(
const thru = (x) => x.transpose("<0 1>/8").transpose(-1);
const synths = stack(
"<eb4 d4 c4 b3>/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).struct("[~ x]*2")
.edit(
.layer(
scaleTranspose(0).early(0),
scaleTranspose(2).early(1/8),
scaleTranspose(7).early(1/4),
Expand Down Expand Up @@ -517,7 +517,7 @@ const snare = noise({type:'white',...adsr(0,0.2,0)}).chain(lowpass(5000),vol(1.8
const s = polysynth().set({...osc('sawtooth4'),...adsr(0.01,.2,.6,0.2)}).chain(vol(.23).connect(delay),out());
stack(
stack(
"0 1 4 [3!2 5]".edit(
"0 1 4 [3!2 5]".layer(
// chords
x=>x.add("0,3").duration("0.05!3 0.02"),
// bass
Expand Down
30 changes: 17 additions & 13 deletions tutorial/tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ const drums = stack(
const thru = (x) => x.transpose("<0 1>/8").transpose(-1);
const synths = stack(
"<eb4 d4 c4 b3>/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).struct("[~ x]\*2")
.edit(
.layer(
scaleTranspose(0).early(0),
scaleTranspose(2).early(1/8),
scaleTranspose(7).early(1/4),
scaleTranspose(8).early(3/8)
).edit(thru).tone(keys).bypass("<1 0>/16"),
"<C2 Bb1 Ab1 [G1 [G2 G1]]>/2".struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass),
"<Cm7 Bb7 Fm7 G7b13>/2".struct("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4))
).layer(thru).tone(keys).bypass("<1 0>/16"),
"<C2 Bb1 Ab1 [G1 [G2 G1]]>/2".struct("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).layer(thru).tone(bass),
"<Cm7 Bb7 Fm7 G7b13>/2".struct("~ [x@0.1 ~]".fast(2)).voicings().layer(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4))
)
stack(
drums.fast(2),
Expand Down Expand Up @@ -175,11 +175,21 @@ Using "!" we can repeat without speeding up:

In essence, the `x!n` is like a shortcut for `[x*n]@n`.

## Euclidian

Using round brackets, we can create rhythmical sub-divisions based on three parameters: beats, segments and offset.
The first parameter controls how may beats will be played.
The second parameter controls the total amount of segments the beats will be distributed over.
The third (optional) parameter controls the starting position for distributing the beats.
One popular Euclidian rhythm (going by various names, such as "Pop Clave") is "(3,8,1)" or simply "(3,8)",
resulting in a rhythmical structure of "x ~ ~ x ~ ~ x ~" (3 beats over 8 segments, starting on position 1).

<MiniRepl tune={`"e5(2,8) b4(3,8) d5(2,8) c5(3,8)".slow(4)`} />

## Mini Notation TODO

Compared to [tidal mini notation](https://tidalcycles.org/docs/patternlib/tutorials/mini_notation/), the following mini notation features are missing from Strudel:

- [x] Euclidean algorithm "c3(3,2,1)" TODO: document
- [ ] Tie symbols "\_"
- [ ] feet marking "."
- [ ] random choice "|"
Expand Down Expand Up @@ -436,12 +446,6 @@ Applies the given function by the given time offset:

<MiniRepl tune={`"c3 eb3 g3".off(1/8, add(7))`} />

### append(pat)

Appends the given pattern after the current pattern:

<MiniRepl tune={`"c4,eb4,g4".append("c4,f4,ab4")`} />

### stack(pat)

Stacks the given pattern to the current pattern:
Expand Down Expand Up @@ -643,10 +647,10 @@ Turns chord symbols into root notes of chords in given octave.

<MiniRepl tune={`"<C^7 A7b13 Dm7 G7>".rootNotes(3)`} />

Together with edit, struct and voicings, this can be used to create a basic backing track:
Together with layer, struct and voicings, this can be used to create a basic backing track:

<MiniRepl
tune={`"<C^7 A7b13 Dm7 G7>".edit(
tune={`"<C^7 A7b13 Dm7 G7>".layer(
x => x.voicings(['d3','g4']).struct("~ x"),
x => x.rootNotes(2).tone(synth(osc('sawtooth4')).chain(out()))
)`}
Expand Down