Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not(options.vit_pitch_output_file is None):
print " estimated pitches in", options.vit_pitch_output_file
if not(options.sal_output_file is None):
print " salience file in ", options.sal_output_file
if options.pitch_output_file is None:
options.pitch_output_file = inputAudioFile[:-4]+'_pitches.txt'
try:
from essentia.standard import AudioLoader
loaded = AudioLoader(filename = inputAudioFile)()
audio = loaded[0]
Fs = loaded[1]
nchan = loaded[2]
loaded = AudioLoader(filename = inputAudioFile)()
audio = loaded[0]
if nchan == 1:
data = audio[:,0].transpose()
else:
data = audio
data = np.double(data)/(1.2*abs(data).max())
except:
# Using scipy to import wav
import scipy.io.wavfile as wav
Fs, data = wav.read(inputAudioFile)
# data = np.double(data) / 32768.0 # makes data vary from -1 to 1
scaleData = 1.2 * data.max() # to rescale the data.
data = np.double(data) / scaleData # makes data vary from -1 to 1
options.Fs = Fs
is_stereo = True
if inputAudioFile[-4:] != ".wav":
raise ValueError("File not WAV file? Only WAV format support, for now...")
#print "Writing the different following output files:"
if not(options.vit_pitch_output_file is None):
print " estimated pitches in", options.vit_pitch_output_file
if not(options.sal_output_file is None):
print " salience file in ", options.sal_output_file
if options.pitch_output_file is None:
options.pitch_output_file = inputAudioFile[:-4]+'_pitches.txt'
try:
from essentia.standard import AudioLoader
loaded = AudioLoader(filename = inputAudioFile)()
audio = loaded[0]
Fs = loaded[1]
nchan = loaded[2]
loaded = AudioLoader(filename = inputAudioFile)()
audio = loaded[0]
if nchan == 1:
data = audio[:,0].transpose()
else:
data = audio
data = np.double(data)/(1.2*abs(data).max())
except:
# Using scipy to import wav
import scipy.io.wavfile as wav
Fs, data = wav.read(inputAudioFile)