Exemplo n.º 1
0
    def test_graincloud_with_length_lfo(self):
        sound = SoundBuffer(filename='tests/sounds/guitar1s.wav')
        cloud = grains.GrainCloud(sound, grainlength_lfo=dsp.RND)

        length = random.triangular(1, 4)
        framelength = int(length * sound.samplerate)

        out = cloud.play(length)
        self.assertEqual(len(out), framelength)

        if save:
            out.write('test_graincloud_with_length_lfo.flac')
Exemplo n.º 2
0
def makecloud(density):
    return grains.GrainCloud(
        snd * 0.125,
        win=dsp.HANN,
        read_lfo=dsp.PHASOR,
        speed_lfo_wt=interpolation.linear(
            [random.random() for _ in range(random.randint(10, 1000))], 4096),
        density_lfo_wt=interpolation.linear(
            [random.random() for _ in range(random.randint(10, 1000))], 4096),
        grainlength_lfo_wt=interpolation.linear(
            [random.random() for _ in range(random.randint(10, 500))], 4096),
        minspeed=0.25,
        maxspeed=random.triangular(0.25, 10),
        density=density,
        minlength=1,
        maxlength=random.triangular(60, 100),
        spread=random.random(),
        jitter=random.triangular(0, 0.1),
    ).play(30)
Exemplo n.º 3
0
def makecloud(snd):
    return grains.GrainCloud(
        snd,
        win=dsp.HANN,
        read_lfo=dsp.PHASOR,
        speed_lfo_wt=interpolation.linear([
            random.triangular(0, 0.05) for _ in range(random.randint(10, 1000))
        ], 4096),
        density_lfo_wt=interpolation.linear(
            [random.random() for _ in range(random.randint(10, 1000))], 4096),
        grainlength_lfo_wt=interpolation.linear(
            [random.random() for _ in range(random.randint(10, 500))], 4096),
        minspeed=0.99,
        maxspeed=random.triangular(1, 1.1),
        density=random.triangular(0.75, 2),
        minlength=1,
        maxlength=random.triangular(60, 100),
        spread=random.random(),
        jitter=random.triangular(0, 0.1),
    ).play(snd.dur * random.triangular(3, 4))