File size: 340 Bytes
412403d
3fdf8ae
412403d
 
 
 
3fdf8ae
412403d
1
2
3
4
5
6
7
8
# Function to apply a high-pass filter
from scipy.signal import butter, lfilter
def high_pass_filter(audio, sr, cutoff=300):
    nyquist = 0.5 * sr
    normal_cutoff = cutoff / nyquist
    b, a = butter(1, normal_cutoff, btype='high', analog=False)
    filtered_audio = lfilter(b, a, audio)  # ✅ Correct function
    return filtered_audio