Exemplo n.º 1
0
    def test_graincloud_with_read_lfo(self):
        sound = SoundBuffer(filename='tests/sounds/linux.wav')
        cloud = grains.Cloud(sound, position=dsp.win('hann', 0, 1))

        length = 30
        framelength = int(length * sound.samplerate)

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

        out.write('tests/renders/graincloud_with_read_lfo.wav')
Exemplo n.º 2
0
    def test_unmodulated_graincloud(self):
        sound = SoundBuffer(filename='tests/sounds/guitar1s.wav')
        cloud = grains.Cloud(sound)

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

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

        out.write('tests/renders/graincloud_unmodulated.wav')
Exemplo n.º 3
0
    def test_graincloud_with_speed_lfo(self):
        sound = SoundBuffer(filename='tests/sounds/guitar1s.wav')
        minspeed = random.triangular(0.05, 1)
        maxspeed = minspeed + random.triangular(0.5, 10)
        speed = dsp.wt('rnd', minspeed, maxspeed)
        cloud = grains.Cloud(sound, grainlength=0.04, speed=speed)

        length = 30
        framelength = int(length * sound.samplerate)

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

        out.write('tests/renders/graincloud_with_speed_lfo.wav')
Exemplo n.º 4
0
def makecloud():
    snd = dsp.read('%s/sounds/linus.wav' % PATH)
    grainlength = wavetables.randline(random.randint(50, 500),
                                      lowvalue=0.001,
                                      highvalue=random.triangular(0.02, 0.1))
    grid = grainlength * 0.5
    speed = wavetables.randline(random.randint(10, 100),
                                lowvalue=0.25,
                                highvalue=random.triangular(0.25, 10))
    amp = wavetables.randline(random.randint(10, 500),
                              lowvalue=0.125,
                              highvalue=random.triangular(0.5, 1))

    return grains.Cloud(
        snd,
        window=dsp.HANN,
        position=dsp.PHASOR,
        speed=speed,
        grid=grid,
        amp=amp,
        grainlength=grainlength,
        spread=random.random(),
        jitter=random.triangular(0, 0.1),
    ).play(30)