diff --git a/package.json b/package.json index 5c8230d..d5dd6aa 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "tone": "^14.8.49", "unique-names-generator": "^4.7.1", "vite-plugin-markdown": "^2.1.0", - "zifferjs": "^0.0.21", + "zifferjs": "^0.0.24", "zzfx": "^1.2.0" } } diff --git a/src/classes/ZPlayer.ts b/src/classes/ZPlayer.ts index 75313f9..ae0fe54 100644 --- a/src/classes/ZPlayer.ts +++ b/src/classes/ZPlayer.ts @@ -196,6 +196,20 @@ export class Player extends Event { return this; } + voiceleading() { + if (this.atTheBeginning()) this.ziffers.lead(); + return this; + } + + lead = () => this.voiceleading(); + + invert = (n: number) => { + if (this.atTheBeginning()) { + this.ziffers.invert(n); + } + return this; + } + retrograde() { if (this.atTheBeginning()) this.ziffers.retrograde(); return this; diff --git a/src/documentation/ziffers.ts b/src/documentation/ziffers.ts index e01c828..dc3d9df 100644 --- a/src/documentation/ziffers.ts +++ b/src/documentation/ziffers.ts @@ -28,6 +28,7 @@ The basic Ziffer notation is entirely written in JavaScript strings (_e.g_ " | **Accidentals** | # b | Sharp and flats, just like with regular music notation :smile: | | **Rest** | r | Rest / silences | | **Repeat** | :1-9 | Repeat the item 1-9 times | +| **Chords** | [1-9]+ / [iv]+ / [AG]+name | Multiple pitches grouped together, roman numerals or named chords | **Note:** Some features are still unsupported. For full syntax see article about Ziffers. @@ -136,6 +137,21 @@ ${makeExample( ` )} +${makeExample( + "Chord transposition with roman numerals", + ` + z1('i i v%-4 v%-2 vi%-5 vi%-3 iv%-2 iv%-1').sound('sawtooth').out() +` +)} + +${makeExample( + "Chord transposition with named chords", + ` + z1('e C9:4 Emin:4 F7%-1:4 Emaj%-1:4') + .sound("stab").out() +` +)} + ## Algorithmic operations Ziffers provides shorthands for **many** numeric and algorithimic operations such as evaluating random numbers and creating sequences using list operations: diff --git a/yarn.lock b/yarn.lock index ec0ad2f..e41f7bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1451,10 +1451,10 @@ yaml@^2.1.1: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== -zifferjs@^0.0.21: - version "0.0.21" - resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.21.tgz#5df0c6541ae189b2515b4eb4856eb9d2c0610778" - integrity sha512-wJat1nbeCJ1j7+5YpeB5MnZdbyFfAwVRB8Ei+cgViEtjidwe4oCLtNq1p8Gq1PjjpSzr32YR57egCdME2Lb5qg== +zifferjs@^0.0.24: + version "0.0.24" + resolved "https://registry.yarnpkg.com/zifferjs/-/zifferjs-0.0.24.tgz#073f606086ed7977a8c5cd6cc2f9d6c897415281" + integrity sha512-pTUM2i3pTBsINiflBym48pzQnEmw93Xf9GVq0FUnnWwLBirwJJsOxJeZZG/c7DVf4EnV7oC1Ik/R5ULt2sVtug== zzfx@^1.2.0: version "1.2.0"