Esempio n. 1
0
    def get_Note(
        self,
        string=0,
        fret=0,
        maxfret=24,
        ):
        """Returns the Note on `string`, `fret`. Throws a RangeError if either the \
fret or string is unplayable.
{{{
>>> t = tunings.StringTuning(\"test\", \"test\", ['A-3', 'A-4'])
>>> t,get_Note(0, 0)
'A-3'
>>> t.get_Note(0, 1)
'A#-3'
>>> t.get_Note(1, 0)
'A-4'
}}}"""

        if 0 <= string < self.count_strings():
            if 0 <= fret <= maxfret:
                s = self.tuning[string]
                if type(s) == list:
                    s = s[0]
                n = Note(int(s) + fret)
                n.string = string
                n.fret = fret
                return n
            else:
                raise RangeError, "Fret '%d' on string '%d' is out of range"\
                     % (string, fret)
        else:
            raise RangeError, "String '%d' out of range" % string
Esempio n. 2
0
    def get_Note(
        self,
        string=0,
        fret=0,
        maxfret=24,
        ):
        """Returns the Note on `string`, `fret`. Throws a RangeError if either the \
fret or string is unplayable.
{{{
>>> t = tunings.StringTuning(\"test\", \"test\", ['A-3', 'A-4'])
>>> t,get_Note(0, 0)
'A-3'
>>> t.get_Note(0, 1)
'A#-3'
>>> t.get_Note(1, 0)
'A-4'
}}}"""

        if 0 <= string < self.count_strings():
            if 0 <= fret <= maxfret:
                s = self.tuning[string]
                if type(s) == list:
                    s = s[0]
                n = Note(int(s) + fret)
                n.string = string
                n.fret = fret
                return n
            else:
                raise RangeError("Fret '%d' on string '%d' is out of range"\
                     % (string, fret))
        else:
            raise RangeError("String '%d' out of range" % string)