Answers for "how to get the duration of audio python"

0

how to get the duration of audio python

import wave
import contextlib
fname = '/tmp/test.wav'
with contextlib.closing(wave.open(fname,'r')) as f:
    frames = f.getnframes()
    rate = f.getframerate()
    duration = frames / float(rate)
    print(duration)
Posted by: Guest on July-16-2020

Code answers related to "how to get the duration of audio python"

Python Answers by Framework

Browse Popular Code Answers by Language