summaryrefslogtreecommitdiff
path: root/main.py
blob: 23e7d39ff20ed4c69d3b4d8a0ab33cb378175546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from phonology import *
from diagram import *


'''
modules:

cadence.py		define musical morphemes
projection.py	dependencies and agreement
				antecedent or consequent cadence bundled with prolongation rules for each feature - (dominates) or (dominates, agrees) or (dominates, agrees, submits)
				(1)==Head; (0)==Complement; (1,0)==XP; (1,1)==XBar; (0,1)==X; (0,0)==None; 

diagram.py		define binary tree structures
phonology.py	distribution of cadential features for given grammar
lexicon.py		repository of lexemes: (cadence, dependencies, prolongation)
passage.py		lexemes unified over tree diagram
	spellout()	sequence of unified cadences in passage (for each voice)
score.py 		list of n passages rendered to music21 score object
	export()	to xml, midi, ly

'''

phonology = Phonology()

phonology.addFootprintRule([{
	'span': [2],
	'gait': ['double','triple'],
	'foot': [[-1/2, 0, 1/2]],
	'step': [[0, 1/2], [0, 1/2], [0, 1/2]],
}])
phonology.addFunctionRule({
	'address': ['A1','B1'],
	'transposition': [-1,0,1],
})
phonology.addPathRule({
	'range': [2,3,4],
	'figure': ['rampUp', 'rampDown'],
	'tilt': ['float', 'dive'],
})

morphology = Morphology()
morphology.addAnticipationRule(['footprint'])
morphology.addAnticipationRule(['tilt'])
morphology.addAnticipationRule([])
morphology.addProlongationRule(['address','transposition'])
morphology.addProlongationRule(['address'])
morphology.addProlongationRule(['figure','range'])
morphology.addProlongationRule(['range'])
morphology.addProlongationRule(['range','tilt'])



# lexicon.addCategory()

phonology.print()
morphology.print()

lexeme = phonology.makeCadence(label=1)
lexeme.print()

syntax = Diagram()
syntax.print()