Skip to content

Commit

Permalink
add a nice progress bar with tqdm
Browse files Browse the repository at this point in the history
  • Loading branch information
daedalus committed Feb 24, 2023
1 parent 6f819ba commit 2ca8b05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import matplotlib.pyplot as plt

from scipy import signal

from tqdm import tqdm

def load_wav(fpath):
"""Loads a .wav file and returns the data and sample rate.
Expand Down Expand Up @@ -97,7 +97,7 @@ def quadratic_interpolation(data, max_idx, bin_size):
bin_size = f[1] - f[0]

max_freqs = []
for spectrum in np.abs(np.transpose(Zxx)):
for spectrum in tqdm(np.abs(np.transpose(Zxx))):
max_amp = np.amax(spectrum)
max_freq_idx = np.where(spectrum == max_amp)[0][0]

Expand Down Expand Up @@ -152,7 +152,7 @@ def search(target_enf, reference_enf):
:returns: list of tuples of (reference index, PMCC), sorted desc by PMCC
"""
n_steps = len(reference_enf) - len(target_enf)
reference_enfs = (reference_enf[step:step+len(target_enf)] for step in range(n_steps))
reference_enfs = (reference_enf[step:step+len(target_enf)] for step in tqdm(range(n_steps)))

coeffs = sorted_pmccs(target_enf, reference_enfs)
return coeffs
Expand Down

0 comments on commit 2ca8b05

Please sign in to comment.