def __init__(self, nseq_name, nseq_temp, nseq_posn, nseq_nat_posns, nseq_modes=[]): """ Arguments: nseq_name: name of scale. nseq_temp: temperament for scale. nseq_posn: position of notes in scale. nseq_nat_posns: natural note positions for notes in scales. nseq_modes: a sequence of modes for the scale, listed in order of position. """ if not nseq_modes: noteseq.__init__(self, nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns) return noteseq.__init__(self, nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns, "", [nseq_modes[0]]) new_nseq_pos = nseq_posn new_nseq_nat_pos = nseq_nat_posns # This creates more instances of noteseq_scales - all for the different modes. # By creating them, they will be automatically connected to the appropriate # temperament's dictionary. for i in range(1, len(nseq_posn)): new_nseq_pos = rotate_and_zero(new_nseq_pos, 1, nseq_temp.no_keys) new_nseq_nat_pos = rotate_and_zero(new_nseq_nat_pos, 1, nseq_temp.no_nat_keys) OurNewScale = noteseq_scale(nseq_modes[i], nseq_temp, new_nseq_pos, new_nseq_nat_pos)
def __init__(self, nseq_name, nseq_temp, nseq_posn, nseq_nat_posns, nseq_modes = []): """ Arguments: nseq_name: name of scale. nseq_temp: temperament for scale. nseq_posn: position of notes in scale. nseq_nat_posns: natural note positions for notes in scales. nseq_modes: a sequence of modes for the scale, listed in order of position. """ if not nseq_modes: noteseq.__init__(self, nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns); return; noteseq.__init__(self, nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns, "", [nseq_modes[0]]); new_nseq_pos = nseq_posn; new_nseq_nat_pos = nseq_nat_posns; # This creates more instances of noteseq_scales - all for the different modes. # By creating them, they will be automatically connected to the appropriate # temperament's dictionary. for i in range(1, len(nseq_posn)): new_nseq_pos = rotate_and_zero(new_nseq_pos, 1, nseq_temp.no_keys); new_nseq_nat_pos = rotate_and_zero(new_nseq_nat_pos, 1, nseq_temp.no_nat_keys); OurNewScale = noteseq_scale(nseq_modes[i], nseq_temp, new_nseq_pos, new_nseq_nat_pos);
def get_posn_for_offset(self, rotate_by=0, slice=None, raz = False): """ For this noteseq, output its positions relative to its first note, then rotates the sequence (by rotate_by), then slices it (using slice, if not none). If and only if raz is True, the result is rotated-and-zeroed. """ if slice: modulus = self.nseq_temp.no_nat_keys; multisliced = multislice(self.nseq_posn, slice, offset=rotate_by, mod = modulus); if raz: return rotate_and_zero(multisliced, 0, self.nseq_temp.no_keys); else: return multisliced; else: if raz: return rotate_and_zero(self.nseq_posn, rotate_by, self.nseq_temp.no_keys); else: return rotate(self.nseq_posn, rotate_by);
def get_posn_for_offset(self, rotate_by=0, slice=None, raz=False): """ For this noteseq, output its positions relative to its first note, then rotates the sequence (by rotate_by), then slices it (using slice, if not none). If and only if raz is True, the result is rotated-and-zeroed. """ if slice: modulus = self.nseq_temp.no_nat_keys multisliced = multislice(self.nseq_posn, slice, offset=rotate_by, mod=modulus) if raz: return rotate_and_zero(multisliced, 0, self.nseq_temp.no_keys) else: return multisliced else: if raz: return rotate_and_zero(self.nseq_posn, rotate_by, self.nseq_temp.no_keys) else: return rotate(self.nseq_posn, rotate_by)