AI-API / functions /utils.py
Anicet
update: add dioula models for STT and TTS
a6299ef
Raw
History Blame Contribute Delete
289 Bytes
import soundfile as sf
def getAudioDuration(filePath: str) -> float:
try:
data, samplerate = sf.read(filePath)
duration = len(data) / samplerate
return duration
except Exception as e:
print(f"Error getting audio duration: {e}")
return 0.0