| 1 |
""" |
| 2 |
05-math-ops.py - Audio objects and arithmetic expresssions. |
| 3 |
|
| 4 |
This script shows how a PyoObject reacts when used inside an |
| 5 |
arithmetic expression. |
| 6 |
|
| 7 |
Multiplication, addition, division and substraction can be applied |
| 8 |
between pyo objects or between pyo objects and numbers. Doing so |
| 9 |
returns a Dummy object that outputs the result of the operation. |
| 10 |
|
| 11 |
A Dummy object is only a place holder to keep track of arithmetic |
| 12 |
operations on audio objects. |
| 13 |
|
| 14 |
PyoObject can also be used in expression with the exponent (**), |
| 15 |
modulo (%) and unary negative (-) operators. |
| 16 |
|
| 17 |
""" |
| 18 |
from pyo import * |
| 19 |
|
| 20 |
s = Server().boot() |
| 21 |
s.amp = 0.1 |
| 22 |
|
| 23 |
|
| 24 |
a = Sine() |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
b = a * 0.5 |
| 29 |
b.out() |
| 30 |
|
| 31 |
|
| 32 |
print(b) |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
c = Sine(300) |
| 37 |
d = a * c * 0.3 |
| 38 |
d.out() |
| 39 |
|
| 40 |
|
| 41 |
e = c ** 10 * 0.4 |
| 42 |
e.out(1) |
| 43 |
|
| 44 |
|
| 45 |
sp = Spectrum([d, e]) |
| 46 |
sc = Scope([d, e]) |
| 47 |
|
| 48 |
s.gui(locals()) |