mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
commit
209abf43ea
@ -58,7 +58,7 @@ def type_checking(audio_in: Union[str, bytes],
|
||||
if r_recog_type is None and audio_in is not None:
|
||||
# audio_in is wav, recog_type is wav_file
|
||||
if os.path.isfile(audio_in):
|
||||
audio_type = os.path.basename(audio_in).split(".")[1].lower()
|
||||
audio_type = os.path.basename(audio_in).split(".")[-1].lower()
|
||||
if audio_type in SUPPORT_AUDIO_TYPE_SETS:
|
||||
r_recog_type = 'wav'
|
||||
r_audio_format = 'wav'
|
||||
@ -128,7 +128,7 @@ def get_sr_from_bytes(wav: bytes):
|
||||
def get_sr_from_wav(fname: str):
|
||||
fs = None
|
||||
if os.path.isfile(fname):
|
||||
audio_type = os.path.basename(fname).split(".")[1].lower()
|
||||
audio_type = os.path.basename(fname).split(".")[-1].lower()
|
||||
if audio_type in SUPPORT_AUDIO_TYPE_SETS:
|
||||
if audio_type == "pcm":
|
||||
fs = None
|
||||
@ -140,7 +140,7 @@ def get_sr_from_wav(fname: str):
|
||||
for file in dir_files:
|
||||
file_path = os.path.join(fname, file)
|
||||
if os.path.isfile(file_path):
|
||||
audio_type = os.path.basename(file_path).split(".")[1].lower()
|
||||
audio_type = os.path.basename(file_path).split(".")[-1].lower()
|
||||
if audio_type in SUPPORT_AUDIO_TYPE_SETS:
|
||||
fs = get_sr_from_wav(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
@ -158,7 +158,7 @@ def find_file_by_ends(dir_path: str, ends: str):
|
||||
file_path = os.path.join(dir_path, file)
|
||||
if os.path.isfile(file_path):
|
||||
if ends == ".wav" or ends == ".WAV":
|
||||
audio_type = os.path.basename(file_path).split(".")[1].lower()
|
||||
audio_type = os.path.basename(file_path).split(".")[-1].lower()
|
||||
if audio_type in SUPPORT_AUDIO_TYPE_SETS:
|
||||
return True
|
||||
else:
|
||||
@ -178,7 +178,7 @@ def recursion_dir_all_wav(wav_list, dir_path: str) -> List[str]:
|
||||
for file in dir_files:
|
||||
file_path = os.path.join(dir_path, file)
|
||||
if os.path.isfile(file_path):
|
||||
audio_type = os.path.basename(file_path).split(".")[1].lower()
|
||||
audio_type = os.path.basename(file_path).split(".")[-1].lower()
|
||||
if audio_type in SUPPORT_AUDIO_TYPE_SETS:
|
||||
wav_list.append(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user