def load_data_file(self): outputdata = [] for f in gb.glob("/media/vyassu/OS/Users/vyas/Documents/Assigments/BigData/AudioData/DC/*.wav"): frate, inputdata = sc.read(f) pitch=lp.getPitch(f) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) else: emotion = filename[0] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) outputdata.append(list([loudness,pitch, emotion])) for f in gb.glob("/media/vyassu/OS/Users/vyas/Documents/Assigments/BigData/AudioData/JE/*.wav"): frate, inputdata = sc.read(f) pitch = lp.getPitch(f) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) else: emotion = filename[0] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) outputdata.append(list([loudness, pitch, emotion])) for f in gb.glob("/media/vyassu/OS/Users/vyas/Documents/Assigments/BigData/AudioData/JK/*.wav"): frate, inputdata = sc.read(f) pitch = lp.getPitch(f) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) else: emotion = filename[0] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) outputdata.append(list([loudness, pitch, emotion])) for f in gb.glob("/media/vyassu/OS/Users/vyas/Documents/Assigments/BigData/AudioData/KL/*.wav"): frate, inputdata = sc.read(f) pitch = lp.getPitch(f) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) else: emotion = filename[0] ##emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) outputdata.append(list([loudness, pitch, emotion])) return outputdata
def dataconverter(filename): frate,inputdata = sc.read(filename=filename) pitch = lp.getPitch(filename, frate) emotion = "" loudness = abs(an.loudness(inputdata)) filename = filename.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] emotion = ord(emotion[0])+ord(emotion[1]) else: emotion = filename[0] emotion = float(ord(emotion))/100 return [float(loudness), float(pitch), emotion]
def dataconverter(filename): frate, inputdata = sc.read(filename=filename) pitch = lp.getPitch(filename, frate) emotion = "" loudness = abs(an.loudness(inputdata)) filename = filename.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] emotion = ord(emotion[0]) + ord(emotion[1]) else: emotion = filename[0] emotion = float(ord(emotion)) / 100 return [float(loudness), float(pitch), emotion]
def load_data(self, filename): outputdata = [] # Loop to traverse through the input data file path for f in gb.glob(filename): frate, inputdata = sc.read(f) pitch = lp.getPitch(f, frate) loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] else: emotion = filename[0] outputdata.append(list([loudness, pitch, emotion])) return outputdata
def load_data(self,filename): outputdata=[] # Loop to traverse through the input data file path for f in gb.glob(filename): frate, inputdata = sc.read(f) pitch = lp.getPitch(f,frate) loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] else: emotion = filename[0] outputdata.append(list([loudness, pitch, emotion])) return outputdata
def load_data(self): datadirectory = self.working_directory+"Data/" outputdata=[] for f in gb.glob(datadirectory+"*.wav"): frate, inputdata = sc.read(f) pitch = lp.getPitch(f,frate) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] else: emotion = filename[0] outputdata.append(list([loudness, pitch, emotion])) return outputdata
def load_data_file(self): outputdata = [] for f in gb.glob( "/media/vyassu/OS/Users/vyas/Documents/Assigments/BigData/AudioData/KL/*.wav" ): frate, inputdata = sc.read(f) pitch = lp.getPitch(f, frate) emotion = "" loudness = abs(an.loudness(inputdata)) filename = f.split("/")[-1].split(".")[0] if filename[0] == "s": emotion = filename[0:2] emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) else: emotion = filename[0] emotion = float(int(hashlib.md5(emotion).hexdigest(), 16)) outputdata.append(list([loudness, pitch, emotion])) return outputdata
def load_data_file(self, audiodatapath): outputdata = [] # Variable to store the speech features and emotions # Looping all the wave files present in the path for f in gb.glob(audiodatapath): frate, inputdata = sc.read(f) # Extracting the pitch from the wav file using Aubio speech API pitch = lp.getPitch(f, frate) # Extracting loudness of the voice from the Wave file loudness = abs(an.loudness(inputdata)) # Extracting the emotion type from the wave file only for training stage filename = f.split("/")[-1].split(".")[0] # Condition to differentiate the various types of emotions if filename[0] == "s": emotion = filename[0:2] else: emotion = filename[0] # Creating the dataset consisting of list of features and corresponding emotion type outputdata.append(list([loudness, pitch, emotion])) return outputdata
def load_data_file(self): outputdata = [] # Variable to store the speech features and emotions # Looping all the wave files present in the path for f in gb.glob(self.working_directory+"AudioData/*/*.wav"): frate, inputdata = sc.read(f) # Extracting the pitch from the wav file using Aubio speech API pitch=lp.getPitch(f,frate) # Extracting loudness of the voice from the Wave file loudness = abs(an.loudness(inputdata)) # Extracting the emotion type from the wave file only for training stage filename = f.split("/")[-1].split(".")[0] # Condition to differentiate the various types of emotions if filename[0] == "s": emotion = filename[0:2] else: emotion = filename[0] # Creating the dataset consisting of list of features and corresponding emotion type outputdata.append(list([loudness,pitch, emotion])) return outputdata