pysynth/wrappers/mml.py
def read_length(self):

        """
        Reads the length of an arbitrary item,
        be it a note, rest, chord, ect.

        We assume our current index is the item(or end of the item)
        we wish to figure out the length of.

        We will continue to read values and push the seeker forward
        until we find no more integers.
        We also handle doted notes!

        We return the length of the note, 1 for whole, 2 for half, 4 for quarter, ect.

        :return: length of the value we are currently on
        :rtype: int
        """

        # Lets get the note length:

        length = self._read_ints()

        # Check if source is dot:

        last = 1
        final = 0

        while True:

            if self.source.peek() == '.':

                # We have a dotted note, let's add 0.5 to our value:

                self.source.forward()

                last = last * 0.5
                final += last

                continue

            break

        length = length + final if length else self.default_length + final

        # We are done, let's return:

        return length if length else self.default_length

        Reads the length of an arbitrary item,
        be it a note, rest, chord, ect.

        We assume our current index is the item(or end of the item)
        we wish to figure out the length of.

        We will continue to read values and push the seeker forward
        until we find no more integers.
        We also handle doted notes!

        We return the length of the note, 1 for whole, 2 for half, 4 for quarter, ect.

        :return: length of the value we are currently on
        :rtype: int
        
Reads the length of an arbitrary item,
be it a note, rest, chord, ect.

We assume our current index is the item(or end of the item)
we wish to figure out the length of.

We will continue to read values and push the seeker forward
until we find no more integers.
We also handle doted notes!

We return the length of the note, 1 for whole, 2 for half, 4 for quarter, ect.
Reads the length of an arbitrary item be it a note rest chord ect . We assume our current index is the item ( or end of the item ) we wish to figure out the length of . We will continue to read values and push the seeker forward until we find no more integers . We also handle doted notes! We return the length of the note 1 for whole 2 for half 4 for quarter ect .
def read_length(self):
        length = self._read_ints()
        last = 1
        final = 0
        while True:
            if self.source.peek() == '.':
                self.source.forward()
                last = last * 0.5
                final += last
                continue
            break
        length = length + final if length else self.default_length + final
        return length if length else self.default_length
def read_length ( self ) : length = self . _read_ints ( ) last = 1 final = 0 while True : if self . source . peek ( ) == '.' : self . source . forward ( ) last = last * 0.5 final += last continue break length = length + final if length else self . default_length + final return length if length else self . default_length
Reads the length of an arbitrary item,
be it a note, rest, chord, ect.
Reads the length of an arbitrary item be it a note rest chord ect .
"""
        Reads the length of an arbitrary item,
        be it a note, rest, chord, ect.

        We assume our current index is the item(or end of the item)
        we wish to figure out the length of.

        We will continue to read values and push the seeker forward
        until we find no more integers.
        We also handle doted notes!

        We return the length of the note, 1 for whole, 2 for half, 4 for quarter, ect.

        :return: length of the value we are currently on
        :rtype: int
        """ # Lets get the note length: # Check if source is dot: # We have a dotted note, let's add 0.5 to our value: # We are done, let's return:
length of the value we are currently on
length of the value we are currently on
int
self