Files
pyDefis/À la recherche des cris perdus (1).py
Francois JUMELLE 20526d93c8 Initial release
2021-05-03 22:32:40 +02:00

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