Spaces:
Sleeping
Sleeping
Create highPassFilter.py
Browse files- highPassFilter.py +7 -0
highPassFilter.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Function to apply a high-pass filter
|
| 2 |
+
def high_pass_filter(audio, sr, cutoff=300):
|
| 3 |
+
nyquist = 0.5 * sr
|
| 4 |
+
normal_cutoff = cutoff / nyquist
|
| 5 |
+
b, a = butter(1, normal_cutoff, btype='high', analog=False)
|
| 6 |
+
filtered_audio = lfilter(b, a, audio)
|
| 7 |
+
return filtered_audio
|