| 1 |
04-building-lfo.py - Audio control of parameters. |
| 2 |
============================================================================================================================================ |
| 3 |
|
| 4 |
|
| 5 |
One of the most important thing with computer music is the |
| 6 |
trajectories taken by parameters over time. This is what |
| 7 |
gives life to the synthesized sound. |
| 8 |
|
| 9 |
One way to create moving values is by connecting a low |
| 10 |
frequency oscillator to an object's attribute. This script |
| 11 |
shows that process. |
| 12 |
|
| 13 |
Other possibilities that will be covered later use random |
| 14 |
class objects or feature extraction from an audio signal. |
| 15 |
|
| 16 |
.. code-block:: python |
| 17 |
|
| 18 |
from pyo import * |
| 19 |
|
| 20 |
s = Server().boot() |
| 21 |
|
| 22 |
# Creates a noise source |
| 23 |
n = Noise() |
| 24 |
|
| 25 |
# Creates an LFO oscillating +/- 500 around 1000 (filter's frequency) |
| 26 |
lfo1 = Sine(freq=0.1, mul=500, add=1000) |
| 27 |
# Creates an LFO oscillating between 2 and 8 (filter's Q) |
| 28 |
lfo2 = Sine(freq=0.4).range(2, 8) |
| 29 |
# Creates a dynamic bandpass filter applied to the noise source |
| 30 |
bp1 = ButBP(n, freq=lfo1, q=lfo2).out() |
| 31 |
|
| 32 |
# The LFO object provides more waveforms than just a sine wave |
| 33 |
|
| 34 |
# Creates a ramp oscillating +/- 1000 around 12000 (filter's frequency) |
| 35 |
lfo3 = LFO(freq=0.25, type=1, mul=1000, add=1200) |
| 36 |
# Creates a square oscillating between 4 and 12 (filter's Q) |
| 37 |
lfo4 = LFO(freq=4, type=2).range(4, 12) |
| 38 |
# Creates a second dynamic bandpass filter applied to the noise source |
| 39 |
bp2 = ButBP(n, freq=lfo3, q=lfo4).out(1) |
| 40 |
|
| 41 |
s.gui(locals()) |
| 42 |
|