Debian Codegraph @

docs/_sources/examples/06-filters/01-lowpass-filters.rst.txt

raw
1 01-lowpass-filters.py - The effect of the order of a filter.
2 ============================================================================================================================================
3
4
5 For this first example about filtering, we compare the frequency
6 spectrum of three common lowpass filters.
7
8 - Tone : IIR first-order lowpass
9 - ButLP : IIR second-order lowpass (Butterworth)
10 - MoogLP : IIR fourth-order lowpass (+ resonance as an extra parameter)
11
12 Complementary highpass filters for the Tone and ButLP objects are Atone
13 and ButHP. Another common highpass filter is the DCBlock object, which
14 can be used to remove DC component from an audio signal.
15
16 The next example will present bandpass filters.
17
18 .. code-block:: python
19
20 from pyo import *
21
22 s = Server().boot()
23
24 # White noise generator
25 n = Noise(0.5)
26
27 # Common cutoff frequency control
28 freq = Sig(1000)
29 freq.ctrl([SLMap(50, 5000, "lin", "value", 1000)], title="Cutoff Frequency")
30
31 # Three different lowpass filters
32 tone = Tone(n, freq)
33 butlp = ButLP(n, freq)
34 mooglp = MoogLP(n, freq)
35
36 # Interpolates between input objects to produce a single output
37 sel = Selector([tone, butlp, mooglp]).out()
38 sel.ctrl(title="Filter selector (0=Tone, 1=ButLP, 2=MoogLP)")
39
40 # Displays the spectrum contents of the chosen source
41 sp = Spectrum(sel)
42
43 s.gui(locals())
44