23 lines
603 B
Python
23 lines
603 B
Python
import wave
|
|
|
|
extraits = ["extrait_cri3.wav", "extrait_cri4.wav"]
|
|
pokemons = ["wav\\{:03d}.wav".format(i) for i in range(1, 45+1)]
|
|
|
|
def extract(filename):
|
|
sound = wave.open(filename)
|
|
return sound.readframes(sound.getnframes())
|
|
|
|
def compare(ext_long, ext_short):
|
|
if ext_long.find(ext_short) != -1:
|
|
return True
|
|
return False
|
|
|
|
extraits_data = [extract(i) for i in extraits]
|
|
pokemons_data = [extract(i) for i in pokemons]
|
|
|
|
for ext_short in extraits_data:
|
|
for i in range(len(pokemons_data)):
|
|
if compare(pokemons_data[i], ext_short):
|
|
print(i+1)
|
|
break
|