def getRMS(data):
 def _rms(data):
  'Audio loudness / power, as rms; ~2x faster than std()\n        '
  if (len(data.shape) > 1):
   return np.std(data, axis=1)
  return np.std(data)
 if isinstance(data, basestring):
  if (not os.path.isfile(data)):
   raise ValueError(('getRMS: could not find file %s' % data))
  (_junk, data) = wavfile.read(data)
  data_tr = np.transpose(data)
  data = (data_tr / 32768.0)
 elif (not isinstance(data, np.ndarray)):
  data = np.array(data).astype(np.float)
 return _rms(data)

def getRMS ( data ) : def _rms ( data ) : if ( len ( data . shape ) > 1 ) : return np . std ( data , axis = 1 ) return np . std ( data ) if isinstance ( data , basestring ) : if ( not os . path . isfile ( data ) ) : raise ValueError ( ( 'getRMS: could not find file %s' % data ) ) ( _junk , data ) = wavfile . read ( data ) data_tr = np . transpose ( data ) data = ( data_tr / 32768.0 ) elif ( not isinstance ( data , np . ndarray ) ) : data = np . array ( data ) . astype ( np . float ) return _rms ( data )
compute and return the audio power .