Exemple #1
0
 def __init__(self, not_equal_notes):
     """
     
     :param not_equal_notes: 
     """
     AbstractConstraint.__init__(self, not_equal_notes)
     if len(not_equal_notes) <= 1:
         raise Exception('NotEqualNotePolicy must have two or more v-notes.')
Exemple #2
0
 def __init__(self, equal_notes):
     """
     Constructor
     :param equal_notes: list of all v_notes that map to notes, mapped notes all same pitch.
     """
     AbstractConstraint.__init__(self, equal_notes)
     if len(equal_notes) <= 1:
         raise Exception('EqualNotePolicy must have two or v-more notes.')
Exemple #3
0
    def __init__(self, actor_note, pitches):
        """
        Constructor.
        :param actor_note:  note as actor for this constraint.
        :param pitches: list of pitches
        """
        AbstractConstraint.__init__(self, [actor_note])

        self.__pitches = list(pitches)
    def __init__(self, range_notes, pitch_range):
        """
        Constructor
        :param range_notes: list of all v_notes, map notes all same pitch range.
        :param pitch_range:
        """
        AbstractConstraint.__init__(self, range_notes)

        self._pitch_range = pitch_range
Exemple #5
0
    def __init__(self, actor_note, pitch):
        """
        Constructor.
        :param actor_note:  Note as actor for this constraint.
        :param pitch:
        """
        AbstractConstraint.__init__(self, [actor_note])

        self.__pitch = pitch
    def __init__(self, actor_note):
        """
        Constructor.
        :param actor_note: single note or list with one note
        """
        if actor_note is None:
            raise Exception('ChordalPitchConstraint requires a note actor.')
        actor = actor_note[0] if isinstance(actor_note, list) else actor_note

        AbstractConstraint.__init__(self, [actor])
    def __init__(self, note_one, note_two, comparative):
        """
        Constructor.  Note: 'note_one rel note_two'.
        :param note_one: 
        :param note_two: 
        :param comparative: 
        """
        AbstractConstraint.__init__(self, [note_one, note_two])

        self._comparative = comparative
    def __init__(self, actor_note, tone):
        """
        Constructor.
        :param actor_note: Note
        :param tone: DiatonicTone
        """

        AbstractConstraint.__init__(self, [actor_note])

        self._tone = tone
    def __init__(self, note, scalar_roles=None):
        '''
        Constraint constuctor.
        :param note: Actor affected by constraint.
        :param scalar_roles: List of integer indices to tones in the current tonality, to which the actor must conform.
        '''
        AbstractConstraint.__init__(self, [note])
        if scalar_roles is None:
            scalar_roles = list()

        self.__scalar_notes = list(scalar_roles)
Exemple #10
0
    def __init__(self, note_one, note_two, up_interval, down_interval):
        """
        
        :param note_one: 
        :param note_two: 
        :param up_interval: 
        :param down_interval: 
        """
        AbstractConstraint.__init__(self, [note_one, note_two])

        self._up_interval = up_interval
        self._down_interval = down_interval
Exemple #11
0
    def __init__(self, note_one, note_two, n_steps=1, up_down=UP):
        """
        Constructor
        :param note_one: The proxy note for the first note
        :param note_two: The proxy note for the second note
        :param n_steps: Positive number, number of steps
        :param up_down: UP (True) or DOWN (False)
        """
        AbstractConstraint.__init__(self, [note_one, note_two])

        self._n_steps = n_steps
        self._up_down = up_down
Exemple #12
0
    def __init__(self, note_sequence, variance_list):
        """
        Constructor.
        :param note_sequence: list of v_notes that vary in sequence by a number of diatonic steps.
        :param variance_list:  list of numbers representing variances.
        Note: len(variance_list) = len(note_sequence) - 1
        """
        AbstractConstraint.__init__(self, note_sequence)
        if len(note_sequence) <= 1:
            raise Exception('StepSequencePolicy must have two or v-more notes.')
        if len(note_sequence) - 1 != len(variance_list):
            raise Exception("Illegan size for variance list")

        self._variance_list = variance_list
    def __init__(self, actor, beats_or_bt):
        """
        Constructor.
        :param actor: Note
        :param beats_or_bt: int or list of int's for beat specification (origin 0) or a BeatType
        """
        self.__beat_ids = None
        self.__beat_type = None
        if isinstance(beats_or_bt, int):
            self.__beat_ids = [beats_or_bt]
        elif isinstance(beats_or_bt, list):
            self.__beat_ids = list(beats_or_bt)
        elif isinstance(beats_or_bt, BeatType):
            self.__beat_type = beats_or_bt

        AbstractConstraint.__init__(self, [actor])
Exemple #14
0
    def __init__(self, actor_note, pitch_function, tempo_sequence, ts_sequence):
        """
        Constructor
        :param actor_note: Note
        :param pitch_function: FunctionPitchRange
        :param tempo_sequence: TempoEventSequence
        :param ts_sequence: EventSequence
        """
        AbstractConstraint.__init__(self, [actor_note])

        self.__pitch_function = pitch_function
        self.__tempo_sequence = tempo_sequence
        self.__ts_sequence = ts_sequence

        self.note_position = self.actor_note.get_absolute_position()
        # value of function at this position.
        self.function_value = self.pitch_function.eval_as_chromatic_distance(self.note_position.position)
    def __init__(self, note_one, note_two, lower_steps, upper_steps):
        """
        Constructor.
        :param note_one: 
        :param note_two: 
        :param lower_steps: Number of 'note two' tonality steps below lower match.
        :param upper_steps: Number of 'note two' tonality steps above upper match.
        """
        AbstractConstraint.__init__(self, [note_one, note_two])

        if lower_steps > upper_steps:
            raise Exception(
                'Relative steps require first arg {0} <= second {1}.'.format(
                    lower_steps, upper_steps))

        self._lower_steps = lower_steps
        self._upper_steps = upper_steps