smart_interview_analyser / speech_analysis.py
asmithaaa's picture
Upload 40 files
438c749 verified
raw
history blame contribute delete
285 Bytes
import wave
def speech_rate(audio_path, text):
with wave.open(audio_path, 'r') as f:
frames = f.getnframes()
rate = f.getframerate()
duration = frames / float(rate)
words = len(text.split())
wpm = (words / duration) * 60
return round(wpm, 2)