Changes In Branch master Through [e6bf0dbf82] Excluding Merge-Ins
This is equivalent to a diff from aa88358397 to e6bf0dbf82
2010-11-18
| ||
03:10 | Can now set an instrument's default octave beside the instrument's score check-in: ff85cece1d user: spiffytech@gmail.com tags: master | |
03:04 | Bug: octave modifiers (,') were acting as (up,down) not (down,up) check-in: e6bf0dbf82 user: spiffytech@gmail.com tags: master | |
2010-11-17
| ||
07:45 | Only print f-tables once check-in: 7b40d5d489 user: spiffytech@gmail.com tags: master | |
07:42 | csound score lines are no longer hardcoded, but are stored with each instrument check-in: b8d35587a4 user: spiffytech@gmail.com tags: master | |
07:34 | WIP on tld: 4b95fed Added support for rest notes Leaf check-in: ec61af8387 user: spiffytech@gmail.com tags: stash | |
07:34 | index on tld: 4b95fed Added support for rest notes check-in: ef35a8e9e0 user: spiffytech@gmail.com tags: stash | |
07:30 | Added support for rest notes Closed-Leaf check-in: aa88358397 user: spiffytech@gmail.com tags: tld | |
06:57 | Note duration is now counted as fraction of a whole note, as measured based on BPM check-in: 5a35ffdd27 user: spiffytech@gmail.com tags: tld | |
Modified cfg.py from [08a2f25157] to [2306af4935].
1 2 3 4 5 6 7 8 9 10 11 12 | #!/usr/bin/env python from __future__ import division import os import random import sys import time random.seed(time.time()) import parse def main(): key = "A" | | < | < < < < < < < | < < < < < < < < | < < < < < < < < < < | | < < < | < < < < < < < | | < < < > > > < | | 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 | #!/usr/bin/env python from __future__ import division import os import random import sys import time random.seed(time.time()) import parse def main(): key = "A" bps = 60/60 tempo = 1/bps max_duration = 1 composition = { "a": { # Movement block 'a' for reuse throughout the piece "bassline": { # Instrument 'melody' "score_line": "i1 %(time)f %(duration)f 10000 %(octave)d.%(note)s", "octave": 6, "grammars": { # Notes for this instrument to use in this piece "u": ["I,/2 z/2 I,/2 z/2 I,/2 z/2 V,/2 z/2 u u", "e"], "e": [""], }, "score": "u u u u u", }, }, } max_t = 0 # max time encountered so far. Used for movement timing progression = "a" for comp_name in progression.split(): instr_start_time = max_t for instr_name, instr in composition[comp_name].iteritems(): generated_score = generate_score(instr["score"], instr["grammars"]) # Fill in the scores by generating them based on the grammars score = parse.parse(generated_score, default_octave=instr["octave"]) # Return Node/Chord objects # Generate timestamps for the notes t = instr_start_time for note in range(len(score)): score[note].time = t score[note].duration *= tempo t += score[note].duration max_t = t if t > max_t else max_t composition[comp_name][instr_name]["score"] = score # Must be done after all note times keyed in, else you can't coordinate melodies with the rhythm chords print "f1 0 512 10 1" # print "f1 0 513 9 1 1 0 3 .33 180 5 .2 0 7 .143 180 9 .111 0" # print "f2 0 8192 10 .24 .64 .88 .76 ,96 .5 .24 .08" for comp_name in progression.split(): for instr_name, instr in composition[comp_name].iteritems(): composition[comp_name][instr_name]["score"] = transliterate_score(composition[comp_name][instr_name]["score"], key) # print "\nMovement %s instrument %s" % (comp_name, instr_name) # print composition[comp_name][instr_name]["score"] final_score = generate_csound_score(composition[comp_name][instr_name]["score"], composition[comp_name][instr_name]["score_line"]) for line in final_score: print line def make_scale(key): notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"] scale = [key] |
︙ | ︙ | |||
150 151 152 153 154 155 156 | chord.append(scale[(root_note_index+5) % 8]) score[i].chord = chord elif isinstance(score[i], parse.Rest): pass return score | | | > > | | 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 139 140 141 142 143 144 145 146 147 148 149 | chord.append(scale[(root_note_index+5) % 8]) score[i].chord = chord elif isinstance(score[i], parse.Rest): pass return score def generate_csound_score(score, score_line): csound_note_values = { "C": "00", "C#": "01", "D": "02", "D#": "03", "E": "04", "F": "05", "F#": "06", "G": "07", "G#": "08", "A": "09", "A#": "10", "B": "11", } csound_score = [] for token in score: if isinstance(token, parse.Chord): # Chords for note in token.chord: note = csound_note_values[note] # csound_score.append("i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6" % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) csound_score.append(score_line % {"time": token.time, "octave": random.choice([7,8]), "note": note, "duration": token.duration}) elif isinstance(token, parse.Note): # Individual notes note = csound_note_values[token.value] csound_score.append(score_line % {"time": token.time, "octave": token.octave, "note": note, "duration": token.duration}) # csound_score.append("i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6" % {"time": token.time, "octave": random.choice([8,9]), "note": note, "duration": token.duration}) return csound_score if __name__ == "__main__": main() |
Modified parse.py from [3a88b8ab43] to [40393160ad].
︙ | ︙ | |||
22 23 24 25 26 27 28 | class Rest(): def __init__(self, duration=.25): self.duration = duration def __repr__(self): return "Rest node %s" % self.duration | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | class Rest(): def __init__(self, duration=.25): self.duration = duration def __repr__(self): return "Rest node %s" % self.duration def parse(score, default_octave=8): # Tokenize (lex) tokens = ( "NOTE_LENGTH", "BASENOTE", "ACCIDENTAL", "REST", "OCTAVE", |
︙ | ︙ | |||
126 127 128 129 130 131 132 | p[2].accidental = p[1] p[0] = p[2] def p_octave(p): '''pitch : pitch OCTAVE ''' count = len(p[2]) | | > | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | p[2].accidental = p[1] p[0] = p[2] def p_octave(p): '''pitch : pitch OCTAVE ''' count = len(p[2]) increment_or_decrement = 1 if p[2][0] == "'" else -1 print "octave=", default_octave octave = default_octave + (count * increment_or_decrement) p[1].octave = octave p[0] = p[1] def p_pitch(p): '''pitch : BASENOTE ''' p[0] = Note(p[1]) |
︙ | ︙ |
Modified test.orc from [a26a1f1a08] to [ca3bb46446].
|
| > > > > > > > | > | | | > > > | | > > | > > | > > > | > > > > > > > > | > | | > | > > | | 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 | ; ************************************************************************ ; ACCCI: 40_03_1.ORC ; synthesis: Waveshaping(40) ; Waveshaper Using Ring Modulation(03) ; source: Dodge (p.145, 1985) ; coded: jpg 8/93 sr = 44100 kr = 441 ksmps= 100 nchnls =2 instr 1; ***************************************************************** idur = p3 iamp = p4 ifq = cpspch(p5) a1 oscili iamp, 1/idur, 1 ; envelope a2 oscili a1, ifq, 1 ; sinus of ring modulation a3 linseg 1, .04, 0, idur-.04, 0 ; very short envelope a4 oscili a3, ifq*.7071, 1 ; sinus for waveshaper ; inline code for transfer function: ; f(x) = 1 + .841x - .707x**2 - .595x**3 + .5x**4 + .42x**5 - ; .354x**6 - .279x**7 + .25x**8 + .21x**9 a5 = a4*a4 a6 = a5*a4 a7 = a5*a5 a8 = a7*a4 a9 = a6*a6 a10 = a9*a4 a11 = a10*a4 a12 = a11*a4 ; This is the polynomial representation of the transfer function a13=1+.841*a4-.707*a5-.595*a6+.5*a7+.42*a8-.354*a9-.297*a10+.25*a11+.21*a12 a14 = a13*a2 ; ring modulation outs a14,a14 endin |
Modified test.sco from [dabc4744e4] to [c2061b1574].
|
| < | > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < | 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 | octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 octave= 6 f1 0 512 10 1 i1 0.000000 0.500000 10000 5.09 i1 1.000000 0.500000 10000 5.09 i1 2.000000 0.500000 10000 5.09 i1 3.000000 0.500000 10000 5.04 i1 4.000000 0.500000 10000 5.09 i1 5.000000 0.500000 10000 5.09 i1 6.000000 0.500000 10000 5.09 i1 7.000000 0.500000 10000 5.04 i1 8.000000 0.500000 10000 5.09 i1 9.000000 0.500000 10000 5.09 i1 10.000000 0.500000 10000 5.09 i1 11.000000 0.500000 10000 5.04 i1 12.000000 0.500000 10000 5.09 i1 13.000000 0.500000 10000 5.09 i1 14.000000 0.500000 10000 5.09 i1 15.000000 0.500000 10000 5.04 |
Modified todo.org from [109f37c970] to [f88a59ddf7].
|
| | | > | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Features [2/9] - [X] Top-down composition - [ ] Coordinate the melody and rhythm - [ ] Set maximum song length of movement - [ ] Set minimum song length of movement - [ ] Get all tracks to end at the same time - [ ] Need to support all chord types - [X] Doesn't handle rest notes - [ ] Handle full ABC BNF (yeah, right...) - [ ] Set instrument octave in score file * Bugs [4/5] - [X] TLD resets clock for each movement - [X] TLD doesn't accept an ordering for the movements - [X] Doesn't handle minor chords - [X] Calculated duration is absolute, not relative to BPM - [ ] Chords don't respect octaves * Structure [1/3] - [ ] Chords should be composed of Notes, not ordinary arrays - [ ] Generate score with proper generation tools - [X] Store csound score lines with instruments |