25 from scipy.io
import wavfile
41 def soxDenoise(self, user, audio_type, audio_file, denoised_audio_file, scale):
42 if not os.path.isfile(audio_file):
43 return "The audio file does not exist"
45 if scale < 0
or scale > 1:
46 return "Invalid scale. Scale must be between [0,1]"
48 if ".wav" not in audio_file:
49 return "The file for denoising is not wav"
50 samp_freq, signal = wavfile.read(audio_file)
51 if len(signal.shape) != 1:
52 return "The file for denoising has not 1 channel"
55 directory = os.path.expanduser(
"~/rapp_platform_files/audio_processing/") + user
56 noise_profile = directory +
"/noise_profile/noise_profile_" + audio_type
58 if not os.path.isfile(noise_profile):
59 return "No noise profile for the " + audio_type +
" type exists"
61 command =
"sox " + audio_file +
" " + denoised_audio_file +\
62 " noisered " + noise_profile +
" " + str(scale)
63 com_res = os.system(command)
66 return "System sox malfunctioned"
def soxDenoise
Performs denoising employing Sox apllication.
Performs denoising on an audio file employing Sox application.