def __init__( self, calculation_rate=None, decay_scale=1, frequency_offset=0, frequency_scale=1, source=None, specifications=None, ): frequencies, amplitudes, decay_times = specifications assert len(frequencies) if not amplitudes: amplitudes = [1.0] * len(frequencies) elif not isinstance(amplitudes, collections.Sequence): amplitudes = [amplitudes] * len(frequencies) if not decay_times: decay_times = [1.0] * len(frequencies) elif not isinstance(decay_times, collections.Sequence): decay_times = [decay_times] * len(frequencies) specifications = utils.zip_sequences( frequencies, amplitudes, decay_times ) specifications = utils.flatten_iterable(specifications) specifications = tuple(specifications) UGen.__init__( self, calculation_rate=calculation_rate, decay_scale=decay_scale, frequency_offset=frequency_offset, frequency_scale=frequency_scale, source=source, specifications=specifications, )
def __init__( self, calculation_rate=None, decay_scale=1, frequency_offset=0, frequency_scale=1, source=None, specifications=None, ): frequencies, amplitudes, decay_times = specifications assert len(frequencies) if not amplitudes: amplitudes = [1.0] * len(frequencies) elif not isinstance(amplitudes, collections.Sequence): amplitudes = [amplitudes] * len(frequencies) if not decay_times: decay_times = [1.0] * len(frequencies) elif not isinstance(decay_times, collections.Sequence): decay_times = [decay_times] * len(frequencies) specifications = utils.zip_sequences(frequencies, amplitudes, decay_times) specifications = utils.flatten_iterable(specifications) specifications = tuple(specifications) UGen.__init__( self, calculation_rate=calculation_rate, decay_scale=decay_scale, frequency_offset=frequency_offset, frequency_scale=frequency_scale, source=source, specifications=specifications, )
def __init__( self, amplitudes=(0, 1, 0), durations=(1, 1), curves=('linear', 'linear'), release_node=None, loop_node=None, offset=None, ): import supriya.synthdefs assert len(amplitudes) assert len(durations) and len(durations) == (len(amplitudes) - 1) amplitudes = list(amplitudes) for i, amplitude in enumerate(amplitudes): if isinstance(amplitude, int): amplitudes[i] = float(amplitude) durations = list(durations) for i, duration in enumerate(durations): if isinstance(duration, int): durations[i] = float(duration) if isinstance(curves, ( int, float, str, supriya.synthdefs.EnvelopeShape, )): curves = (curves, ) elif curves is None: curves = () curves = tuple(curves) if release_node is not None: release_node = int(release_node) assert 0 <= release_node < len(amplitudes) self._release_node = release_node if loop_node is not None: assert self._release_node is not None loop_node = int(loop_node) assert 0 <= loop_node <= release_node self._loop_node = loop_node if offset is not None: offset = float(offset) self._offset = offset self._initial_amplitude = amplitudes[0] self._envelope_segments = tuple( utils.zip_sequences( amplitudes[1:], durations, curves, ))
def __init__( self, amplitudes=(0, 1, 0), durations=(1, 1), curves=("linear", "linear"), release_node=None, loop_node=None, offset=None, ): assert len(amplitudes) assert len(durations) and len(durations) == (len(amplitudes) - 1) if isinstance(curves, (int, float, str, EnvelopeShape, OutputProxy)): curves = [curves] elif curves is None: curves = [] self._release_node = release_node self._loop_node = loop_node self._offset = offset self._initial_amplitude = amplitudes[0] self._envelope_segments = tuple( utils.zip_sequences(amplitudes[1:], durations, curves) )