File: 03_matrix_algo.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 (24 lines) | stat: -rw-r--r-- 578 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
#!/usr/bin/env python
# encoding: utf-8
"""
This script demonstrates how to use a matrix to do some
algorithmic generation of notes.

"""
from pyo import *

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

mat = [[36, 41, 43, 48], [48, 51, 53, 57], [60, 62, 67, 68], [70, 72, 74, 77]]

mm = NewMatrix(4, 4, mat)

x = RandInt(max=4, freq=[4, 8], mul=0.25)
met = Metro(time=[0.5, 1]).play()
y = Counter(input=met, min=0, max=4, mul=0.25)
a = MatrixPointer(matrix=mm, x=x, y=y)

synth = LFO(freq=[MToF(a[0] - 12), MToF(a[1])], sharp=0.75, type=2, mul=0.25)
chor = Chorus(synth).out()

s.gui(locals())