code: import librosa
  import soundfile
  import os, glob, pickle
  import numpy as np
  from sklearn.model_selection import train_test_split
  from sklearn.neural_network import MLPClassifier
  from sklearn.metrics import accuracy_score
  
  def extract_feature(file_name, mfcc, chroma, mel):
      with soundfile.SoundFile(file_name) as sound_file:
          X = sound_file.read(dtype="float32")
          sample_rate=sound_file.samplerate
          if chroma:
              stft=np.abs(librosa.stft(X))
          result=np.array([])
          if mfcc:
              mfccs=np.mean(librosa.feature.mfcc(y=X, sr=sample_rate, n_mfcc=40).T, axis=0)
              result=np.hstack((result, mfccs))
          if chroma:
              chroma=np.mean(librosa.feature.chroma_stft(S=stft, sr=sample_rate).T,axis=0)
              result=np.hstack((result, chroma))
          if mel:
              mel=np.mean(librosa.feature.melspectrogram(X, sr=sample_rate).T,axis=0)
              result=np.hstack((result, mel))
      return result
  
  emotions={
    '01':'neutral',
    '02':'calm',
    '03':'happy',
    '04':'sad',
    '05':'angry',
    '06':'fearful',
    '07':'disgust',
    '08':'surprised'
  }
  #DataFlair - Emotions to observe
  observed_emotions=['calm', 'happy', 'fearful', 'disgust'] 
  
  def load_data(ts):
      tr=abs(1-ts)
      x,y=[],[]
      for file in glob.glob("D:\\python\\dl programs\\SP\\DATA\\Actor_*\\*.wav"):
          file_name=os.path.basename(file)
          emotion=emotions[file_name.split("-")[2]]
          print(emotion)
          if emotion not in observed_emotions:
              continue
          feature=extract_feature(file, mfcc=True, chroma=True, mel=True)
          x.append(feature)
          y.append(emotion)
      return train_test_split(np.array(x), y, test_size=ts, train_size=tr ,random_state=9)
  ts=0.25
  load_data(ts)
  x_train,x_test,y_train,y_test=load_data(ts)
  print((x_train.shape[0], x_test.shape[0]))
  print(f'Features extracted: {x_train.shape[1]}')
  #DataFlair - Initialize the Multi Layer Perceptron Classifier
  model=MLPClassifier(alpha=0.01, batch_size=256, epsilon=1e-08, hidden_layer_sizes=(300,), learning_rate='adaptive', max_iter=500)
  model.fit(x_train,y_train)
  y_pred=model.predict(x_test)
  accuracy=accuracy_score(y_true=y_test, y_pred=y_pred)
  #DataFlair - Print the accuracy
  print("Accuracy: {:.2f}%".format(accuracy*100))
  
apis: sklearn.metrics.accuracy_score sklearn.neural_network.MLPClassifier numpy.hstack numpy.array