Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ex1():
from pyo import Noise, Clean_objects
print """
Lowpass filter:
o_ex1 = Noise(mul=.5)
o_ex2 = Biquad(o_ex1, freq=1000, q=5, type=0).out()
"""
o_ex1 = Noise(mul=.5)
o_ex2 = Biquad(o_ex1, freq=1000, q=5, type=0).out()
c = Clean_objects(4, o_ex1, o_ex2)
c.start()
def init_sound(self):
"""
"""
if self.server_type == 'pyo':
noiser = pyo.Noise(mul=self.amplitude)
self.table = self.table_wrap(noiser)
elif self.server_type == 'jack':
self.get_nsamples()
self.table = self.amplitude * np.random.rand(self.nsamples)
self.chunk()
def init_sound(self):
"""
Create a table of Noise using pyo or numpy, depending on the server_type
"""
if self.server_type == 'pyo':
noiser = pyo.Noise(mul=self.amplitude)
self.table = self.table_wrap(noiser)
elif self.server_type == 'jack':
self.get_nsamples()
self.table = self.amplitude * np.random.rand(self.nsamples)
self.chunk()
self.initialized = True
def ex1():
from pyo import SfPlayer, Noise, Clean_objects, DEMOS_PATH
print """
Smooth envelope follower:
o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True)
o_ex2 = Follower(o_ex1, freq=5)
o_ex3 = Noise(mul=o_ex2).out()
o_ex4 = o_ex1 * .5
o_ex4.out()
"""
o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True)
o_ex2 = Follower(o_ex1, freq=5)
o_ex3 = Noise(mul=o_ex2).out()
o_ex4 = o_ex1 * .5
o_ex4.out()
c = Clean_objects(4, o_ex1, o_ex2, o_ex3, o_ex4)
c.start()
def __init__(self, duration, amplitude=0.01, out_chan=1, **kwargs):
# gap in noise
self.duration = float(duration)/1000
self.amplitude = float(amplitude)
self.fad = pyo.Fader(fadein=0.0001, fadeout=0.0001,
dur=self.duration, mul=1.0)
self.out_chan = out_chan
# fader is 0 when not playing, then goes to its mul when played.
# so we multiply the amplitude of the noise generator by 1-fad
self.noiser = pyo.Noise(mul=float(amplitude)*(1.0-self.fad))
# start it
self.noiser.out(self.out_chan)
def init_sound(self):
if self.server_type == 'pyo':
noiser = pyo.Noise(mul=self.amplitude)
self.table = self.table_wrap(noiser)
elif self.server_type == 'jack':
self.get_nsamples()
self.table = self.amplitude * np.random.rand(self.nsamples)
self.chunk()
def ex2():
from pyo import SfPlayer, Noise, Clean_objects, DEMOS_PATH
print """
Sharp envelope follower:
o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True)
o_ex2 = Follower(o_ex1, freq=25)
o_ex3 = Noise(mul=o_ex2).out()
o_ex4 = o_ex1 * .5
o_ex4.out()
"""
o_ex1 = SfPlayer(DEMOS_PATH + "/transparent.aif", loop=True)
o_ex2 = Follower(o_ex1, freq=25)
o_ex3 = Noise(mul=o_ex2).out()
o_ex4 = o_ex1 * .5
o_ex4.out()
c = Clean_objects(4, o_ex1, o_ex2, o_ex3, o_ex4)
c.start()
def ex3():
from pyo import Noise, Clean_objects
print """
Bandpass filter bank:
o_ex1 = Noise(mul=.75)
o_ex2 = Biquad(o_ex1, freq=[250,500,1000,2000,4000], q=10, type=2).out()
"""
o_ex1 = Noise(mul=.75)
o_ex2 = Biquad(o_ex1, freq=[250,500,1000,2000,4000], q=10, type=2).out()
c = Clean_objects(4, o_ex1, o_ex2)
c.start()
def __init__(self, duration, amplitude=0.01, **kwargs):
#super(Noise, self).__init__()
self.duration = float(duration)
self.amplitude = float(amplitude)
noiser = pyo.Noise(mul=float(amplitude))
self.table = TableWrap(noiser,float(duration))