diff --git a/package.json b/package.json
index 045dced..3fb6780 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"tone": "^14.8.49",
"unique-names-generator": "^4.7.1",
"vite-plugin-markdown": "^2.1.0",
- "zifferjs": "^0.0.55",
+ "zifferjs": "^0.0.58",
"zyklus": "^0.1.4",
"zzfx": "^1.2.0"
}
diff --git a/src/classes/ZPlayer.ts b/src/classes/ZPlayer.ts
index bd14783..710e45c 100644
--- a/src/classes/ZPlayer.ts
+++ b/src/classes/ZPlayer.ts
@@ -336,6 +336,56 @@ export class Player extends AbstractEvent {
return this;
}
+ cubeDance(tonnetz: TonnetzSpaces = [3, 4, 5], repeats: number = 3) {
+ if (this.atTheBeginning()) this.ziffers.cubeDance(tonnetz, repeats);
+ return this;
+ }
+
+ powerTowers(tonnetz: TonnetzSpaces = [3, 4, 5], repeats: number = 3) {
+ if (this.atTheBeginning()) this.ziffers.powerTowers(tonnetz, repeats);
+ return this;
+ }
+
+ shuffle() {
+ if (this.atTheBeginning()) this.ziffers.shuffle();
+ return this;
+ }
+
+ deal(amount: number = this.ziffers.values.length) {
+ if (this.atTheBeginning()) this.ziffers.deal(amount);
+ return this;
+ }
+
+ from(value: number) {
+ if (this.atTheBeginning()) this.ziffers.from(value);
+ return this;
+ }
+
+ to(value: number) {
+ if (this.atTheBeginning()) this.ziffers.to(value);
+ return this;
+ }
+
+ between(value: number, value2: number) {
+ if (this.atTheBeginning()) this.ziffers.between(value, value2+1);
+ return this;
+ }
+
+ keep() {
+ this.ziffers.setRedo(0);
+ return this;
+ }
+
+ repeat(amount: number) {
+ this.ziffers.setRedo(amount);
+ return this;
+ }
+
+ every(amount: number) {
+ if (this.atTheBeginning()) this.ziffers.every(amount);
+ return this;
+ }
+
tonnetzChord(chord: string) {
if (this.atTheBeginning()) this.ziffers.tonnetzChords(chord);
return this;
@@ -366,6 +416,15 @@ export class Player extends AbstractEvent {
return this;
}
+ rotate(amount: number = 1) {
+ // TODO: Only works for evaluated patterns (setRedo). Fix this for generative patterns. Mod by current cycle?
+ if (this.atTheBeginning()) {
+ this.ziffers.setRedo(0);
+ this.ziffers.rotate(amount);
+ }
+ return this;
+ }
+
listen(value: string) {
if(typeof value === "string") {
const cueTime = this.app.api.cueTimes[value];
diff --git a/src/documentation/patterns/ziffers/ziffers_algorithmic.ts b/src/documentation/patterns/ziffers/ziffers_algorithmic.ts
index cf30c1b..c7560d0 100644
--- a/src/documentation/patterns/ziffers/ziffers_algorithmic.ts
+++ b/src/documentation/patterns/ziffers/ziffers_algorithmic.ts
@@ -78,8 +78,17 @@ z1("s A=(0 (1,4)) B~(2 (3,8)) A B A B A")
true,
)}
+## Generative functions
-
+ * repeat(amount: number) Repeat the generated pattern without re-evaluating random patterns
+ * shuffle() Shuffle the generated pattern
+ * deal(amount: number): Shuffle the generated pattern and deal given number of elements
+ * retrograde() Reverse the generated pattern
+ * invert() Invert the generated pattern
+ * between(start: number, end: number) Select a range of elements from the generated pattern
+ * from(start: number) Select a range of elements from the start index to the end of the pattern
+ * to(end: number) Select a range of elements from the beginning of the pattern to the end index
+ * every(amount: number) Select every n-th element from the pattern
`;
};
diff --git a/src/documentation/patterns/ziffers/ziffers_tonnetz.ts b/src/documentation/patterns/ziffers/ziffers_tonnetz.ts
index 2d58836..3c9cffd 100644
--- a/src/documentation/patterns/ziffers/ziffers_tonnetz.ts
+++ b/src/documentation/patterns/ziffers/ziffers_tonnetz.ts
@@ -210,6 +210,8 @@ In addition to the transformations, Ziffers implements cyclic methods that can b
* hexaCycle(tonnetz: number[], repeats: number = 3): Cycles through chords in the hexa cycle
* octaCycle(tonnetz: number[], repeats: number = 4): Cycles through chords in the octa cycle
* enneaCycle(tonnetz: number[], repeats: number = 3): Cycles through chords in the ennea cycle
+* powerTowers(tonnetz: number[], repeats: number = 3): Cycles trough chords using the power towers
+* cubeDance(tonnetz: number[], repeats: number = 3): Cycles trough chords in a cube dance
HexaCycles are sequences of major and minor triads generated by the p and l transformations . Let's take the following example starting with a C chord: C -> Cm -> Ab -> Abm -> E -> Em. You can start on the chord of your choice.
@@ -262,15 +264,15 @@ As you can verify it manually, you will see that this is not the case. Upon reac
To play the chords without jumps in our hexaCycle (although the prefix "hexa" would no longer have a precise meaning), we add a number of repetitions.
${makeExample(
- "HexaCycles with vitamins",
- `
+"HexaCycles with vitamins",
+`
z1("0")
- .scale("chromatic")
- .hexaCycle([2,3,7],4)
- .sound("sine").out()
+.scale("chromatic")
+.hexaCycle([2,3,7],4)
+.sound("sine").out()
`,
- true
- )}
+true
+)}
By default hexaCycles and enneaCycles have 3 repetitions, while octaCycles has 4 repetitions. We have specified a **chromatic scale** although this is the **default scale**. Try changing the **repeats and scales** when playing with different Tonnetz.
diff --git a/yarn.lock b/yarn.lock
index 7c847aa..654a735 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4033,10 +4033,10 @@ yaml@^2.1.1:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b"
integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==
-zifferjs@^0.0.55:
- version "0.0.55"
- resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.55.tgz#ff7d08c9afde6cb78649f585b5a2c97ee4c97f22"
- integrity sha512-QO/xWN3RugMbusIYxB7H1aHSm1w8OD1leEseJcDwxBx9VxTBWZF9SrxGbNdRowFAIfFg9b4hpOYmMSQYqi87EA==
+zifferjs@^0.0.58:
+ version "0.0.58"
+ resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.58.tgz#206f52479807c6c965b77ec8ff9961847a7f6108"
+ integrity sha512-7CTrQkJrlVqmq5CzGK2OAQ0Fof/yLcloRBNPsprZbPQGE7bEUtupnvpFFFKFtt77pUzzbxUG56zyZsjj/HENlA==
zyklus@^0.1.4:
version "0.1.4"