summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2019-03-14 13:54:43 +0100
committerJackson Moore <jacksonmoore@tuta.io>2019-03-14 13:54:43 +0100
commitc97ae7e887a3d3b3ebe2a899a5415c9b9904878e (patch)
tree697ad21b6ab004bea56895dc75fe2438934e6ce9
parentd8a495d7b03110096567ea115222341a981a3533 (diff)
clean upHEADmain
-rwxr-xr-x[-rw-r--r--].gitignore0
-rwxr-xr-x[-rw-r--r--]cadence.py0
-rwxr-xr-x[-rw-r--r--]function.py0
-rwxr-xr-x[-rw-r--r--]grammar.py0
-rwxr-xr-x[-rw-r--r--]harmony.py0
-rwxr-xr-x[-rw-r--r--]lexicon.py0
-rwxr-xr-x[-rw-r--r--]main.py6
-rwxr-xr-x[-rw-r--r--]passage.py0
-rwxr-xr-x[-rw-r--r--]path.py0
-rwxr-xr-x[-rw-r--r--]render.py17
-rwxr-xr-x[-rw-r--r--]rhythm.py0
-rwxr-xr-x[-rw-r--r--]spec.py139
-rwxr-xr-x[-rw-r--r--]utils.py0
13 files changed, 68 insertions, 94 deletions
diff --git a/.gitignore b/.gitignore
index 57415e1..57415e1 100644..100755
--- a/.gitignore
+++ b/.gitignore
diff --git a/cadence.py b/cadence.py
index 6169dc9..6169dc9 100644..100755
--- a/cadence.py
+++ b/cadence.py
diff --git a/function.py b/function.py
index d83bc98..d83bc98 100644..100755
--- a/function.py
+++ b/function.py
diff --git a/grammar.py b/grammar.py
index 7507b18..7507b18 100644..100755
--- a/grammar.py
+++ b/grammar.py
diff --git a/harmony.py b/harmony.py
index ebef53d..ebef53d 100644..100755
--- a/harmony.py
+++ b/harmony.py
diff --git a/lexicon.py b/lexicon.py
index da7b6b1..da7b6b1 100644..100755
--- a/lexicon.py
+++ b/lexicon.py
diff --git a/main.py b/main.py
index 92ee0e8..e143676 100644..100755
--- a/main.py
+++ b/main.py
@@ -27,12 +27,12 @@ render.py list of n passages rendered to music21 score object
# g.morphology.print()
lexicon = Lexicon()
-lexicon.populate(g, 5)
+lexicon.populate(g, 4)
lexicon.print()
print("\n-----------\n-----------\n")
-passage = Passage(height=5)
+passage = Passage(height=8)
passage.spellout(lexicon)
@@ -42,7 +42,7 @@ print(passage.tree)
print()
renderer = Renderer()
-renderer.render(passage, 'viola')
+renderer.render(passage, 'flute')
# todo
# working with multiple voices
diff --git a/passage.py b/passage.py
index 2bb7021..2bb7021 100644..100755
--- a/passage.py
+++ b/passage.py
diff --git a/path.py b/path.py
index 57269d3..57269d3 100644..100755
--- a/path.py
+++ b/path.py
diff --git a/render.py b/render.py
index 145f787..8baa3f0 100644..100755
--- a/render.py
+++ b/render.py
@@ -31,6 +31,7 @@ class Renderer(object):
splitLexemes = []
shift = 72
for i, lexeme in enumerate(passage.spelling):
+ # print("\n--",i,lexeme.realization['height'])
pickup = {
'_label': lexeme.label,
'_offsets': [offset for offset in lexeme.realization['feet'][0] if offset < 0],
@@ -97,7 +98,7 @@ class Renderer(object):
# calculate duration of last note accurately
noteEndpoints.append(increment['_nextOffset'])
durations = [ fl(x-y) for y, x in zip(noteEndpoints[:-1], noteEndpoints[1:]) ]
- measure.insert(internalOffset, labels[0])
+ # measure.insert(internalOffset, labels[0])
# subtract from end of increment to find offsets
internalOffset += abs(increment['_duration'])
# special case for pickup bar - use duration including hidden leading rest
@@ -111,6 +112,7 @@ class Renderer(object):
noteOffset = internalOffset+increment['_offsets'][k]
# measure.append(n)
measure.insert(noteOffset, n)
+
# if duration is positive, is station
if increment['_duration'] > 0:
noteEndpoints = copy(increment['_offsets'])
@@ -118,7 +120,7 @@ class Renderer(object):
noteEndpoints.append(abs(increment['_duration']))
durations = [ fl(x-y) for y, x in zip(noteEndpoints[:-1], noteEndpoints[1:]) ]
# add to beginning of increment to find offsets
- measure.insert(internalOffset, labels[1])
+ # measure.insert(internalOffset, labels[1])
for k, duration in enumerate(durations):
n = m21.note.Note()
n.quarterLength = duration
@@ -165,12 +167,13 @@ class Renderer(object):
word_site = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain"
response = requests.get(word_site)
words = response.content.splitlines()
- title = choice(words).decode("utf-8").capitalize()
+ # title = choice(words).decode("utf-8").capitalize()
+ title = ''
return (timestamp, title, date)
def writeLog(self,passage,heading):
""" write log file """
- f = open("/Users/home/Documents/top/shelf/composition/framework/_log/"+heading[0]+"-"+heading[1]+".txt", 'w')
+ f = open("/Users/home/Documents/top/projects/precarity/framework/_log/"+heading[0]+"-"+heading[1]+".txt", 'w')
f.write(str(passage.lexicon))
f.write("\n\n")
f.write(str(passage.tree))
@@ -282,7 +285,7 @@ instruments = {
instrumentRanges = {
- 'violin': 32,
+ 'violin': 30,
'viola': 30,
'cello': 32,
'double bass': 39,
@@ -294,7 +297,7 @@ instrumentRanges = {
'trombone': 32,
'trumpet': 27,
'piccolo': 26,
- 'flute': 32,
+ 'flute': 20,
'alto_flute': 36,
'oboe': 30,
'cor_anglais': 29,
@@ -309,7 +312,7 @@ instrumentRanges = {
'baritone': 32,
'tenor': 32,
'alto': 32,
- 'soprano': 32,
+ 'soprano': 22,
'glockenspiel': 29,
'xylophone': 43,
'vibraphone': 36,
diff --git a/rhythm.py b/rhythm.py
index a17d171..a17d171 100644..100755
--- a/rhythm.py
+++ b/rhythm.py
diff --git a/spec.py b/spec.py
index 05d95aa..d2be4c3 100644..100755
--- a/spec.py
+++ b/spec.py
@@ -1,59 +1,41 @@
from grammar import *
ligatureRules = [
+ # [{
+ # 'span': [2.0],
+ # 'gait': ['double'],
+ # 'foot': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
+ # 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]],
+ # }],
+ # [{
+ # 'span': [3.0, 5.0, 6.0],
+ # 'gait': ['trip_sl', 'trip_ls', 'double'],
+ # 'foot': [[0, 1/2], [0]],
+ # 'sync': [[0]],
+ # }],
[{
- 'span': [0.5, 1.0, 1.5],
- 'gait': ['double'],
- 'foot': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]],
- }],
- [{
- 'span': [0.5, 1.5],
- 'gait': ['double'],
- 'foot': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0]],
- }],
- [{
- 'span': [0.5, 1.5],
- 'gait': ['double'],
- 'foot': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]],
- }],
- [{
- 'span': [0.5, 1.5],
- 'gait': ['double'],
- 'foot': [[0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2], [0], [0]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [1/2], [1/2]],
- }],
- [{
- 'span': [0.5, 1.5],
- 'gait': ['double'],
- 'foot': [[-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0], [0]],
+ 'span': [3.0, 5.0],
+ 'gait': ['double','trip_sl'],
+ 'foot': [[0]],
+ 'sync': [[0]],
}],
[{
'span': [0.5, 1.0],
- 'gait': ['double'],
- 'foot': [[-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0]],
+ 'gait': ['double','trip_sl'],
+ 'foot': [[-1/2, 0, 1/2], [0, 1/2], [0, 1/2], [0, 1/2]],
+ 'sync': [[0]],
}],
[{
'span': [0.5, 1.0],
- 'gait': ['double'],
- 'foot': [[-1/2, 0], [-1/2, 0], [-1/2, 0], [0, 1/2], [0, 1/2]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0], [0], [0]],
+ 'gait': ['double','trip_sl'],
+ 'foot': [[-1/2, 0, 1/2], [0, 1/2]],
+ 'sync': [[0]],
}],
[{
'span': [0.5, 1.0],
- 'gait': ['double'],
- 'foot': [[-1/2, 0], [-1/2, 0], [-1/2, 0], [-1/2, 0]],
- 'sync': [[0], [0], [0], [0], [0], [0], [0], [0]],
- }],
- [{
- 'span': [2.0, 3.0],
- 'gait': ['double'],
- 'foot': [[0],[0]],
- 'sync': [[0,1/2],[0,1/2]],
+ 'gait': ['double','trip_sl'],
+ 'foot': [[-1/2, 0, 1/2], [0, 1/2], [0, 1/2]],
+ 'sync': [[0]],
}],
]
@@ -85,59 +67,51 @@ functionRules = [
#
pathRules = [
+ # {
+ # 'range': [1,2,3],
+ # 'figure': ['saddleDown','spikeDown'],
+ # 'direction': [5],
+ # },
{
- 'range': [1,2,3],
- 'figure': ['saddleUp','spikeUp'],
- 'direction': [-7],
+ 'range': [5,6,7],
+ 'figure': ['decDown','decUp'],
+ 'direction': [0,1,2],
},
{
'range': [1,2,3],
- 'figure': ['saddleDown','spikeDown'],
- 'direction': [5],
+ 'figure': ['sawtooth1Up','sawtooth2Up','sawtooth3Up','sawtooth1Down','sawtooth2Down','sawtooth3Down'],
+ 'direction': [0,1],
},
{
- 'range': [2,3],
- 'figure': ['rampUp','accUp','decUp'],
- 'direction': [-7],
- },
- {
- 'range': [2,3],
- 'figure': ['rampDown','accDown','decDown'],
- 'direction': [5],
- },
- {
- 'range': [1,3,4,7,11,18],
- 'figure': ['sawtooth2Up','sawtooth2Down','sawtooth3Up','sawtooth3Down','zigZagUp','zigZagDown'],
- 'direction': [-1],
+ 'range': [1,2,4,5],
+ 'figure': ['zigZagUp','zigZagDown'],
+ 'direction': [0,1],
},
]
+
anticipationRules = [
+ # ['transposition', 'ligature'],
+ ['address','address'],
['transposition', 'ligature'],
- ['address', 'direction'],
- ['range', 'figure'],
- ['figure', 'address'],
- ['direction', 'transposition'],
- ['ligature'],
+ ['transposition', 'span'],
+ ['gait','transposition'],
+ ['figure'],
]
-
-
-
prolongationRules = [
- ['transposition', 'ligature'],
- ['address', 'transposition'],
- ['range', 'figure'],
- ['figure', 'range'],
- ['direction', 'direction'],
- ['ligature', 'address'],
- ['direction', 'ligature'],
- ['transposition', 'figure'],
- ['figure', 'direction'],
- ['ligature', 'transposition'],
- ['address', 'address'],
- ['ligature'],
+ ['transposition', 'transposition'],
+ ['gait', 'gait'],
+ ['gait', 'ligature'],
+ ['transposition', 'span'],
+ ['sync'],
+ # ['ligature', 'address'],
+ # ['direction', 'ligature'],
+ # ['transposition', 'figure'],
+ # ['figure', 'figure'],
+ # ['ligature', 'transposition'],
+ # ['figure'],
]
# as patient - (yield, check, ask) # ([default] adopt given features, refuse given features, request features
@@ -147,8 +121,6 @@ prolongationRules = [
'''
# need something like
projectionRules = {
-
-
# produces less uniformity
'check': [],
# produces local uniformity (inflection)
@@ -157,7 +129,6 @@ projectionRules = {
# produces global uniformity
'project': [],
'inject': [],
-
}
'''
diff --git a/utils.py b/utils.py
index ac98f8a..ac98f8a 100644..100755
--- a/utils.py
+++ b/utils.py