import contextlib
import wave


def read_wave_duration(path):
    """ Read the length of .wav file (mutagen does not handle this) """
    with contextlib.closing(wave.open(path,'r')) as f:
        frames   = f.getnframes()
        rate     = f.getframerate()
        duration = frames/float(rate)
        return duration