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 ...@@ -10,6 +10,7 @@ from scipy.io import wavfile
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import frequency_estimator as f0 import frequency_estimator as f0
import os
def listen(nom,sampleRate, data): def listen(nom,sampleRate, data):
...@@ -33,6 +34,8 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen): ...@@ -33,6 +34,8 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen):
d=0 d=0
f=0 f=0
for i in range(0,int(np.round(dureeExtrait)*sampleRateChoosen-step)-1000): 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 ((abs(data[int(np.round(i*echelle))])<seuil) & onAir):
if(k<step): if(k<step):
k+=1 k+=1
...@@ -53,7 +56,16 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen): ...@@ -53,7 +56,16 @@ def decouperExtraits(data, seuil, dureeSilence, sampleRate, sampleRateChoosen):
DATA.append([d,len(data)-1]) DATA.append([d,len(data)-1])
return DATA 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): def garderUniquementCris(sampleRate,tMin, tMax, fMin, fMax, f0Func, dataCut, data):
nSamplesMin = tMin*sampleRate nSamplesMin = tMin*sampleRate
......
...@@ -81,16 +81,12 @@ def freq_from_HPS(sig, fs): ...@@ -81,16 +81,12 @@ def freq_from_HPS(sig, fs):
resarray = [] resarray = []
for x in range(2, maxharms): for x in range(2, maxharms):
a = copy(c[::x]) # Should average or maximum instead of decimating a = copy(c[::x]) # Should average or maximum instead of decimating
# max(c[::x],c[1::x],c[2::x],...)
c = c[:len(a)] c = c[:len(a)]
i = argmax(abs(c)) i = argmax(abs(c))
true_i = parabolic(abs(c), i)[0] true_i = parabolic(abs(c), i)[0]
res = fs * true_i / len(windowed) res = fs * true_i / len(windowed)
resarray.append(res) resarray.append(res)
#print('Pass %d: %f Hz' % (x, res))
c *= a c *= a
#plt.subplot(maxharms, 1, x)
#plt.plot(log(c))
show() show()
return mean(resarray[1:3]) 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