Beispiel #1
0
 def test_is_mp3(self):
   """Tests MP3 detection."""
   self.assertTrue(utils.is_mp3(self.mp3_file))
   self.assertTrue(utils.is_mp3(self.hidden_mp3_file))
   self.assertFalse(utils.is_mp3(self.wav_file))
   self.assertFalse(utils.is_mp3(self.hidden_wav_file))
   self.assertFalse(utils.is_mp3(self.text_file))
   self.assertFalse(utils.is_mp3(self.fake_wav_file))
   self.assertFalse(utils.is_mp3(self.fake_mp3_file))
Beispiel #2
0
def normalize_file(path):
    """Normalizes a file in either MP3 or WAVE format to single channel WAVE.

  Args:
    path: The path to the MP3 or WAVE file.

  Returns:
    The normalized mono channel WAVE file.
  """
    f = file(path)
    if utils.is_mp3(f.name):
        f = mp3_to_wav(f.name)
    f = normalize_wave_file(f.name)
    return f