def run(self): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.1), stereo.shiftxy(0, 1.25))) ag = nature.Nightingales( 0, 10, # Duration 0.2, 1.0, # volume 1) self.sched_agent(ag, 0, bc) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.3), stereo.shiftxy(0, -1.25))) ag = nature.Cuckoos( 0, 35, # Duration 0.05, 0.75, # volume 1) self.sched_agent(ag, 0, bc) for i in range(8): y = 1 + i * 0.025 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfBackgroundWaves() self.sched_agent(ag, i * 2, sc) sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfWaveSounds() self.sched_agent(ag, i * 8, sc)
def run(self): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.1), stereo.shiftxy(0, 1.25))) ag = nature.Nightingales( 0, 30, # Duration 0.1, 1.0, # volume 1) self.sched_agent(ag, 0, bc) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.3), stereo.shiftxy(0, -1.25))) ag = nature.Cuckoos( 0, 60, # Duration 0.05, 0.75, # volume 1) self.sched_agent(ag, 0, bc) ag = nature.FlMockingBirds( 0, 1200, # Duration 0.05, 0.75, # volume 1) self.sched_agent(ag, 0, bc) for i in range(8): y = 1 + i * 0.05 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfBackgroundWaves() self.sched_agent(ag, i * 5, sc) sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, -y))) ag = SurfWaveSounds() self.sched_agent(ag, i * 10, sc)
def run(self): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.1), stereo.shiftxy(0, 1.25))) ag = nature.Nightingales( 0, 10, # Duration 0.25, 1.0, # volume 1) self.sched_agent(ag, 0, bc) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.3), stereo.shiftxy(0, -1.25))) ag = nature.Cuckoos( 0, 35, # Duration 0.05, 0.75, # volume 1) self.sched_agent(ag, 0, bc) for i in range(16): y = 1 + i * 0.025 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfBackgroundWaves() self.sched_agent(ag, i * 2, sc) for i in range(16): y = 1 + i * 0.025 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfWaveSounds() self.sched_agent(ag, i * 8, sc)
def test_compose(self): self.assertStereo(compose((), ()), ()) self.assertStereo(compose(shift(1.5), shift(2)), (1.0, 3.5)) self.assertStereo(compose(scale(1.5), scale(-2)), (-3, 0)) self.assertStereo(compose(scale(2), shift(1)), (2, 2)) self.assertStereo(compose(shift(1), scale(2)), (2, 1)) self.assertStereo(compose(default(), default()), ()) val1 = compose(shift(-1), scale(4)) self.assertStereo(compose(default(), val1), val1) self.assertStereo(compose(val1, default()), val1) val2 = compose(shift(3), scale(0.5)) self.assertStereo(compose(val1, val2), (2, 11)) val4 = compose(shiftxy(2, 7), scalexy(4, 6)) self.assertStereo(val4, (4, 2, 6, 7)) self.assertStereo(compose(default(), val4), val4) self.assertStereo(compose(val4, default()), val4) self.assertStereo(compose(scale(2), val4), (8, 4, 6, 7)) self.assertStereo(compose(val4, scale(2)), (8, 2, 6, 7)) self.assertStereo(compose(shift(2), val4), (4, 4, 6, 7)) self.assertStereo(compose(val4, shift(2)), (4, 10, 6, 7)) val3 = compose(shiftxy(1, -1), scalexy(0.5, 2)) self.assertStereo(compose(val3, val4), (2, 2, 12, 13)) self.assertStereo(compose(val4, val3), (2, 6, 12, 1))
def doNature(this): "Helper to run GardenBackground agents." nature = builtin.FadeInOutAgent(GardenBackground(0.0), 2, 60) # in front nc = this.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.2))) this.sched_agent(nature, 0, nc) # behind nature = builtin.FadeInOutAgent(GardenBackground(60.0), 2, 60) nc = this.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.1))) this.sched_agent(nature, 0, nc)
def run(self): for i in range(16): y = 1+i*0.025 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y))) ag = SurfBackgroundWaves() self.sched_agent(ag, i*2, sc) for i in range(16): y = 1+i*0.05 sc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = SurfWaveSounds() self.sched_agent(ag, i*4, sc)
def run(self): doNature(self) y = [-1.5, -1.25, -1.125, -1, 0, 1, 1.125, 1.25, 1.5] for i in xrange(len(y)): for j in xrange(2): k = (i + j) % len(y) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[k]))) ag = CaMockingBirds( 0, 120, # Duration 0.15, 0.75, # volume 1 + 0.025 * j # pan ) self.sched_agent(ag, k * 20, bc) ag = FlMockingBirds( 0, 120, # Duration 0.15, 0.75, # volume 1 + 0.025 * j # pan ) self.sched_agent(ag, k * 20, bc)
def run(self): nature = builtin.FadeInOutAgent(GardenBackground(0.0),60, 15) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.5))) # in front self.sched_agent(nature, 0, nc) nature = builtin.FadeInOutAgent(GardenBackground(60.0), 60, 15) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.5))) # behind self.sched_agent(nature, 0, nc) y = [-1.25, -1.2, -1.15, -1.1, -1.05, -1, 1, 1.05, 1.1, 1.15, 1.2] for i in xrange(10): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[i]))) ag = Nightingales(0.0, 50 - 2 * i, 0.1, 0.4, 1.0) self.sched_agent(ag, 0, bc)
def run(self): doNature(self) y = [-1.25, -1.2, -1.15, -1.1, -1.05, -1, 1, 1.05, 1.1, 1.15, 1.2] for i in xrange(len(y)): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[i]))) ag = Nightingales(0.0, 50 - 2 * i, 0.1, 0.4, 1.0) self.sched_agent(ag, 0, bc)
def run(self): doNature(self) for i in xrange(10): y = 1 + i * 0.025 nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.25), stereo.shiftxy(0, y))) ag = Crickets(0.0, 10.0, 0.1, 0.7, 1.4) self.sched_agent(ag, 0, nc)
def run(self): doNature(self) ag = Nightingales(0.0, 30, 0.1, 1.0, 1.3) self.sched_agent(ag) for i in xrange(10): y = 1 + i * 0.025 nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = Crickets(0.0, 20.0, 0.1, 0.4, 1.4) self.sched_agent(ag, 0, nc)
def run(self): doNature(self) ag = Nightingales(0.0, 30, 0.1, 1.0, 1.3) self.sched_agent(ag) for i in xrange(10): y = 1 + i * 0.025 nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = Crickets( 0.0, 20.0, 0.1, 0.4, 1.4) self.sched_agent(ag, 0, nc)
def run(self): y = [-1.5, -1.2, -1.1, 1.1, 1.2, 1.5] for i in xrange(len(self.agents)): for j in xrange(6): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y[i]))) ag = self.agents[i]( 0, 60, 0.25, 0.5, # volume 1 + j * 0.1 # pan ) self.sched_agent(ag, 0, bc)
def run(self): y = [-1.5, -1.2, 1.2, 1.5] for i in xrange(len(self.agents)): for j in xrange(6): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y[i]))) ag = self.agents[i]( 0, 60, 0.25, 0.5, # volume 1 + j * 0.1 # pan ) self.sched_agent(ag, 0, bc)
def run(self): nature = builtin.FadeInOutAgent(GardenBackground(0.0), 60, 15) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.5))) # in front self.sched_agent(nature, 0, nc) nature = builtin.FadeInOutAgent(GardenBackground(60.0), 60, 15) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.5))) # behind self.sched_agent(nature, 0, nc) y = [-1.5, -1.25, -1.125, 0, 1.125, 1.25, 1.5] for i in xrange(len(self.agents)): for j in xrange(5): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[i]))) ag = self.agents[i]( 0, 120, # Duration 0.05, 0.65, # volume 1 + 0.1 * j # pan ) self.sched_agent(ag, j * 5, bc)
def run(self): nature = GardenBackground(0.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.5))) # in front self.sched_agent(nature, 0, nc) nature = GardenBackground(60.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.5))) # behind self.sched_agent(nature, 0, nc) y = [-1.5, -1.25, -1.125, 0, 1.125, 1.25, 1.5] for i in xrange(len(self.agents)): for j in xrange(5): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[i]))) ag = self.agents[i]( 0, 120, # Duration 0.05, 0.65, # volume 1 + 0.1 * j # pan ) self.sched_agent(ag, j * 5, bc)
def run(self): nature = GardenBackground(0.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.5))) # in front self.sched_agent(nature, 0, nc) nature = GardenBackground(60.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.5))) # behind self.sched_agent(nature, 0, nc) y = [-1.5, 0, 1.5] for i in xrange(len(self.agents)): for j in xrange(6): bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y[i]))) ag = self.agents[i]( 0, 60, 0.25, 0.5, # volume 1 + j * 0.1 # pan ) self.sched_agent(ag, 0, bc)
def run(self): doNature(self) y = [-1.5, -1.25, -1.125, 0, 1.125, 1.25, 1.5] for i in xrange(len(self.agents)): for j in xrange(5): k = (i + j) % len(self.agents) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, y[k]))) ag = self.agents[i]( 0, 120, # Duration 0.15, 0.75, # volume 1 + 0.025 * j # pan ) self.sched_agent(ag, k * 10, bc)
def run(self): nature = GardenBackground(0.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, 1.5))) # in front self.sched_agent(nature, 0, nc) nature = GardenBackground(60.0) nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.2), stereo.shiftxy(0, -1.5))) # behind self.sched_agent(nature, 0, nc) for i in xrange(len(self.agents)): for j in xrange(8): # compute y using i and j # i = 0 approaches, i=1 no change, i=2 recedes y = (i - 1) * (1.6 - j * 0.05) bc = self.new_channel_pan( stereo.compose(stereo.shiftxy(0, y), stereo.scalexy(1.8))) ag = self.agents[i]( 0, 120, 0.25, 0.5, # volume 1.0 # pan ) self.sched_agent(ag, 0, bc)
def run(self): doNature(self) y = [-1.4, -1.25, -1.125, 0, 1.125, 1.25, 1.4] for i in xrange(len(self.agents)): for j in xrange(len(self.agents)): k = (i + j) % len(self.agents) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1 + 0.1 * k), stereo.shiftxy(0, y[k]))) start = 10 * (i + j) ag = self.agents[i]( start, 90 + start, # duration 0.25, 0.75, # volume 1 + 0.05 * j # pan ) self.sched_agent(ag, k * 5, bc)
def run(self): doNature(self) for i in xrange(len(self.agents)): for j in xrange(8): # compute y using i and j # i = 0 approaches, i=1 no change, i=2 recedes y = (i - 1) * (1.6 - j * 0.05) bc = self.new_channel_pan( stereo.compose(stereo.shiftxy(0, y), stereo.scalexy(1.8))) ag = self.agents[i]( 0, 120, 0.25, 0.5, # volume 1.0 # pan ) self.sched_agent(ag, 0, bc)
def run(self): nature = GardenBackground(0.0) nc = self.new_channel_pan(stereo.shiftxy(0, 1.3)) # in front self.sched_agent(nature, 0, nc) nature = GardenBackground(60.0) nc = self.new_channel_pan(stereo.shiftxy(0, -1.3)) # in back self.sched_agent(nature, 0, nc) for i in xrange(6): y = 1 + i * 0.1 nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = Crickets( 0.0, 12.0, 0.1, 0.18, 1.2) self.sched_agent(ag, 0, nc)
def run(self): y = [-1.5, -1.2, -1.1, 0, 1.1, 1.2, 1.5] for i in xrange(len(self.agents)): for j in xrange(len(y)): k = (i + j) % len(y) bc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y[j]))) ag = self.agents[i]( 0, 60, 0.1, 0.75, # volume 1 + k * 0.1 # pan ) self.sched_agent(ag, 0, bc)
def run(self): nature = builtin.FadeInOutAgent(GardenBackground(0.0), 60, 15) nc = self.new_channel_pan(stereo.shiftxy(0, 1.3)) # in front self.sched_agent(nature, 0, nc) nature = builtin.FadeInOutAgent(GardenBackground(60.0), 60, 15) nc = self.new_channel_pan(stereo.shiftxy(0, -1.3)) # in back self.sched_agent(nature, 0, nc) ag = Nightingales(0.0, 30, 0.1, 1.0, 1.3) self.sched_agent(ag) for i in xrange(10): y = 1 + i * 0.025 nc = self.new_channel_pan( stereo.compose(stereo.scalexy(1.4), stereo.shiftxy(0, y))) ag = Crickets( 0.0, 20.0, 0.1, 0.4, 1.4) self.sched_agent(ag, 0, nc)
def test_construct(self): self.assertStereo(default(), ()) self.assertStereo(shift(0), ()) self.assertStereo(shift(-2), (1, -2)) self.assertStereo(scale(1), ()) self.assertStereo(scale(3), (3, 0)) self.assertStereo(shiftxy(), ()) self.assertStereo(shiftxy(0), ()) self.assertStereo(shiftxy(0, 0), ()) self.assertStereo(shiftxy(3), (1, 3)) self.assertStereo(shiftxy(0, 3), (1, 0, 1, 3)) self.assertStereo(shiftxy(2, 3), (1, 2, 1, 3)) self.assertStereo(shiftxy(0.2, 0.3), (1, 0.2, 1, 0.3)) self.assertStereo(scalexy(), ()) self.assertStereo(scalexy(1), ()) self.assertStereo(scalexy(1, 1), ()) self.assertStereo(scalexy(3), (3, 0)) self.assertStereo(scalexy(1, 3), (1, 0, 3, 0)) self.assertStereo(scalexy(2, 3), (2, 0, 3, 0)) self.assertStereo(scalexy(0.4, -0.5), (0.4, 0, -0.5, 0)) self.assertStereo(fixed(2), (0, 2)) self.assertStereo(fixedx(-2), (0, -2)) self.assertStereo(fixedy(3), (1, 0, 0, 3)) self.assertStereo(fixedxy(2, 3), (0, 2, 0, 3)) self.assertStereo(cast(None), ()) self.assertStereo(cast(()), ()) self.assertStereo(cast(0), ()) self.assertStereo(cast(0.0), ()) self.assertStereo(cast(-2), (1, -2)) self.assertStereo(cast(-2), (1, -2)) self.assertStereo(cast(-2.0), (1, -2))