From d530cb7ced38cfcc0b272d997f9213c4209e6ede Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Wed, 22 Feb 2023 18:31:39 -0500 Subject: [PATCH 01/12] added new texture? unteste --- AugmentedNet/texturizers.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 0ab94a34..244451bc 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -218,6 +218,32 @@ def templateSeventh(self): """ +class AuxilaryNotes(TextureTemplate): + """A syncopated pattern to separate the upper voice from the rest. + + The highest note is played in isolation, + followed by the remaining lower notes, + played in syncopation.""" + + supported_durations = [1.0] + + def templateTriad(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" +{dur},{dur},,['{self.notes[2].transpose(-1, inPlace=True)}'],[],[True] +{dur*2},{dur*2},,['{self.notes[2]}'],[],[True] +""" + + def templateSeventh(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" +{dur},{dur},,['{self.notes[3].transpose(-1, inPlace=True)}'],[],[True] +{dur*2},{dur*2},,['{self.notes[3]}'],[],[True] +""" + + class BlockChord(TextureTemplate): """A block-chord texture. The default texture in music21-generated scores.""" @@ -235,10 +261,11 @@ def templateSeventh(self): available_templates = { - "BassSplit": BassSplit, - "Alberti": Alberti, - "Syncopation": Syncopation, + # "BassSplit": BassSplit, + # "Alberti": Alberti, + # "Syncopation": Syncopation, "BlockChord": BlockChord, + "AuxilaryNotes": AuxilaryNotes, } available_durations = list( From b4962017e263211ea3e81a7f4a662734ae340e3a Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Fri, 3 Mar 2023 16:28:07 -0500 Subject: [PATCH 02/12] fixed texture, tested! --- AugmentedNet/texturizers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 244451bc..1ee11b41 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -1,6 +1,7 @@ """Templates for texturizing annotation files and turn them into scores.""" import random +from music21 import note class TextureTemplate(object): @@ -228,18 +229,26 @@ class AuxilaryNotes(TextureTemplate): supported_durations = [1.0] def templateTriad(self): + transposedNote = note.Note(self.notes[2]).transpose(-1).nameWithOctave + print(self.notes) + print(self.notes[2]) + print(transposedNote) dur = self.duration / 4 return f"""\ 0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" -{dur},{dur},,['{self.notes[2].transpose(-1, inPlace=True)}'],[],[True] +{dur},{dur},,['{transposedNote}'],[],[True] {dur*2},{dur*2},,['{self.notes[2]}'],[],[True] """ def templateSeventh(self): + transposedNote = note.Note(self.notes[3]).transpose(-1).nameWithOctave + print(self.notes) + print(self.notes[3]) + print(transposedNote) dur = self.duration / 4 return f"""\ 0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" -{dur},{dur},,['{self.notes[3].transpose(-1, inPlace=True)}'],[],[True] +{dur},{dur},,['{transposedNote}'],[],[True] {dur*2},{dur*2},,['{self.notes[3]}'],[],[True] """ From b55ce54ba2f6aaf4301960972b2166563fad0e54 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Fri, 3 Mar 2023 19:59:27 -0500 Subject: [PATCH 03/12] Fix typo Co-authored-by: Prabhat Nagarajan --- AugmentedNet/texturizers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 1ee11b41..955b05a4 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -219,7 +219,7 @@ def templateSeventh(self): """ -class AuxilaryNotes(TextureTemplate): +class AuxiliaryNotes(TextureTemplate): """A syncopated pattern to separate the upper voice from the rest. The highest note is played in isolation, @@ -274,7 +274,7 @@ def templateSeventh(self): # "Alberti": Alberti, # "Syncopation": Syncopation, "BlockChord": BlockChord, - "AuxilaryNotes": AuxilaryNotes, + "AuxiliaryNotes": AuxiliaryNotes, } available_durations = list( From 3869967d5352c074744ae822de803ee06c705677 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Fri, 3 Mar 2023 21:04:07 -0500 Subject: [PATCH 04/12] added intervals & isOnSet to the returning value --- AugmentedNet/texturizers.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 1ee11b41..a5aae17c 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -2,6 +2,7 @@ import random from music21 import note +from music21 import interval class TextureTemplate(object): @@ -220,36 +221,32 @@ def templateSeventh(self): class AuxilaryNotes(TextureTemplate): - """A syncopated pattern to separate the upper voice from the rest. + """TODO: Add first line - The highest note is played in isolation, - followed by the remaining lower notes, - played in syncopation.""" + TODO: Add details""" - supported_durations = [1.0] + supported_durations = [1.0, 2.0] def templateTriad(self): - transposedNote = note.Note(self.notes[2]).transpose(-1).nameWithOctave - print(self.notes) - print(self.notes[2]) - print(transposedNote) + transposed_note = note.Note(self.notes[2]).transpose(-1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name dur = self.duration / 4 return f"""\ 0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" -{dur},{dur},,['{transposedNote}'],[],[True] -{dur*2},{dur*2},,['{self.notes[2]}'],[],[True] +{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" +{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" """ def templateSeventh(self): - transposedNote = note.Note(self.notes[3]).transpose(-1).nameWithOctave - print(self.notes) - print(self.notes[3]) - print(transposedNote) + transposed_note = note.Note(self.notes[3]).transpose(-1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name dur = self.duration / 4 return f"""\ 0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" -{dur},{dur},,['{transposedNote}'],[],[True] -{dur*2},{dur*2},,['{self.notes[3]}'],[],[True] +{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" +{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" """ From 47a8766f889d5fbc36477d23b6fe7d6e68d71e33 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Wed, 26 Apr 2023 20:43:54 -0400 Subject: [PATCH 05/12] clean code --- AugmentedNet/texturizers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index b68f55ba..861e6f78 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -221,9 +221,8 @@ def templateSeventh(self): class AuxiliaryNotes(TextureTemplate): - """A syncopated pattern to separate the upper voice from the rest. - - TODO: Add details""" + """A pitch pattern that creates a minor second interval in the middle of the chord. + """ supported_durations = [1.0, 2.0] @@ -267,9 +266,9 @@ def templateSeventh(self): available_templates = { - # "BassSplit": BassSplit, - # "Alberti": Alberti, - # "Syncopation": Syncopation, + "BassSplit": BassSplit, + "Alberti": Alberti, + "Syncopation": Syncopation, "BlockChord": BlockChord, "AuxiliaryNotes": AuxiliaryNotes, } From 78619da57be7b5a24d9407ee3112e7d982576113 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sat, 6 May 2023 21:42:37 -0400 Subject: [PATCH 06/12] adjust to log appropriate data --- AugmentedNet/cli.py | 10 +++++----- AugmentedNet/output_representations.py | 2 +- AugmentedNet/train.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/AugmentedNet/cli.py b/AugmentedNet/cli.py index 692c5ff9..ff9a2523 100644 --- a/AugmentedNet/cli.py +++ b/AugmentedNet/cli.py @@ -39,15 +39,15 @@ class DefaultArguments(object): "outputRepresentations": [ "Alto35", "Bass35", - # "ChordQuality11", - # "ChordRoot35", + "ChordQuality11", + "ChordRoot35", "HarmonicRhythm7", - # "Inversion4", + "Inversion4", "LocalKey38", "PitchClassSet121", - # "PrimaryDegree22", + "PrimaryDegree22", "RomanNumeral31", - # "SecondaryDegree22", + "SecondaryDegree22", "Soprano35", "Tenor35", "TonicizedKey38", diff --git a/AugmentedNet/output_representations.py b/AugmentedNet/output_representations.py index 3ee641ec..c0266db5 100644 --- a/AugmentedNet/output_representations.py +++ b/AugmentedNet/output_representations.py @@ -112,7 +112,7 @@ class Inversion4(OutputRepresentationTI): classList = list(range(4)) dfFeature = "a_inversion" - def run(self): + def run(self, transposition="P1"): array = np.zeros(self.shape, dtype=self.dtype) for frame, inversion in enumerate(self.df[self.dfFeature]): if inversion > 3: diff --git a/AugmentedNet/train.py b/AugmentedNet/train.py index 34e5ff3d..a57d0887 100644 --- a/AugmentedNet/train.py +++ b/AugmentedNet/train.py @@ -113,11 +113,11 @@ class ModdedModelCheckpoint(keras.callbacks.ModelCheckpoint): def on_epoch_end(self, epoch, logs={}): monitored = list(availableOutputs.keys()) nonMonitored = [ - "ChordQuality11", - "ChordRoot35", - "Inversion4", - "PrimaryDegree22", - "SecondaryDegree22", + # "ChordQuality11", + # "ChordRoot35", + # "Inversion4", + # "PrimaryDegree22", + # "SecondaryDegree22", ] monitored = [a for a in monitored if a not in nonMonitored] print(f"monitored_outputs: {monitored}") From f29266dec55f637057a9d8f0b983a4b75b7b6686 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sat, 6 May 2023 22:05:15 -0400 Subject: [PATCH 07/12] more textures = better accuracy (hopefully) --- AugmentedNet/texturizers.py | 90 ++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 861e6f78..b2aaf3c1 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -220,7 +220,36 @@ def templateSeventh(self): """ -class AuxiliaryNotes(TextureTemplate): +class AuxiliaryNotesUp(TextureTemplate): + """A pitch pattern that creates a minor second interval in the middle of the chord. + """ + + supported_durations = [1.0, 2.0] + + def templateTriad(self): + transposed_note = note.Note(self.notes[2]).transpose(1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" +{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" +{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" +""" + + def templateSeventh(self): + transposed_note = note.Note(self.notes[3]).transpose(1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" +{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" +{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" +""" + + +class AuxiliaryNotesDown(TextureTemplate): """A pitch pattern that creates a minor second interval in the middle of the chord. """ @@ -249,6 +278,60 @@ def templateSeventh(self): """ +class AppoggiaturaUp(TextureTemplate): + """A pitch pattern that creates a minor second interval at the beggining of the chord. + """ + + supported_durations = [1.0, 2.0] + + def templateTriad(self): + transposed_note = note.Note(self.notes[2]).transpose(1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" +{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" +""" + + def templateSeventh(self): + transposed_note = note.Note(self.notes[3]).transpose(1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" +{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" +""" + + +class AppoggiaturaDown(TextureTemplate): + """A pitch pattern that creates a minor second interval at the beggining of the chord. + """ + + supported_durations = [1.0, 2.0] + + def templateTriad(self): + transposed_note = note.Note(self.notes[2]).transpose(-1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" +{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" +""" + + def templateSeventh(self): + transposed_note = note.Note(self.notes[3]).transpose(-1) + transposed_name = transposed_note.nameWithOctave + transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + dur = self.duration / 4 + return f"""\ +0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" +{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" +""" + + class BlockChord(TextureTemplate): """A block-chord texture. The default texture in music21-generated scores.""" @@ -270,7 +353,10 @@ def templateSeventh(self): "Alberti": Alberti, "Syncopation": Syncopation, "BlockChord": BlockChord, - "AuxiliaryNotes": AuxiliaryNotes, + "AuxiliaryNotesUp": AuxiliaryNotesUp, + "AuxiliaryNotesDown": AuxiliaryNotesDown, + "AppoggiaturaUp": AppoggiaturaUp, + "AppoggiaturaDown": AppoggiaturaDown, } available_durations = list( From 990b11e7f20c03d02e2c6c1e28534c029e3fbea7 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sat, 13 May 2023 14:47:38 -0400 Subject: [PATCH 08/12] added more textures --- AugmentedNet/texturizers.py | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index b2aaf3c1..8353e268 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -219,6 +219,92 @@ def templateSeventh(self): {dur*3},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" """ +class ArpeggioLong(TextureTemplate): + """A simple arpeggio pattern that climbs and descends the chord for half notes. + + The lowest note to the highest note of the chord is played in isolation, + then the highest note to the lowest note is played in isolation. + The note is formed as a triplet.""" + + supported_durations = [2.0] + + def templateTriad(self): + dur = self.duration / 6 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[2]}'],[],[True] +{dur*3},{dur},,['{self.notes[2]}'],[],[True] +{dur*4},{dur},,['{self.notes[1]}'],[],[True] +{dur*5},{dur},,['{self.notes[0]}'],[],[True] +""" + + def templateSeventh(self): + dur = self.duration / 6 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[2]}'],[],[True] +{dur*3},{dur},,['{self.notes[3]}'],[],[True] +{dur*4},{dur},,['{self.notes[2]}'],[],[True] +{dur*5},{dur},,['{self.notes[1]}'],[],[True] +""" + +class ArpeggioShort(TextureTemplate): + """A simple arpeggio pattern that climbs and descends the chord for quarter notes. + + The lowest note to the highest note of the chord is played in isolation, + then the second lowest note is played.""" + + supported_durations = [1.0] + + def templateTriad(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[2]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] +""" + + def templateSeventh(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[3]]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] +""" + +class ArpeggioAltering(TextureTemplate): + """Another arpeggio pattern applied for quarter notes.. + + Each note is played in the order of: + 1. The lowest note + 2. The highest note + 3. The second lowest note + 4. The highest note.""" + + supported_durations = [1.0] + + def templateTriad(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[2]}'],[],[True] +{dur*2},{dur},,['{self.notes[1]}'],[],[True] +{dur*3},{dur},,['{self.notes[2]}'],[],[True] +""" + + def templateSeventh(self): + dur = self.duration / 4 + return f"""\ +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[3]}'],[],[True] +{dur*2},{dur},,['{self.notes[1]]}'],[],[True] +{dur*3},{dur},,['{self.notes[3]}'],[],[True] +""" + class AuxiliaryNotesUp(TextureTemplate): """A pitch pattern that creates a minor second interval in the middle of the chord. @@ -357,6 +443,9 @@ def templateSeventh(self): "AuxiliaryNotesDown": AuxiliaryNotesDown, "AppoggiaturaUp": AppoggiaturaUp, "AppoggiaturaDown": AppoggiaturaDown, + "ArpeggioLong": ArpeggioLong, + "ArpeggioShort": ArpeggioShort, + "ArpeggioAltering": ArpeggioAltering } available_durations = list( From 7e5b24bb393fbd756cab96ef166e2d5cad811a36 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sat, 13 May 2023 15:06:42 -0400 Subject: [PATCH 09/12] fix syntax error --- AugmentedNet/texturizers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 8353e268..b273ae50 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -272,7 +272,7 @@ def templateSeventh(self): return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] {dur},{dur},,['{self.notes[1]}'],[],[True] -{dur*2},{dur},,['{self.notes[3]]}'],[],[True] +{dur*2},{dur},,['{self.notes[3]}'],[],[True] {dur*3},{dur},,['{self.notes[1]}'],[],[True] """ From 7917090f29c1a5bfb224a58a0957c8b40a9ab1ae Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sat, 13 May 2023 15:08:07 -0400 Subject: [PATCH 10/12] another syntax error!!! --- AugmentedNet/texturizers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index b273ae50..10dff520 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -301,7 +301,7 @@ def templateSeventh(self): return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] {dur},{dur},,['{self.notes[3]}'],[],[True] -{dur*2},{dur},,['{self.notes[1]]}'],[],[True] +{dur*2},{dur},,['{self.notes[1]}'],[],[True] {dur*3},{dur},,['{self.notes[3]}'],[],[True] """ From 518e2b2c71df7f93bb729c88b25422d6f96db0a2 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sun, 14 May 2023 12:03:41 -0400 Subject: [PATCH 11/12] update? textures --- AugmentedNet/texturizers.py | 248 +++++++++++++++--------------------- 1 file changed, 100 insertions(+), 148 deletions(-) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 10dff520..0d06c7c7 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -9,7 +9,7 @@ class TextureTemplate(object): """The base class for texturization templates.""" supported_durations = [4.0, 3.0, 2.0, 1.5, 1.0] - supported_number_of_notes = [3, 4] + supported_number_of_notes = [1, 3, 4] def __init__(self, duration, notes, intervals): self.numberOfNotes = len(notes) @@ -25,11 +25,30 @@ def __init__(self, duration, notes, intervals): self.header = ( "s_offset,s_duration,s_measure,s_notes,s_intervals,s_isOnset\n" ) + if self.numberOfNotes == 1: + self.template = self.templateNote if self.numberOfNotes == 3: self.template = self.templateTriad elif self.numberOfNotes == 4: self.template = self.templateSeventh + def templateNote(self): + if self.duration == 3.0: + return self.templateNoteDottedHalf() + elif self.duration == 1.5: + return self.templateNoteDottedQuarter() + else: + return self.templateNoteBinary() + + def templateNoteDottedHalf(self): + raise NotImplementedError() + + def templateNoteDottedQuarter(self): + raise NotImplementedError() + + def templateNoteBinary(self): + raise NotImplementedError() + def templateTriad(self): if self.duration == 3.0: return self.templateTriadDottedHalf() @@ -78,6 +97,8 @@ class BassSplit(TextureTemplate): the bass note in isolation during the first half, followed by the remaining upper notes.""" + supported_number_of_notes = [3, 4] + def templateTriadBinary(self): dur = self.duration / 2 return f"""\ @@ -137,6 +158,8 @@ class Alberti(TextureTemplate): A 4-note melodic pattern with the contour lowest, highest, middle, highest.""" + supported_number_of_notes = [3, 4] + def templateTriadBinary(self): dur = self.duration / 4 return f"""\ @@ -202,6 +225,7 @@ class Syncopation(TextureTemplate): played in syncopation.""" supported_durations = [4.0, 2.0] + supported_number_of_notes = [3, 4] def templateTriad(self): dur = self.duration / 4 @@ -219,55 +243,53 @@ def templateSeventh(self): {dur*3},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" """ -class ArpeggioLong(TextureTemplate): - """A simple arpeggio pattern that climbs and descends the chord for half notes. + +class Arpeggio(TextureTemplate): + """A simple arpeggio pattern that climbs and descends the chord. The lowest note to the highest note of the chord is played in isolation, - then the highest note to the lowest note is played in isolation. - The note is formed as a triplet.""" + then the highest note to the lowest note is played in isolation.""" - supported_durations = [2.0] + supported_number_of_notes = [3, 4] - def templateTriad(self): - dur = self.duration / 6 + def templateTriadBinary(self): + dur = self.duration / 4 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] {dur},{dur},,['{self.notes[1]}'],[],[True] {dur*2},{dur},,['{self.notes[2]}'],[],[True] -{dur*3},{dur},,['{self.notes[2]}'],[],[True] -{dur*4},{dur},,['{self.notes[1]}'],[],[True] -{dur*5},{dur},,['{self.notes[0]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] """ - def templateSeventh(self): - dur = self.duration / 6 + def templateTriadDottedHalf(self): + dur = 0.25 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] {dur},{dur},,['{self.notes[1]}'],[],[True] {dur*2},{dur},,['{self.notes[2]}'],[],[True] -{dur*3},{dur},,['{self.notes[3]}'],[],[True] -{dur*4},{dur},,['{self.notes[2]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] +{dur*4},{dur},,['{self.notes[0]}'],[],[True] {dur*5},{dur},,['{self.notes[1]}'],[],[True] +{dur*6},{dur},,['{self.notes[2]}'],[],[True] +{dur*7},{dur},,['{self.notes[1]}'],[],[True] +{dur*8},{dur},,['{self.notes[0]}'],[],[True] +{dur*9},{dur},,['{self.notes[1]}'],[],[True] +{dur*10},{dur},,['{self.notes[2]}'],[],[True] +{dur*11},{dur},,['{self.notes[1]}'],[],[True] """ -class ArpeggioShort(TextureTemplate): - """A simple arpeggio pattern that climbs and descends the chord for quarter notes. - - The lowest note to the highest note of the chord is played in isolation, - then the second lowest note is played.""" - - supported_durations = [1.0] - - def templateTriad(self): - dur = self.duration / 4 + def templateTriadDottedQuarter(self): + dur = 0.25 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] {dur},{dur},,['{self.notes[1]}'],[],[True] {dur*2},{dur},,['{self.notes[2]}'],[],[True] {dur*3},{dur},,['{self.notes[1]}'],[],[True] +{dur*4},{dur},,['{self.notes[0]}'],[],[True] +{dur*5},{dur},,['{self.notes[1]}'],[],[True] """ - def templateSeventh(self): + def templateSeventhBinary(self): dur = self.duration / 4 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] @@ -276,145 +298,80 @@ def templateSeventh(self): {dur*3},{dur},,['{self.notes[1]}'],[],[True] """ -class ArpeggioAltering(TextureTemplate): - """Another arpeggio pattern applied for quarter notes.. - - Each note is played in the order of: - 1. The lowest note - 2. The highest note - 3. The second lowest note - 4. The highest note.""" - - supported_durations = [1.0] - - def templateTriad(self): - dur = self.duration / 4 + def templateSeventhDottedHalf(self): + dur = 0.25 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] -{dur},{dur},,['{self.notes[2]}'],[],[True] -{dur*2},{dur},,['{self.notes[1]}'],[],[True] -{dur*3},{dur},,['{self.notes[2]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[3]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] +{dur*4},{dur},,['{self.notes[0]}'],[],[True] +{dur*5},{dur},,['{self.notes[1]}'],[],[True] +{dur*6},{dur},,['{self.notes[3]}'],[],[True] +{dur*7},{dur},,['{self.notes[1]}'],[],[True] +{dur*8},{dur},,['{self.notes[0]}'],[],[True] +{dur*9},{dur},,['{self.notes[1]}'],[],[True] +{dur*10},{dur},,['{self.notes[3]}'],[],[True] +{dur*11},{dur},,['{self.notes[1]}'],[],[True] """ - def templateSeventh(self): - dur = self.duration / 4 + def templateSeventhDottedQuarter(self): + dur = 0.25 return f"""\ 0.0,{dur},,['{self.notes[0]}'],[],[True] -{dur},{dur},,['{self.notes[3]}'],[],[True] -{dur*2},{dur},,['{self.notes[1]}'],[],[True] -{dur*3},{dur},,['{self.notes[3]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[3]}'],[],[True] +{dur*3},{dur},,['{self.notes[1]}'],[],[True] +{dur*4},{dur},,['{self.notes[0]}'],[],[True] +{dur*5},{dur},,['{self.notes[1]}'],[],[True] """ -class AuxiliaryNotesUp(TextureTemplate): - """A pitch pattern that creates a minor second interval in the middle of the chord. - """ - - supported_durations = [1.0, 2.0] - - def templateTriad(self): - transposed_note = note.Note(self.notes[2]).transpose(1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 - return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" -{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" -{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" -""" - def templateSeventh(self): - transposed_note = note.Note(self.notes[3]).transpose(1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 + dur = self.duration / 6 return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" -{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" -{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{self.notes[1]}'],[],[True] +{dur*2},{dur},,['{self.notes[2]}'],[],[True] +{dur*3},{dur},,['{self.notes[3]}'],[],[True] +{dur*4},{dur},,['{self.notes[2]}'],[],[True] +{dur*5},{dur},,['{self.notes[1]}'],[],[True] """ -class AuxiliaryNotesDown(TextureTemplate): +class AuxiliaryNotes(TextureTemplate): """A pitch pattern that creates a minor second interval in the middle of the chord. """ - supported_durations = [1.0, 2.0] - - def templateTriad(self): - transposed_note = note.Note(self.notes[2]).transpose(-1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 - return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[True, True, True]" -{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" -{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" -""" - - def templateSeventh(self): - transposed_note = note.Note(self.notes[3]).transpose(-1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 - return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[True, True, True, True]" -{dur},{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" -{dur*2},{dur*2},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" -""" - - -class AppoggiaturaUp(TextureTemplate): - """A pitch pattern that creates a minor second interval at the beggining of the chord. - """ - - supported_durations = [1.0, 2.0] - - def templateTriad(self): - transposed_note = note.Note(self.notes[2]).transpose(1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 - return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" -{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" -""" - - def templateSeventh(self): - transposed_note = note.Note(self.notes[3]).transpose(1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 - return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" -{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" -""" + supported_durations = [4.0, 2.0, 1.5, 1.0] + supported_number_of_notes = [1] -class AppoggiaturaDown(TextureTemplate): - """A pitch pattern that creates a minor second interval at the beggining of the chord. - """ - - supported_durations = [1.0, 2.0] - - def templateTriad(self): - transposed_note = note.Note(self.notes[2]).transpose(-1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name + def templateNoteBinary(self): + transposed_note_up = note.Note(self.notes[0]).transpose(1) + transposed_name_up = transposed_note_up.nameWithOctave + transposed_note_down = note.Note(self.notes[0]).transpose(-1) + transposed_name_down = transposed_note_down.nameWithOctave dur = self.duration / 4 return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{transposed_name}']","['{self.intervals[0]}', '{transposed_interval}']","[False, False, True]" -{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}']","['{self.intervals[0]}', '{self.intervals[1]}']","[False, False, True]" +0.0,{dur},,['{transposed_name_up}'],[],[True] +{dur},{dur},,['{self.notes[0]}'],[],[True] +{dur*2},{dur},,['{transposed_name_down}'],[],[True] +{dur*3},{dur},,['{self.notes[0]}'],[],[True] """ - def templateSeventh(self): - transposed_note = note.Note(self.notes[3]).transpose(-1) - transposed_name = transposed_note.nameWithOctave - transposed_interval = interval.Interval(noteStart=note.Note(self.notes[0]), noteEnd=transposed_note).name - dur = self.duration / 4 + def templateNoteDottedQuarter(self): + transposed_note_up = note.Note(self.notes[0]).transpose(1) + transposed_name_up = transposed_note_up.nameWithOctave + transposed_note_down = note.Note(self.notes[0]).transpose(-1) + transposed_name_down = transposed_note_down.nameWithOctave + dur = 0.25 return f"""\ -0.0,{dur},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{transposed_name}']","['{self.intervals[0]}', '{self.intervals[1]}', '{transposed_interval}']","[False, False, False, True]" -{dur},{dur*3},,"['{self.notes[0]}', '{self.notes[1]}', '{self.notes[2]}', '{self.notes[3]}']","['{self.intervals[0]}', '{self.intervals[1]}', '{self.intervals[2]}']","[False, False, False, True]" +0.0,{dur},,['{self.notes[0]}'],[],[True] +{dur},{dur},,['{transposed_name_up}'],[],[True] +{dur*2},{dur},,['{self.notes[0]}'],[],[True] +{dur*3},{dur},,['{transposed_name_down}'],[],[True] +{dur*5},{dur*2},,['{self.notes[0]}'],[],[True] """ @@ -439,13 +396,8 @@ def templateSeventh(self): "Alberti": Alberti, "Syncopation": Syncopation, "BlockChord": BlockChord, - "AuxiliaryNotesUp": AuxiliaryNotesUp, - "AuxiliaryNotesDown": AuxiliaryNotesDown, - "AppoggiaturaUp": AppoggiaturaUp, - "AppoggiaturaDown": AppoggiaturaDown, - "ArpeggioLong": ArpeggioLong, - "ArpeggioShort": ArpeggioShort, - "ArpeggioAltering": ArpeggioAltering + "Arpeggio": Arpeggio, + "AuxiliaryNotes": AuxiliaryNotes, } available_durations = list( From 80c2995fedf2ecdc9451a4ea7d72dab7252fe5e4 Mon Sep 17 00:00:00 2001 From: Alicelavander Date: Sun, 14 May 2023 12:36:58 -0400 Subject: [PATCH 12/12] fix NotImplementedError --- AugmentedNet/texturizers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AugmentedNet/texturizers.py b/AugmentedNet/texturizers.py index 0d06c7c7..dd86cf33 100644 --- a/AugmentedNet/texturizers.py +++ b/AugmentedNet/texturizers.py @@ -378,6 +378,8 @@ def templateNoteDottedQuarter(self): class BlockChord(TextureTemplate): """A block-chord texture. The default texture in music21-generated scores.""" + supported_number_of_notes = [3, 4] + def templateTriad(self): dur = self.duration return f"""\