File: 04-rms-tracing.rst.txt

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 (35 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (2)
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
04-rms-tracing.py - Auto-wah effect.
============================================================================================================================================


The auto-wah effect (also know as "envelope following filter") is like a
wah-wah effect, but instead of being controlled by a pedal, it is the RMS
amplitude of the input sound which control it. The envelope follower (RMS)
is rescaled and used to change the frequency of a bandpass filter applied
to the source.

.. code-block:: python

    from pyo import *
    
    s = Server().boot()
    
    MINFREQ = 250
    MAXFREQ = 5000
    
    # Play the drum lopp.
    sf = SfPlayer("../snds/drumloop.wav", loop=True)
    
    # Follow the amplitude envelope of the input sound.
    follow = Follower(sf)
    
    # Scale the amplitude envelope (0 -> 1) to the desired frequency
    # range (MINFREQ -> MAXFREQ).
    freq = Scale(follow, outmin=MINFREQ, outmax=MAXFREQ)
    
    # Filter the signal with a band pass. Play with the Q to make the
    # effect more or less present.
    filter = ButBP(sf.mix(2), freq=freq, q=2).out()
    
    s.gui(locals())