File: 04-phasing.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 (39 lines) | stat: -rw-r--r-- 1,395 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
37
38
39
"""
04-phasing.py - The phasing effect.

The Phaser object implements a variable number of second-order
allpass filters, allowing to quickly build complex phasing effects.

    A phaser is an electronic sound processor used to filter a signal
    by creating a series of peaks and troughs in the frequency spectrum.
    The position of the peaks and troughs of the waveform being affected
    is typically modulated so that they vary over time, creating a sweeping
    effect. For this purpose, phasers usually include a low-frequency
    oscillator. - https://en.wikipedia.org/wiki/Phaser_(effect)

A phase shifter unit can be built from scratch with the Allpass2 object,
which implement a second-order allpass filter that create, when added to
the original source, one notch in the spectrum.

"""
from pyo import *

s = Server().boot()

# Simple fadein.
fade = Fader(fadein=0.5, mul=0.2).play()

# Noisy source.
a = PinkNoise(fade)

# These LFOs modulate the `freq`, `spread` and `q` arguments of
# the Phaser object. We give a list of two frequencies in order
# to create two-streams LFOs, therefore a stereo phasing effect.
lf1 = Sine(freq=[0.1, 0.15], mul=100, add=250)
lf2 = Sine(freq=[0.18, 0.13], mul=0.4, add=1.5)
lf3 = Sine(freq=[0.07, 0.09], mul=5, add=6)

# Apply the phasing effect with 20 notches.
b = Phaser(a, freq=lf1, spread=lf2, q=lf3, num=20, mul=0.5).out()

s.gui(locals())