def readWavFile(filename):
 try:
  (sampleRate, data) = wavfile.read(filename)
 except Exception:
  if (os.path.exists(filename) and os.path.isfile(filename)):
   core.wait(0.01, 0)
  try:
   (sampleRate, data) = wavfile.read(filename)
  except Exception:
   msg = 'Failed to open wav sound file "%s"'
   raise SoundFileError((msg % filename))
 if (data.dtype != 'int16'):
  msg = 'expected `int16` data in .wav file %s'
  raise AttributeError((msg % filename))
 if ((len(data.shape) == 2) and (data.shape[1] == 2)):
  data = data.transpose()
  data = data[0]
 return (data, sampleRate)

def readWavFile ( filename ) : try : ( sampleRate , data ) = wavfile . read ( filename ) except Exception : if ( os . path . exists ( filename ) and os . path . isfile ( filename ) ) : core . wait ( 0.01 , 0 ) try : ( sampleRate , data ) = wavfile . read ( filename ) except Exception : msg = 'Failed to open wav sound file "%s"' raise SoundFileError ( ( msg % filename ) ) if ( data . dtype != 'int16' ) : msg = 'expected `int16` data in .wav file %s' raise AttributeError ( ( msg % filename ) ) if ( ( len ( data . shape ) == 2 ) and ( data . shape [ 1 ] == 2 ) ) : data = data . transpose ( ) data = data [ 0 ] return ( data , sampleRate )
return as read from a wav file .