File: 01_sound_cloud.py

package info (click to toggle)
python-pyo 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,332 kB
  • sloc: python: 135,133; ansic: 127,822; javascript: 16,116; sh: 395; makefile: 388; cpp: 242
file content (36 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# encoding: utf-8
"""
Exponential cloud of sounds...

"""

from pyo import *

s = Server(duplex=0).boot()

snds = ["../snds/snd_%d.aif" % i for i in range(1, 7)]
num = len(snds)
olaps = 4

tabs = []
trtabs = []
trrnds = []

lfo = Expseg([(0, 0), (20, 100)], loop=True, exp=5).play()
cl = Cloud(density=lfo, poly=num * olaps).play()

for i in range(num):
    tabs.append(SndTable(snds[i]))

for j in range(olaps):
    offset = j * num
    for i in range(num):
        index = i + offset
        trrnds.append(TrigChoice(cl[index], choice=[0.5, 0.75, 1, 1.25, 1.5, 2]))
        trtabs.append(TrigEnv(cl[index], table=tabs[i], dur=1.0 / tabs[i].getRate() * trrnds[index], interp=4,))

mix = Mix(trtabs, voices=2)
out = Freeverb(mix, size=0.9, damp=0.95, bal=0.1, mul=0.3).out()

s.gui(locals())