promo.morph_utils.audio_scripts API documentation

# promo.morph_utils.audio_scripts

Created on Aug 23, 2014

@author: tmahrt

View Source

     1"""
     2Created on Aug 23, 2014
     3
     4@author: tmahrt
     5"""
     6
     7import wave
     8
     9
    10def getSoundFileDuration(fn):
    11    """
    12    Returns the duration of a wav file (in seconds)
    13    """
    14    audiofile = wave.open(fn, "r")
    15
    16    params = audiofile.getparams()
    17    framerate = params[2]
    18    nframes = params[3]
    19
    20    duration = float(nframes) / framerate
    21    return duration

def getSoundFileDuration(fn): View Source

    11def getSoundFileDuration(fn):
    12    """
    13    Returns the duration of a wav file (in seconds)
    14    """
    15    audiofile = wave.open(fn, "r")
    16
    17    params = audiofile.getparams()
    18    framerate = params[2]
    19    nframes = params[3]
    20
    21    duration = float(nframes) / framerate
    22    return duration

Returns the duration of a wav file (in seconds)