Skip to content

Commit fa663a6

Browse files
committed
Ch. 18 added
1 parent d73e85b commit fa663a6

32 files changed

Lines changed: 2998 additions & 106 deletions
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# BIQUADWAH
2+
# This function can be used to create a wah-wah audio effect.
3+
#
4+
# Input Variables
5+
# x: single sample of the input signal
6+
# Fs: sampling rate
7+
# lfo: used to determine the frequency of LPF
8+
# ff: buffer for feedforward delay
9+
# fb: buffer for feedback delay
10+
# wet: percent of processed signal (dry = 100 - wet)
11+
#
12+
# Use Table 13.1 to calculate LPF bi-quad coefficients.
13+
#
14+
# See also BIQUADPHASER
15+
16+
import numpy as np
17+
18+
def biquadWah(x, Fs, lfo, Q, ff, fb, wet):
19+
# Convert value of LFO to normalized frequency
20+
w0 = 2 * np.pi * lfo / Fs
21+
# Normalize bandwidth
22+
alpha = np.sin(w0)/ (2 * Q)
23+
24+
b0 = (1 - np.cos(w0)) / 2
25+
b1 = 1 - np.cos(w0)
26+
b2 = (1 - np.cos(w0)) / 2
27+
a0 = 1 + alpha
28+
a1 = -2 * np.cos(w0)
29+
a2 = 1 - alpha
30+
31+
# Wet/dry mix
32+
mixPercent = wet # 0 - only dry, 100 - only wet
33+
mix = mixPercent/100
34+
35+
drySig = x
36+
37+
# All-pass filter
38+
wetSig = (b0/a0) * x + (b1/a0) * ff[0] + (b2/a0) * ff[1] - (a1/a0) * fb[0] - (a2/a0) * fb[1]
39+
40+
# Blend parallel paths
41+
out = (1 - mix) * drySig + mix * wetSig
42+
43+
# Iterate buffers for next sample
44+
ff[1] = ff[0]
45+
ff[0] = x
46+
fb[1] = fb[0]
47+
fb[0] = wetSig
48+
49+
return out, ff, fb
6 KB
Binary file not shown.
616 KB
Binary file not shown.

Ch. 17 - Amplitude Envelope Effects/Amplitude Envelope Effects.ipynb

Lines changed: 432 additions & 30 deletions
Large diffs are not rendered by default.
Binary file not shown.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# BIQUADWAH
2+
# This function can be used to create a wah-wah audio effect.
3+
#
4+
# Input Variables
5+
# x: single sample of the input signal
6+
# Fs: sampling rate
7+
# lfo: used to determine the frequency of LPF
8+
# ff: buffer for feedforward delay
9+
# fb: buffer for feedback delay
10+
# wet: percent of processed signal (dry = 100 - wet)
11+
#
12+
# Use Table 13.1 to calculate LPF bi-quad coefficients.
13+
#
14+
# See also BIQUADPHASER
15+
16+
import numpy as np
17+
18+
def biquadWah(x, Fs, lfo, Q, ff, fb, wet):
19+
# Convert value of LFO to normalized frequency
20+
w0 = 2 * np.pi * lfo / Fs
21+
# Normalize bandwidth
22+
alpha = np.sin(w0)/ (2 * Q)
23+
24+
b0 = (1 - np.cos(w0)) / 2
25+
b1 = 1 - np.cos(w0)
26+
b2 = (1 - np.cos(w0)) / 2
27+
a0 = 1 + alpha
28+
a1 = -2 * np.cos(w0)
29+
a2 = 1 - alpha
30+
31+
# Wet/dry mix
32+
mixPercent = wet # 0 - only dry, 100 - only wet
33+
mix = mixPercent/100
34+
35+
drySig = x
36+
37+
# All-pass filter
38+
wetSig = (b0/a0) * x + (b1/a0) * ff[0] + (b2/a0) * ff[1] - (a1/a0) * fb[0] - (a2/a0) * fb[1]
39+
40+
# Blend parallel paths
41+
out = (1 - mix) * drySig + mix * wetSig
42+
43+
# Iterate buffers for next sample
44+
ff[1] = ff[0]
45+
ff[0] = x
46+
fb[1] = fb[0]
47+
fb[0] = wetSig
48+
49+
return out, ff, fb

Ch. 17 - Amplitude Envelope Effects/testing.py

Lines changed: 0 additions & 76 deletions
This file was deleted.
616 KB
Binary file not shown.

Ch. 18 - Dynamic Range Processors/Dynamic Range Processors.ipynb

Lines changed: 1383 additions & 0 deletions
Large diffs are not rendered by default.
511 KB
Binary file not shown.

0 commit comments

Comments
 (0)