MCPcopy Create free account
hub / github.com/FireRedTeam/FireRedASR / get_wav_info

Function get_wav_info

fireredasr/speech2text.py:81–99  ·  view source on GitHub ↗

Returns: wavs: list of (uttid, wav_path)

(args)

Source from the content-addressed store, hash-verified

79
80
81def get_wav_info(args):
82 """
83 Returns:
84 wavs: list of (uttid, wav_path)
85 """
86 base = lambda p: os.path.basename(p).replace(".wav", "")
87 if args.wav_path:
88 wavs = [(base(args.wav_path), args.wav_path)]
89 elif args.wav_paths and len(args.wav_paths) >= 1:
90 wavs = [(base(p), p) for p in sorted(args.wav_paths)]
91 elif args.wav_scp:
92 wavs = [line.strip().split() for line in open(args.wav_scp)]
93 elif args.wav_dir:
94 wavs = glob.glob(f"{args.wav_dir}/**/*.wav", recursive=True)
95 wavs = [(base(p), p) for p in sorted(wavs)]
96 else:
97 raise ValueError("Please provide valid wav info")
98 print(f"#wavs={len(wavs)}")
99 return wavs
100
101
102if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected