Debian Codegraph @

docs/_sources/examples/06-filters/06-vocoder.rst.txt

raw
1 06-vocoder.py - Analysis/resynthesis vocoder effect.
2 ============================================================================================================================================
3
4
5 A vocoder is an analysis/resynthesis process that
6 uses the spectral envelope of a first sound to shape
7 the spectrum of a second sound. Usually (for the best
8 results) the first sound should present a dynamic
9 spectrum (for both frequencies and amplitudes) and the
10 second sound should contain a rich and stable spectrum.
11
12 In this example, LFOs are applied to every dynamic argument
13 of the Vocoder object to show the range of sound effects
14 the user can get with a vocoder.
15
16 .. code-block:: python
17
18 from pyo import *
19 from random import random
20
21 s = Server().boot()
22
23 # First sound - dynamic spectrum.
24 spktrm = SfPlayer("../snds/baseballmajeur_m.aif", speed=[1, 1.001], loop=True)
25
26 # Second sound - rich and stable spectrum.
27 excite = Noise(0.2)
28
29 # LFOs to modulate every parameters of the Vocoder object.
30 lf1 = Sine(freq=0.1, phase=random()).range(60, 100)
31 lf2 = Sine(freq=0.11, phase=random()).range(1.05, 1.5)
32 lf3 = Sine(freq=0.07, phase=random()).range(1, 20)
33 lf4 = Sine(freq=0.06, phase=random()).range(0.01, 0.99)
34
35 voc = Vocoder(spktrm, excite, freq=lf1, spread=lf2, q=lf3, slope=lf4, stages=32).out()
36
37 s.gui(locals())
38