spiffyscore

Check-in [2ae36c6e68]
Login
Overview
Comment:Program no longer cuts out a note from the score each time it adds a new phrase to the score
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1: 2ae36c6e683319943f0b14e889bb5aa74f7f7dc0
User & Date: brian on 2011-10-20 20:01:33
Original Comment: Program no longer cuts out an note from the score each time it adds a new phrase in.
Other Links: branch diff | manifest | tags
Context
2011-11-01
18:52
Added a sampled double bass, modified the program to respond to an instrument's specified octave check-in: eb81d5f9fd user: brian tags: develop
2011-10-20
20:01
Program no longer cuts out a note from the score each time it adds a new phrase to the score check-in: 2ae36c6e68 user: brian tags: develop
19:56
Program now chooses consistent nodes based on what's specified in the grammar. A couple other bugs are still present. check-in: a9e60898b7 user: brian tags: develop
Changes

Modified cfg.py from [9313c52f09] to [3a0a8776ca].

185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                if isinstance(score[item], tree.Tree):  # Also, make this use the find_next_node() function (or whatever I called it)
                    score_index_to_replace = item
            if score_index_to_replace is None:
                raise ValueError("No more nodes to fill in")

            time_remaining = max_time - score_len(score)
            new_phrase, syncs = choose_phrase(instr, syncs, score_len(score), time_remaining, score)
            score = score[:score_index_to_replace-1] + new_phrase + score[score_index_to_replace+1:]

    except ValueError:
        return (score, syncs)


def choose_phrase(instr, syncs, current_time, time_remaining, score):
    '''Filters grammars for ones that match the sync option, and phrases that fit the time remaining in the score'''







|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                if isinstance(score[item], tree.Tree):  # Also, make this use the find_next_node() function (or whatever I called it)
                    score_index_to_replace = item
            if score_index_to_replace is None:
                raise ValueError("No more nodes to fill in")

            time_remaining = max_time - score_len(score)
            new_phrase, syncs = choose_phrase(instr, syncs, score_len(score), time_remaining, score)
            score = score[:score_index_to_replace] + new_phrase + score[score_index_to_replace+1:]

    except ValueError:
        return (score, syncs)


def choose_phrase(instr, syncs, current_time, time_remaining, score):
    '''Filters grammars for ones that match the sync option, and phrases that fit the time remaining in the score'''