Overview
| Comment: | Now prints csound code, both notes and chords, replicating the functionality of the original Minimaly Functional Version |
|---|---|
| Timelines: | family | ancestors | descendants | both | ply |
| Files: | files | file ages | folders |
| SHA1: |
9bd31df856f40277a57e58faef14e0b9 |
| User & Date: | spiffytech@gmail.com on 2010-11-16 18:37:14.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2010-11-16
| ||
| 19:15 | Added todo list Leaf check-in: 3d4ddcbab5 user: spiffytech@gmail.com tags: ply | |
| 18:37 | Now prints csound code, both notes and chords, replicating the functionality of the original Minimaly Functional Version check-in: 9bd31df856 user: spiffytech@gmail.com tags: ply | |
| 16:36 | Now parses chord length check-in: 4aeb057ae0 user: spiffytech@gmail.com tags: ply | |
Changes
Modified cfg.py
from [df0a6863be]
to [8e359b2146].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 | + - + - + + |
#!/usr/bin/env python
import os
import random
import sys
import time
random.seed(time.time())
import parse
def main():
key = "A"
note_grammars = {
"u": ["I V V V I I IV u u", "I IV u u", "I VII IV u u" , "e"],
"e": [""],
}
chord_grammars = {
|
| ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + + + - - + + - + - + - - + + - - + + - + |
while 1:
found_substitution = False
for key,value in grammars.iteritems():
if score.find(key) != -1:
found_substitution = True
while score.find(key) != -1:
score = score.replace(key, random.choice(grammars[key]), 1)
if len(score) > 200:
score = score.replace("u", "")
score = score.replace("e", "")
return score
if found_substitution is False:
break
return score
def transliterate_score(score, key, chords=False):
scale = make_scale(key)
scale_conversion = {
"I": 1,
"II": 2,
"III": 3,
"IV": 4,
"V": 5,
"VI": 6,
"VII": 7,
"VIII": 8,
}
keyed_score = []
if chords is False:
|
Modified parse.py
from [8130e10658]
to [503badc6f2].
1 2 3 | 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - + + + + - - + + | #!/usr/bin/env python from ply import lex, yacc |