Update utils.py

This commit is contained in:
Sam Khoze authored and GitHub committed 2024-07-10 23:14:07 +05:30
1 parent 20ab8904cc
commit b422205acd
1 file changed
+1
+1
View File
@@ -165,6 +165,7 @@ def get_audio(file, start_time=0, duration=0):
audio = torch.frombuffer(bytearray(res.stdout), dtype=torch.float32) audio = torch.frombuffer(bytearray(res.stdout), dtype=torch.float32)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
audio = torch.zeros(1,2) audio = torch.zeros(1,2)
return {'waveform': audio, 'sample_rate': '16000'}
match = re.search(', (\\d+) Hz, (\\w+), ',res.stderr.decode('utf-8')) match = re.search(', (\\d+) Hz, (\\w+), ',res.stderr.decode('utf-8'))
if match: if match:
ar = int(match.group(1)) ar = int(match.group(1))