spiffyscore

Check-in [299ddec90e]
Login
Overview
SHA1:299ddec90ea4a6b715fcf35f5cab8108c6fbaca7
Date: 2011-09-13 18:28:11
User: brian
Comment:[Broken] Trying to get the tree structuse working
Timelines: family | ancestors | tree
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2011-09-13
18:28
[299ddec90e] Closed-Leaf: [Broken] Trying to get the tree structuse working (user: brian, tags: tree)
2011-06-12
20:32
[60bf1cfb19] Made some changes to the parser. Don't remember what. (user: brian, tags: tree)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified cfg.py from [3cbe823f2f] to [967482cdda].

     1      1   #!/usr/bin/env python
     2      2   
     3      3   from __future__ import division
     4      4   import os
            5  +import pdb
     5      6   import random
     6      7   import sys
     7      8   import time
     8      9   random.seed(time.time())
     9     10   
    10     11   import parse
    11     12   import topsort
    12     13   import yaml
           14  +
           15  +from tree import *
    13     16   
    14     17   def main():
    15     18       key = "A"
    16     19       bps = 60/60
    17     20       tempo = 1/bps
    18     21       max_duration = 1
    19     22   
    20     23       composition = yaml.load(open("score.yaml"))
    21     24   
    22     25       max_t = 0  # max time encountered so far. Used for movement timing
    23     26       progression = "chorus"
           27  +    timeline = {}
    24     28   
    25     29       for movement in progression.split():
    26     30           for section in ["intro", "core", "outro"]:
    27     31               if section in composition[movement].keys():
    28     32                   try:
    29     33                       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]])
    30     34                   except topsort.CycleError as ex:
................................................................................
    38     42                       grammars = composition[movement][section][instrument]["grammars"]
    39     43                       for grammar in grammars:
    40     44                           if isinstance(grammars[grammar], list):
    41     45                               for option in range(len(grammar)):
    42     46                                   grammars[grammar][option] = parse.parse(grammars[grammar][option])
    43     47                           else:
    44     48                               grammars[grammar] = parse.parse(grammars[grammar])
    45         -                    print instrument, movement, section
           49  +                    print section, movement, instrument
    46     50                       print grammars
           51  +                    for grammar in grammars:
           52  +                        t = Tree()
           53  +                        pdb.set_trace()
           54  +                        while reduce(lambda x, y: x+y, [node.time for node in t.traverse_depth_first()]) < instrument["max_duration"]:
           55  +                            pass
           56  +                        timeline[movement][section][instrument] = Tree()
    47     57   
    48     58   
    49     59   def generate_score_phrase(grammar, grammars):
    50         -    count_length = 
    51         -    while count_length < 100000:
           60  +#    count_length = 
           61  +#    while count_length < 100000:
    52     62       
    53     63   
    54     64                   
    55     65   
    56     66   #    for comp_name in progression.split():
    57     67   #        comp_start_time = max_t
    58     68   #        for instr_name, instr in composition[comp_name].iteritems():