From 0fb87d18189c4fbb794a4c012c6dfcd49419cce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Doar=C3=A9?= Date: Tue, 4 Mar 2025 15:02:39 +0100 Subject: [PATCH 1/2] Scale:circle_of_5ths_rotate --- scale.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scale.lua b/scale.lua index adc55b1..640d23d 100644 --- a/scale.lua +++ b/scale.lua @@ -106,6 +106,22 @@ function Scale:to_the_right_on_circle_of_5ths(iterations) :to_the_right_on_circle_of_5ths(iterations -1) end +--[[ + Warning: only works for ionian scales +]] +function Scale:circle_of_5ths_rotate(iterations) + if(iterations == 0) then + return self + elseif(iterations < 0) then + return self:to_the_left_on_circle_of_5ths(-iterations) + elseif(iterations > 0) then + return self:to_the_right_on_circle_of_5ths(iterations) + else + return "Error" + end +end + + --[[ Returns a new scale based on self, rotated from note_offset note_offset: From d12c6540b9f0b351c31f37dd417e0871dd563414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Doar=C3=A9?= Date: Tue, 25 Mar 2025 22:11:04 +0100 Subject: [PATCH 2/2] ChordBuilder:extend --- chord.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/chord.lua b/chord.lua index 34e5518..345c2c8 100644 --- a/chord.lua +++ b/chord.lua @@ -336,6 +336,20 @@ function ChordBuilder:clone() return b end +-- extensions is a table of 4 elements, false or true +-- the first element is the seventh, +-- the second is the ninth, +-- the third is the eleventh, +-- the fourth is the thirteenth +function ChordBuilder:extend(extensions) + local b = self:clone() + b.seventh = extensions[1] + b.ninth = extensions[2] + b.eleventh = extensions[3] + b.thirteenth = extensions[4] + return b +end + function ChordBuilder:withSeventh() local b = self:clone() b.seventh = true