예제 #1
0
파일: Tuning.py 프로젝트: jdavancens/abjad
    def get_pitch_ranges_by_string_number(self, string_number):
        r'''Gets tuning pitch ranges by string number.

        ..  container:: example

            **Example 1.** Violin tuning:

            ::

                >>> tuning = indicatortools.Tuning(('G3', 'D4', 'A4', 'E5'))
                >>> string_number = indicatortools.StringNumber((2, 3))
                >>> tuning.get_pitch_ranges_by_string_number(string_number)
                (PitchRange(range_string='[A4, A6]'), PitchRange(range_string='[D4, D6]'))

        Returns pitch ranges.
        '''
        from abjad.tools import indicatortools
        string_number = indicatortools.StringNumber(string_number)
        pitch_ranges = self.pitch_ranges
        result = []
        for number in string_number.numbers:
            index = -number
            pitch_range = pitch_ranges[index]
            result.append(pitch_range)
        return tuple(result)
예제 #2
0
    def get_pitches_by_string_number(self, string_number):
        r'''Gets tuning pitches by string number.

        ::

            >>> tuning = indicatortools.Tuning(('G3', 'D4', 'A4', 'E5'))
            >>> string_number = indicatortools.StringNumber((2, 3))
            >>> tuning.get_pitches_by_string_number(string_number)
            (NamedPitch("a'"), NamedPitch("d'"))

        Returns named pitches.
        '''
        from abjad.tools import indicatortools
        string_number = indicatortools.StringNumber(string_number)
        result = []
        for number in string_number.numbers:
            index = -number
            pitch = self.pitches[index]
            result.append(pitch)
        return tuple(result)