Overview
Comment: | Program generates a render order for the instruments based on their sync order |
---|---|
Timelines: | family | ancestors | descendants | both | master |
Files: | files | file ages | folders |
SHA1: |
689adc054e647b134f3ebf9291e5c2b4 |
User & Date: | brian@linux-85dd.site on 2011-02-10 23:50:20.000 |
Other Links: | branch diff | manifest | tags |
Context
2011-06-12
| ||
20:32 | Made some changes to the parser. Don't remember what. Leaf check-in: 87435601e4 user: brian tags: master | |
20:31 | Create new branch named "develop" check-in: 9f4c4666c5 user: brian tags: develop | |
2011-02-10
| ||
23:50 | Program generates a render order for the instruments based on their sync order check-in: 689adc054e user: brian@linux-85dd.site tags: master | |
22:34 | Added lexical support for parens instead of quotes for chords, cleaned up the yacc parser, added lex tokens for syncopation check-in: 702d933446 user: brian@linux-85dd.site tags: master | |
Changes
Modified cfg.py
from [82bf7ad059]
to [e9b556b4f3].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/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 | > > > | < < < < < < < < < < < < < < < < < < < < < | > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | 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 import topsort import yaml def main(): key = "A" bps = 60/60 tempo = 1/bps max_duration = 1 composition = yaml.load(open("score.yaml")) max_t = 0 # max time encountered so far. Used for movement timing progression = "chorus" for movement in progression.split(): for section in ["intro", "core", "outro"]: if section in composition[movement].keys(): try: render_order = topsort.topsort([[composition[movement][section][instrument]["sync"], instrument] if "sync" in composition[movement][section][instrument].keys() else [None, instrument] for instrument in composition[movement][section]]) except topsort.CycleError as ex: print "Your instruments are synced in a circle! This makes no sense!" print movement, section print ex sys.exit(1) # for comp_name in progression.split(): # comp_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 ## print generated_score # score = parse.parse(generated_score, default_octave=instr["octave"]) # Return Node/Chord objects # # # Generate timestamps for the notes # t = comp_start_time # for note in range(len(score)): # score[note].time = t # score[note].duration *= tempo # t += score[note].duration ## print "time difference =", t-comp_start_time ## print "instrument duration =",composition[comp_name][instr_name]["duration"] # if (t-comp_start_time) > float(composition[comp_name][instr_name]["duration"]): ## print "here" # score = score[:note] # break # 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 f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08 f3 0 1025 10 1 ''' for comp_name in progression.split(): |
︙ | ︙ |
Added rad_util.py version [99f93e22cf].
Added topsort.py version [810c677434].