Skip to content

Commit 2b1bc19

Browse files
committed
organized and added Algorithmic Reverb
1 parent 3757fc0 commit 2b1bc19

127 files changed

Lines changed: 862 additions & 280 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

6 KB
Binary file not shown.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.

Additional Scripts/testing.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
import matplotlib.pyplot as plt
3+
import numpy as np
4+
import soundfile
5+
import audiofile
6+
import pandas as pd
7+
from scipy import signal
8+
from scipy.io import wavfile
9+
import IPython.display as ipd
10+
from pydub import AudioSegment
11+
from scipy.fftpack import fft, fftfreq, ifft
12+
13+
14+
def apf(x, buffer, Fs, n, delay, gain, amp, rate):
15+
# Calculate time in seconds for the current sample
16+
t = n/Fs
17+
fracDelay = amp * np.sin(2 * np.pi * rate * t)
18+
intDelay = int(np.floor(fracDelay))
19+
frac = fracDelay - intDelay
20+
21+
# Determine indexes for circular buffer
22+
M = len(buffer)
23+
indexC = int(n % M) # Current index
24+
indexD = int((n-delay+intDelay) % M) # Delay index
25+
indexF = int((n-delay+intDelay+1) % M) # Fractional index
26+
27+
# Temp variable for output of delay buffer
28+
w = (1 - frac) * buffer[indexD] + frac * buffer[indexF]
29+
30+
# Temp variable used for the node after the input sum
31+
v = x + (-gain * w)
32+
33+
# Summation at output
34+
out = (gain * v) + w
35+
36+
# Store the current input to delay buffer
37+
buffer[indexC] = v
38+
39+
return out, buffer
40+
41+
#%%
42+
43+
# APFEXAMPLE
44+
# This script uses an all-pass filter function applied to an acoustic
45+
# guitar recording.
46+
#
47+
# See also APF
48+
49+
x, Fs = soundfile.read('AcGtr.wav')
50+
51+
maxDelay = int(np.ceil(0.05 * Fs)) # maximum delay of 50ms
52+
buffer = np.zeros(maxDelay)
53+
54+
d = np.ceil(0.042 * Fs) # 42ms of delay
55+
g = 0.9
56+
57+
rate = 0.9 # Hz (frequency of LFO)
58+
amp = 6 # Range of +/- 6 samples for delay
59+
60+
# Initialize output signal
61+
N = len(x)
62+
out = np.zeros(N)
63+
64+
for n in range(N):
65+
# Use apf function
66+
out[n], buffer = apf(x[n], buffer, Fs, n, d, g, amp, rate)
67+
68+
Audio(out, rate=Fs)

Audio Files/AcGtr.wav

616 KB
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)