b62fe62
1
2
3
4
5
6
7
8
9
10
11
12
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