Example #1
0
    def _generate_phrase(self, phrase_id):
        phrase= []
        actual_phrase_length= 0
        phrase_length= self.ec.phrase_length
        input= AcumulatedInput()
        input.phrase_id= phrase_id

        first_start= None
        while actual_phrase_length < phrase_length:
            result= PartialChord()
            self.chord_maker.next(input, result, [])
            chord= result.finish()

            if first_start is None: first_start= chord.start

            chord.start-= first_start
            
            phrase.append(chord)
            actual_phrase_length+= chord.duration

        if phrase[-1].end > phrase_length:
            phrase[-1].duration= phrase_length-phrase[-1].start
        
        return phrase