def __init__(self, seconds: float, freq: float, points: List[List[float]], **kwargs): Source.__init__(self) self.seconds = seconds self.freq = float(freq) self.points = np.array(points) self.curve = Curve.from_nodes(points)
def __init__(self, name: str, output: str, seconds: float, octave: int = 0, **kwargs): Source.__init__(self) freq = notes[name] * (2**octave) clazz = NoteSource.sources[output] self.source = clazz(freq=freq, seconds=seconds)
def play_from_source(root: Source, fs: int, start: Optional[Frames] = None, end: Optional[Frames] = None): start = start if start is not None else 0 end = end if end is not None else root.get_duration(fs) buffer = root.get_buffer(fs, start, end) # Ensure that highest value is in 16-bit range audio = buffer / np.max(np.abs(buffer)) * (2**15 - 1) # Convert to 16-bit data audio = audio.astype(np.int16) # Start playback play_obj = sa.play_buffer(audio, 1, 2, fs) # Wait for playback to finish before exiting play_obj.wait_done()
def __init__(self, file, **kwargs): Source.__init__(self) self.file = file self.buffer = None self.source_fs = None
def __init__(self, scale: Parametrizable, child: Source): Source.__init__(self) self.child = child self.scale = parametrize(scale)
def __init__(self, factor: float, child: Source): Source.__init__(self) self.factor = float(factor) self.child = child
def __init__(self, source: Source): Source.__init__(self) self.source = source
def __init__(self, child: Source, transforms: List[Transform], **kwargs): Source.__init__(self) self.child = child self.transforms = transforms
def __init__(self, buf, source_fs: Frames, **kwargs): Source.__init__(self) self.buf = buf self.source_fs = source_fs
def __init__(self, freq, seconds, **kwargs): Source.__init__(self) self.freq = freq self.seconds = seconds
def __init__(self, children: List[Source] = None): Source.__init__(self) self.children = children if children is not None else []
def __init__(self, children: List[Tuple[float, Source]] = None): Source.__init__(self) self.children = children if children is not None else []
def __init__(self, freq, seconds, **kwargs): Source.__init__(self) self.freq = freq self.per = 1.0 / float(self.freq) self.seconds = seconds