Esempio n. 1
0
 def __init__(self, metro, obj, dur, args=()):
     self.args  = asStream(args)
     self.obj   = obj
     self.step  = dur
     self.metro = metro
     self.n     = 0
     self.s     = self.obj.__class__.__name__
Esempio n. 2
0
 def __init__(self, parent, method, n, args=()):
     self.parent = parent      
     self.name = method
     self.when = asStream(n)
     self.i    = 0
     self.next = self.when[self.i] + self.parent.metro.next_bar()
     self.args = args
Esempio n. 3
0
    def update(self, values, dur=None, **kwargs):
        """ Updates the TimeVar with new values """

        self.bpm = kwargs.get('bpm', self.bpm)

        # if isinstance(values, str): values = [values]

        self.data = []
        self.time = []

        #: Update the durations of each state

        if dur is not None:

            self.dur = asStream(dur)

            if any([isinstance(i, _inf) for i in self.dur]):

                self.inf_found = _inf.here

        self.data = self.stream(values)

        a, b = 0, 0

        for dur in self.dur:
            a = b
            b = a + dur
            self.time.append([a, b])

        return self
Esempio n. 4
0
 def __init__(self, parent, method, n, args=()):
     self.parent = parent
     self.name = method
     self.when = asStream(n)
     self.i = 0
     self.next = self.when[self.i] + self.parent.metro.NextBar()
     self.args = args
Esempio n. 5
0
 def __init__(self, metro, obj, dur, args=()):
     self.args = asStream(args)
     self.obj = obj
     self.step = dur
     self.metro = metro
     self.n = 0
     self.s = self.obj.__class__.__name__
Esempio n. 6
0
    def update(self, values, dur=None, **kwargs):
        """ Updates the TimeVar with new values """

        self.bpm = kwargs.get('bpm', self.bpm)

        # if isinstance(values, str): values = [values]

        self.data = []
        self.time = []

        #: Update the durations of each state

        if dur is not None:

            self.dur = asStream(dur)

            if any([isinstance(i, _inf) for i in self.dur]):

                self.inf_found = _inf.here

        self.data = self.stream(values)
        
        a, b = 0, 0
        
        for dur in self.dur:
            a = b
            b = a + dur
            self.time.append((a,b))

        return self
Esempio n. 7
0
File: Repeat.py Progetto: lvm/FoxDot
 def __init__(self, parent, method, n, args=(), kwargs={}):
     self.parent = parent  
     self.method = method
     self.when = asStream(n)
     self.i    = 0
     self.next = self.when[self.i] + self.parent.metro.next_bar()
     self.args = args
     self.kwargs = kwargs
Esempio n. 8
0
    def update(self, n, cycle, args=(), kwargs={}):
        """ Updates the values of the MethodCall. Re-adjusts
            the index if cycle has been changed """
        self.when = asStream(n)
        self.args = args
        self.kwargs = kwargs

        if cycle is not None and cycle != self.cycle:

            self.next = self.parent.metro.next_bar() + self.when[self.i]

        self.cycle = cycle
        
        return self
Esempio n. 9
0
    def update(self, values, dur=None, **kwargs):
        """ Updates the TimeVar with new values """

        self.bpm = kwargs.get('bpm', self.bpm)

        # if isinstance(values, str): values = [values]

        self.data = []
        self.time = []
        a, b = 0, 0

        #: Update the durations of each state

        if dur is not None:

            self.dur = asStream(dur)

            if any([isinstance(i, _inf) for i in self.dur]):

                self.inf_found = _inf.here

        # Make equal size

        values = self.stream(values)

        length = max(len(values), len(self.dur))

        values.stretch(length)
        self.dur.stretch(length)

        # Loop over the values and define time frame

        for i, val in enumerate(values):

            this_dur = op.modi(self.dur, i)

            a = b
            b = a + this_dur

            self.data.append(val)
            self.time.append((a, b))

        # The contained data should be a Pattern

        self.data = self.stream(self.data)

        return self
Esempio n. 10
0
    def __init__(self, parent, method, n, cycle=None, args=(), kwargs={}):

        self.parent = parent
        self.method = method

        self.cycle = cycle
        self.when = asStream(n)

        self.this_when = self.when[0]
        self.last_when = 0

        self.i = 0

        self.next = self.parent.metro.next_bar() + self.this_when

        self.args = args
        self.kwargs = kwargs
Esempio n. 11
0
    def update(self, values, dur=None):
        """ Updates the TimeVar with new values """

        #: If updated with a TimeVar object, copy the attribute dict
        
        if isinstance(values, self.__class__):
            self.__dict__ = values.__dict__
            return self
        
        # if isinstance(values, str): values = [values]

        self.data = []
        self.time = []
        a, b = 0, 0

        #: Update the durations of each state

        if dur is not None:

            self.dur = asStream(dur)

            if any([isinstance(i, _inf) for i in self.dur]):

                self.inf_found = _inf.here

        for i, val in enumerate(self.stream(values)):
              
            this_dur = op.modi(self.dur, i)

            a = b
            b = a + this_dur
    
            self.data.append( val )
            self.time.append((a,b))

        # The contained data should be a Pattern

        self.data = self.stream( self.data )

        return self
Esempio n. 12
0
    def update(self, values, dur=None):
        """ Updates the TimeVar with new values """

        #: If updated with a TimeVar object, copy the attribute dict

        if isinstance(values, self.__class__):
            self.__dict__ = values.__dict__
            return self

        # if isinstance(values, str): values = [values]

        self.data = []
        self.time = []
        a, b = 0, 0

        #: Update the durations of each state

        if dur is not None:

            self.dur = asStream(dur)

            if any([isinstance(i, _inf) for i in self.dur]):

                self.inf_found = _inf.here

        for i, val in enumerate(self.stream(values)):

            this_dur = op.modi(self.dur, i)

            a = b
            b = a + this_dur

            self.data.append(val)
            self.time.append((a, b))

        # The contained data should be a Pattern

        self.data = self.stream(self.data)

        return self
Esempio n. 13
0
 def extend(self, values, dur=None):
     data = list(self.data) + list(values)
     durs = self.dur if not dur else list(self.dur) + list(asStream(dur))
     return self.__class__(data, durs)
Esempio n. 14
0
File: Repeat.py Progetto: lvm/FoxDot
 def update(self, n, args=(), kwargs={}):
     self.when = asStream(n)
     self.args = args
     self.kwargs = kwargs
     return self
Esempio n. 15
0
 def update(self, n, args=()):
     self.when = asStream(n)
     self.args = args
     return self
Esempio n. 16
0
 def update(self, n, args=()):
     self.when = asStream(n)
     self.args = args
     return self
Esempio n. 17
0
 def stream(values):
     return asStream(values)
Esempio n. 18
0
 def __init__(self, values, dur=None, **kwargs):
     var.__init__(self, [asStream(val) for val in values], dur, **kwargs)
Esempio n. 19
0
 def extend(self, values, dur=None):
     data = list(self.data) + list(values)
     durs = self.dur if not dur else list(self.dur) + list(asStream(dur))
     return self.__class__(data, durs)
Esempio n. 20
0
 def __init__(self, values, dur=4):
     Var.__init__(self, [asStream(val) for val in values], dur)
Esempio n. 21
0
 def stream(values):
     return asStream(values)
Esempio n. 22
0
 def __init__(self, values, dur=4):
     var.__init__(self, [asStream(val) for val in values], dur)
Esempio n. 23
0
 def stream(self, values):
     return asStream(values)
Esempio n. 24
0
 def stream(self, values):
     return asStream(values)