From 61fc42ff82fcaa7f8ee2a87891aed899973a94ad Mon Sep 17 00:00:00 2001 From: Jael Gu Date: Mon, 6 Jun 2022 17:19:39 +0800 Subject: [PATCH] Remove torchaudio Signed-off-by: Jael Gu --- vggish_input.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/vggish_input.py b/vggish_input.py index 0bf432c..5c1ea6d 100644 --- a/vggish_input.py +++ b/vggish_input.py @@ -23,8 +23,6 @@ import resampy import mel_features import vggish_params -import torchaudio - def waveform_to_examples(data, sample_rate, return_tensor=True): """Converts audio waveform into an array of examples for VGGish. @@ -78,22 +76,3 @@ def waveform_to_examples(data, sample_rate, return_tensor=True): log_mel_examples, requires_grad=True)[:, None, :, :].float() return log_mel_examples - - -def wavfile_to_examples(wav_file, return_tensor=True): - """ - Convenience wrapper around waveform_to_examples() for a common WAV format. - - Args: - wav_file: - String path to a file, or a file-like object. - The file is assumed to contain WAV audio data with signed 16-bit PCM samples. - return_tensor: - Return data as a Pytorch tensor ready for VGGish - - Returns: - See waveform_to_examples. - """ - data, sr = torchaudio.load(wav_file) - wav_data = data.detach().numpy().transpose() - return waveform_to_examples(wav_data, sr, return_tensor)