Example #1
0
def trainRegressionWrapper(method, beat_feats, dirName, model_name):
    aT.feature_extraction_train_regression(dirName,
                                           1,
                                           1,
                                           aT.shortTermWindow,
                                           aT.shortTermStep,
                                           method.lower(),
                                           model_name,
                                           compute_beat=beat_feats)
Example #2
0
def auto_test_regression(path, mode_path, mode_type, answer_name):
    path_v1 = os.path.join(path, "*")
    path_list = glob.glob(path_v1)
    path_list.pop(0)
    wav_file_list = [[] for i in range(len(path_list))]
    f = open(answer_name + ".txt", 'w')

    # for num, i in enumerate(path_list):
    #     for string in step_params.container().get_music_type():
    #         x = os.path.join(i, string)
    #         y = glob.glob(x)
    #         wav_file_list[num].extend(y)
    audioTrainTest.feature_extraction_train_regression(path_list[0], 10, 10,
                                                       0.2, 0, 2, mode_type,
                                                       "svm1")
    f.close()
from pyAudioAnalysis import ShortTermFeatures as stf
from pyAudioAnalysis import audioSegmentation
import pyAudioAnalysis
import sounddevice as sd
from scipy.io.wavfile import write
from pyAudioAnalysis import audioTrainTest as aT
import boto3
import time

fs = 44100  # Sample rate
seconds = 30  # Duration of recording It likes long recordings better for speaker diarization

result = "whatever you want, I don't know yet"

aT.feature_extraction_train_regression("data/speechEmotion/", 1, 1,
                                       aT.shortTermWindow, aT.shortTermStep,
                                       "svm", "data/svmSpeechEmotion", False)


def GenrePicker(valence, arousal, people):
    print(valence, arousal, people)
    if people <= 3:
        if valence > 0.25:  #Very Happy
            if arousal > 0.25:  #very Excited
                return ("Pop")
            elif arousal > -0.25:  #neutral Exitement
                return ("Hip-Hop")
            else:
                return ("Lofi Beats")  #Low Energy
        elif valence > -0.25:  #Neutral Happy
            if arousal > 0.25:
Example #4
0
                       'hmmTemp1', 1.0, 1.0)
aS.train_hmm_from_directory(root_data_path + 'radioFinal/small', 'hmmTemp2',
                            1.0, 1.0)
aS.hmm_segmentation(root_data_path + 'pyAudioAnalysis/data//scottish.wav',
                    'hmmTemp1', True, root_data_path +
                    'pyAudioAnalysis/data//scottish.segments')  # test 1
aS.hmm_segmentation(root_data_path + 'pyAudioAnalysis/data//scottish.wav',
                    'hmmTemp2', True, root_data_path +
                    'pyAudioAnalysis/data//scottish.segments')  # test 2

print("\n\n\n * * * TEST 7 * * * \n\n\n")
aT.feature_extraction_train_regression(root_data_path +
                                       "pyAudioAnalysis/data/speechEmotion",
                                       1,
                                       1,
                                       0.050,
                                       0.050,
                                       "svm_rbf",
                                       "temp.mod",
                                       compute_beat=False)
print(
    aT.file_regression(
        root_data_path + "pyAudioAnalysis/data/speechEmotion/01.wav",
        "temp.mod", "svm_rbf"))

print("\n\n\n * * * TEST 8 * * * \n\n\n")
aT.feature_extraction_train_regression(root_data_path +
                                       "pyAudioAnalysis/data/speechEmotion",
                                       1,
                                       1,
                                       0.050,