Commit 230f0071 authored by LucasDANIELE's avatar LucasDANIELE
Browse files

ajout barre de progression

parent 24ca170c
......@@ -10,6 +10,7 @@ from scipy.io import wavfile
import matplotlib.pyplot as plt
import numpy as np
import frequency_estimator as f0
import os
def listen(nom,sampleRate, data):
......@@ -33,6 +34,8 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen):
d=0
f=0
for i in range(0,int(np.round(dureeExtrait)*sampleRateChoosen-step)-1000):
if (i%40000==0):
afficherAvancement(i,int(np.round(dureeExtrait)*sampleRateChoosen-step)-1000)
if ((abs(data[int(np.round(i*echelle))])<seuil) & onAir):
if(k<step):
k+=1
......@@ -53,7 +56,16 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen):
DATA.append([d,len(data)-1])
return DATA
def afficherAvancement(t,T):
os.system('clear')
barre = "|"
for i in range(int(np.round(np.round(t/T,2)*50))):
barre += "#"
for i in range(50-int(np.round(np.round(t/T,2)*50))):
barre += " "
barre +="| "
barre += str(np.round(t/T,2)) + " %"
print(barre)
def garderUniquementCris(sampleRate,tMin, tMax, fMin, fMax, f0Func, dataCut, data):
nSamplesMin = tMin*sampleRate
......
......@@ -81,16 +81,12 @@ def freq_from_HPS(sig, fs):
resarray = []
for x in range(2, maxharms):
a = copy(c[::x]) # Should average or maximum instead of decimating
# max(c[::x],c[1::x],c[2::x],...)
c = c[:len(a)]
i = argmax(abs(c))
true_i = parabolic(abs(c), i)[0]
res = fs * true_i / len(windowed)
resarray.append(res)
#print('Pass %d: %f Hz' % (x, res))
c *= a
#plt.subplot(maxharms, 1, x)
#plt.plot(log(c))
show()
return mean(resarray[1:3])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment