Debian Codegraph @

pyo/examples/x07-effects/05-hand-made-chorus.py

raw symbols SCIP
1 """
2 06-hand-made-chorus.py - Hand-written 8 delay lines stereo chorus.
3
4 A chorus (or ensemble) is a modulation effect used to create a richer,
5 thicker sound and add subtle movement. The effect roughly simulates
6 the slight variations in pitch and timing that occur when multiple
7 performers sing or play the same part.
8
9 A single voice chorus uses a single delay that creates a single modulated
10 duplicate of the incoming audio. Basic chorus effects and inexpensive guitar
11 pedals are often single-voice.
12
13 A multiple voice chorus uses multiple modulated delays to create a richer
14 sound with more movement than a single voice chorus.
15
16 The Chorus object (from pyo) implements an 8 delay lines chorus and should
17 use less CPU than the hand-written version. this example's purpose is only
18 to show how it works or to be used as a starting point to build an extended
19 version.
20
21 """
22 from pyo import *
23
24 s = Server(duplex=0).boot()
25
26 # Start a source sound.
27 sf = SfPlayer("../snds/baseballmajeur_m.aif", speed=1, loop=True, mul=0.3)
28 # Mix the source in stereo and send the signal to the output.
29 sf2 = sf.mix(2).out()
30
31 # Sets values for 8 LFO'ed delay lines (you can add more if you want!).
32 # LFO frequencies.
33 freqs = [0.254, 0.465, 0.657, 0.879, 1.23, 1.342, 1.654, 1.879]
34 # Center delays in seconds.
35 cdelay = [0.0087, 0.0102, 0.0111, 0.01254, 0.0134, 0.01501, 0.01707, 0.0178]
36 # Modulation depths in seconds.
37 adelay = [0.001, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.002, 0.0023]
38
39 # Create 8 sinusoidal LFOs with center delays "cdelay" and depths "adelay".
40 lfos = Sine(freqs, mul=adelay, add=cdelay)
41
42 # Create 8 modulated delay lines with a little feedback and send the signals
43 # to the output. Streams 1, 3, 5, 7 to the left and streams 2, 4, 6, 8 to the
44 # right (default behaviour of the out() method).
45 delays = Delay(sf, lfos, feedback=0.5, mul=0.5).out()
46
47 s.gui(locals())