import numpy as np
import matplotlib.pyplot as plt
import torch
import seaborn as sns
from functools import partial
sns.reset_defaults()="talk", font_scale=1)
sns.set_context(context%matplotlib inline
%config InlineBackend.figure_format='retina'
Basic Imports
import librosa
= librosa.load("/Users/nipun/Downloads/external-sensors_data_audio_audacity_recorded-mask-tidal-breathing.wav") y, sr
plt.plot(y), sr
from scipy import signal
from scipy.fft import fft, fftfreq
= fft(y)
yf = fftfreq(len(y), 1 / sr)
xf
abs(yf), lw=0.1)
plt.plot(xf, np.0, 1000)) plt.xlim((
= y,Fs=sr);
plt.specgram(x #plt.ylim((0, 100))
plt.colorbar()
= signal.butter(10, 20, 'lp', fs=sr, output='sos')
sos = signal.sosfilt(sos, y)
filtered
plt.plot(y) plt.plot(filtered)
plt.plot(filtered)
= filtered,Fs=sr);
plt.specgram(x #plt.ylim((0, 100))
plt.colorbar()