Initial release
This commit is contained in:
22
À la recherche des cris perdus (1).py
Normal file
22
À la recherche des cris perdus (1).py
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user