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 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 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()