Added powerTowers and cubeDance to tonnetz and added some generative funcitons for ziffers

This commit is contained in:
2023-12-25 00:55:56 +02:00
parent 30983147ea
commit 95650c5d01
5 changed files with 83 additions and 13 deletions

View File

@ -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"
}

View File

@ -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];

View File

@ -78,8 +78,17 @@ z1("s A=(0 (1,4)) B~(2 (3,8)) A B A B A")
true,
)}
## Generative functions
* <ic>repeat(amount: number)</ic> Repeat the generated pattern without re-evaluating random patterns
* <ic>shuffle()</ic> Shuffle the generated pattern
* <ic>deal(amount: number): Shuffle the generated pattern and deal given number of elements
* <ic>retrograde()</ic> Reverse the generated pattern
* <ic>invert()</ic> Invert the generated pattern
* <ic>between(start: number, end: number)</ic> Select a range of elements from the generated pattern
* <ic>from(start: number)</ic> Select a range of elements from the start index to the end of the pattern
* <ic>to(end: number)</ic> Select a range of elements from the beginning of the pattern to the end index
* <ic>every(amount: number)</ic> Select every n-th element from the pattern
`;
};

View File

@ -210,6 +210,8 @@ In addition to the transformations, Ziffers implements cyclic methods that can b
* <ic>hexaCycle(tonnetz: number[], repeats: number = 3)</ic>: Cycles through chords in the hexa cycle
* <ic>octaCycle(tonnetz: number[], repeats: number = 4)</ic>: Cycles through chords in the octa cycle
* <ic>enneaCycle(tonnetz: number[], repeats: number = 3)</ic>: Cycles through chords in the ennea cycle
* <ic>powerTowers(tonnetz: number[], repeats: number = 3)</ic>: Cycles trough chords using the power towers
* <ic>cubeDance(tonnetz: number[], repeats: number = 3)</ic>: Cycles trough chords in a cube dance
HexaCycles are sequences of major and minor triads generated by the <ic>p</ic> and <ic>l</ic> transformations . Let's take the following example starting with a <ic>C</ic> chord: <ic>C -> Cm -> Ab -> Abm -> E -> Em</ic>. You can start on the chord of your choice.

View File

@ -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"