Esempio n. 1
0
File: Root.py Progetto: Qirky/FoxDot
    def set(self, index):

        if type(index) is str:

            char = index.title()

            if len(char) == 1:
                mod = 0
            elif len(char) == 2 and char[1] == "#":
                mod = 1
            elif len(char) == 2 and char[1] == "b":
                mod = -1
            else:
                raise TypeError("Could not convert string '%s' to Note" % index)

            self.char = char
            self.num  = (CHROMATIC_NOTES.index(char[0]) + mod) % len(CHROMATIC_NOTES)

        if type(index) is int:

            self.num  = index
            self.char = modi(CHROMATIC_NOTES, index)

        if type(index) is float:

            self.num = index
            self.char = "<Micro-Tuned>"

        if isinstance(index, TimeVar.var):

            self.num = index
            self.char = "<Time-Varying>"
Esempio n. 2
0
    def set(self, index):

        if type(index) is str:

            char = index.title()

            if len(char) == 1:
                mod = 0
            elif len(char) == 2 and char[1] == "#":
                mod = 1
            elif len(char) == 2 and char[1] == "b":
                mod = -1
            else:
                raise TypeError("Could not convert string '%s' to Note" %
                                index)

            self.char = char
            self.num = (CHROMATIC_NOTES.index(char[0]) +
                        mod) % len(CHROMATIC_NOTES)

        if type(index) is int:

            self.num = index
            self.char = modi(CHROMATIC_NOTES, index)

        if type(index) is float:

            self.num = index
            self.char = "<Micro-Tuned>"

        if isinstance(index, TimeVar.var):

            self.num = index
            self.char = "<Time-Varying>"
Esempio n. 3
0
 def __call__(self):
     """ Call the wrapped object and re-schedule """
     args = modi(self.args, self.n)
     try:
         self.obj.__call__(*args)
     except:
         self.obj.__call__(args)
     Code.LiveObject.__call__(self)
Esempio n. 4
0
 def __call__(self):
     """ Call the wrapped object and re-schedule """
     args = modi(self.args, self.n)
     try:
         self.obj.__call__(*args)
     except:
         self.obj.__call__(args)
     Code.LiveObject.__call__(self)