| 1 |
""" |
| 2 |
03-fuzz-disto.py - Hand-written asymmetrical tranfert function. |
| 3 |
|
| 4 |
This example implements a fuzz distortion. Bandpass filtered signal is |
| 5 |
eavily boosted, then feeded to an asymmetrical transfert function, and |
| 6 |
finally lowpass filtered to smooth out the sound. Balance between the |
| 7 |
dry and the distorted sound is applied before sending the signal to the |
| 8 |
outputs. |
| 9 |
|
| 10 |
Builtin objects to distort an audio signal: |
| 11 |
|
| 12 |
Disto, Clip, Mirror, Wrap |
| 13 |
|
| 14 |
Degrade object applies some kind of distortion to a signal by changing |
| 15 |
its sampling rate and bit depth. |
| 16 |
|
| 17 |
""" |
| 18 |
from pyo import * |
| 19 |
|
| 20 |
s = Server(duplex=0).boot() |
| 21 |
|
| 22 |
|
| 23 |
SOURCE = "../snds/flute.aif" |
| 24 |
|
| 25 |
|
| 26 |
BP_CENTER_FREQ = 400 |
| 27 |
BP_Q = 3 |
| 28 |
BOOST = 25 |
| 29 |
LP_CUTOFF_FREQ = 3000 |
| 30 |
BALANCE = 0.7 |
| 31 |
|
| 32 |
src = SfPlayer(SOURCE, loop=True).mix(2) |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
table = ExpTable([(0, -0.25), (4096, 0), (8192, 0)], exp=30) |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
high_table = ExpTable([(0, 1), (2000, 1), (4096, 0), (4598, 0), (8192, 0)], exp=5, inverse=False) |
| 43 |
nd |
| 44 |
|
| 45 |
high_table.reverse() |
| 46 |
|
| 47 |
|
| 48 |
table.add(high_table) |
| 49 |
|
| 50 |
|
| 51 |
table.view(title="Transfert function") |
| 52 |
|
| 53 |
|
| 54 |
bp = ButBP(src, freq=BP_CENTER_FREQ, q=BP_Q) |
| 55 |
boost = Sig(bp, mul=BOOST) |
| 56 |
|
| 57 |
|
| 58 |
sig = Lookup(table, boost) |
| 59 |
|
| 60 |
|
| 61 |
lp = ButLP(sig, freq=LP_CUTOFF_FREQ, mul=0.7) |
| 62 |
|
| 63 |
|
| 64 |
mixed = Interp(src, lp, interp=BALANCE) |
| 65 |
|
| 66 |
|
| 67 |
out = (mixed * 0.3).out() |
| 68 |
|
| 69 |
|
| 70 |
sc = Scope(mixed) |
| 71 |
|
| 72 |
s.gui(locals()) |