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__
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
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
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
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
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
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
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
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
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
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
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)
def update(self, n, args=(), kwargs={}): self.when = asStream(n) self.args = args self.kwargs = kwargs return self
def update(self, n, args=()): self.when = asStream(n) self.args = args return self
def stream(values): return asStream(values)
def __init__(self, values, dur=None, **kwargs): var.__init__(self, [asStream(val) for val in values], dur, **kwargs)
def __init__(self, values, dur=4): Var.__init__(self, [asStream(val) for val in values], dur)
def __init__(self, values, dur=4): var.__init__(self, [asStream(val) for val in values], dur)
def stream(self, values): return asStream(values)