def playback5(self, file_path=icq_uh_oh): print('pb5') count = self.count fade = pyo.Fader(fadein=.1, fadeout=0.1, dur=3).play() select = random.random() snd = pyo.SndTable(file_path) env = pyo.HannTable() pos = pyo.Phasor(snd.getRate() * .25, random.random(), snd.getSize()) dur = pyo.Noise(.05, .1) g = pyo.Granulator( snd, env, [self.granulated_pitch, self.granulated_pitch + .001], pos, dur, 24, mul=fade) panner = pyo.Pan(g, outs=2, pan=random.random(), spread=random.random()).out() self.granulated_pitch -= .05 if self.granulated_pitch < .049: self.granulated_pitch = .05 time.sleep(fade.dur + .05) g.stop()
def playback3(self, file_path=imsend_sound_path): snd = pyo.SndTable(file_path) env = pyo.HannTable() pos = pyo.Phasor(snd.getRate() * .25, 0, snd.getSize()) dur = pyo.Noise(.001, .1) g = pyo.Granulator(snd, env, [1, 1.001], pos, dur, 24, mul=self.env) panner = pyo.Pan(g, outs=2, pan=random.random(), spread=random.random()).out() time.sleep(self.env + 0.05) g.stop()
def __init__(self, freq=440, base_freq=55, samplerate=44100, phase=0, mul=1, add=0): PyoObject.__init__(self, mul, add) self._freq = freq self._phase = phase self._base_freq = base_freq self._samplerate = samplerate self._max_freq = int(samplerate / 4) self._table_size = int((self._max_freq / self._base_freq) * 4) self._col_size = 1 #freq,mul,add,lmax = convertArgsToLists(freq,mul,add) tables = tables_gen(sine_gen, self._table_size, self._col_size, self._base_freq, self._max_freq) self._matrix = pyo.NewMatrix(self._table_size, self._col_size, tables) self._ramp = pyo.Phasor(freq, phase) self._wave = pyo.MatrixPointer(self._matrix, self._ramp, pyo.Sig(0)) self._base_objs = self._wave.getBaseObjects()
def SpecToGranulator(X_mu_np, idx): Nfft = 4096 S = X_mu_np[idx, :] S = np.append(S[np.newaxis].T, np.zeros((Nfft / 2 - S.shape[0] + 1, 1)), axis=0) x = np.fft.irfft(S, n=Nfft) s = pyo.Server(sr=44100, duplex=0) s.boot() s.start() tab = pyo.DataTable(size=1024, init=x.tolist()) tab.view() env = pyo.HannTable() pos = pyo.Phasor(1024 / 44100, 0, 1024) dur = pyo.Noise(.001, .1) g = pyo.Granulator(tab, env, 1, pos, dur, 24, mul=1).out() s.gui(locals(), exit=True)
def __init__(self, freq=440, base_freq=55, samplerate=44100, phase=0, mul=1, add=0): PyoObject.__init__(self, mul, add) self._freq = freq self._phase = phase self._base_freq = base_freq self._samplerate = samplerate self._max_freq = int(samplerate / 4) self._table_size = int((self._max_freq / self._base_freq) * 4) self._col_size = int((self._max_freq / self._base_freq) / 2) #freq,mul,add,lmax = convertArgsToLists(freq,mul,add) tables = tables_gen(tri_gen, self._table_size, self._col_size, self._base_freq, self._max_freq) self._matrix = pyo.NewMatrix(self._table_size, self._col_size, tables) self._ramp = pyo.Phasor(freq, phase) self._table_selector_freq = pyo.Sig(freq) self._table_selector = pyo.Min(pyo.Max(((pyo.Abs(self._table_selector_freq) / (self._base_freq * 2)) - 0.5) / self._col_size, 0), (self._col_size - 1) / self._col_size) self._wave = pyo.MatrixPointer(self._matrix, self._ramp, self._table_selector) self._base_objs = self._wave.getBaseObjects()
def out(self, file_path=imsend_sound_path): if self.choice <= 0.33: self.section_one = Section_One(self.count) self.section_one.out() elif self.choice > .33 and self.choice <= .67: self.section_two = Section_Two(self.message, self.count) self.section_two.out() else: snd = pyo.SndTable(file_path) env = pyo.HannTable() pos = pyo.Phasor(snd.getRate() * .25, 0, snd.getSize()) dur = pyo.Noise(.001, .1) g = pyo.Granulator(snd, env, [1, 1.001], pos, dur, 24, mul=1) panner = pyo.Pan(g, outs=2, pan=random.random(), spread=random.random()).out() time.sleep(2) g.stop()