def get_length_audio(audiopath, extension):
 try:
  audio = AudioSegment.from_file(audiopath, extension.replace('.', ''))
 except:
  print ('Error in get_length_audio(): %s' % traceback.format_exc())
  return None
 return int((len(audio) / 1000.0))

def get_length_audio ( audiopath , extension ) : try : audio = AudioSegment . from_file ( audiopath , extension . replace ( '.' , '' ) ) except : print ( 'Error in get_length_audio(): %s' % traceback . format_exc ( ) ) return None return int ( ( len ( audio ) / 1000.0 ) )
returns length of audio in seconds .