Ejemplo n.º 1
0
def afraid_patch(sampleFrequency, speed, depth, utterance_begin):
    filenamein = "/home/dereje/Desktop/TestFolder/Test.wav"
    filenameout = "/home/dereje/Desktop/TestFolder/TestAfraid.wav"

    start_time = [0.001, 0.111862, 0.223777, 0.348351]
    end_time = [0.111862, 0.223777, 0.348351, 0.500]
    start_time = np.asarray(start_time)
    end_time = np.asarray(end_time)
    utterance_begin = np.asarray(utterance_begin)

    n_bend = len(utterance_begin[0])
    cents = [120, -200, 8, 200]

    inflect_start_times = utterance_begin[np.arange(
        len(utterance_begin))] + start_time
    inflect_end_times = utterance_begin[np.arange(
        len(utterance_begin))] + end_time
    inflect_start_times = inflect_start_times.tolist()
    inflect_end_times = inflect_end_times.tolist()

    afraid_patch = Transformer()
    afraid_patch.tremolo(speed, depth)
    afraid_patch.bend(n_bend, inflect_start_times[0], inflect_end_times[0],
                      cents)
    afraid_patch.build(filenamein, filenameout)

    return afraid_patch
Ejemplo n.º 2
0
def happy_patch(sampleFrequency, n_semitones, Qfactor, Gain, utterance_begin):
    filenamein = "/home/dereje/Desktop/TestFolder/Test.wav"
    filenameout = "/home/dereje/Desktop/TestFolder/TestHappy.wav"
    start_time = [0.001, 0.058511, 0.255319, 0.401596]
    end_time = [0.058511, 0.255319, 0.401596, 0.500]
    start_time = np.asarray(start_time)
    end_time = np.asarray(end_time)
    utterance_begin = np.asarray(utterance_begin)
    n_bend = len(utterance_begin[0])
    cents = [-200, +140, 82.667, 0.001]
    happy_patch = Transformer()
    inflect_start_times = utterance_begin[np.arange(
        len(utterance_begin))] + start_time
    inflect_end_times = utterance_begin[np.arange(
        len(utterance_begin))] + end_time
    inflect_start_times = inflect_start_times.tolist()
    inflect_end_times = inflect_end_times.tolist()
    if (sampleFrequency <= 16000):
        cutFreq = sampleFrequency / 2
        happy_patch.pitch(n_semitones, False)
        happy_patch.bend(n_bend, inflect_start_times[0], inflect_end_times[0],
                         cents)
        happy_patch.equalizer(cutFreq, Qfactor, Gain)
        happy_patch.build(filenamein, filenameout)
    else:
        cutFreq = 8000
        happy_patch.pitch(n_semitones, False)
        happy_patch.bend(n_bend, inflect_start_times[0], inflect_end_times[0],
                         cents)
        happy_patch.equalizer(cutFreq, Qfactor, Gain)
        happy_patch.build(filenamein, filenameout)

    return happy_patch
Ejemplo n.º 3
0
def sad_sox_init(semitones, gain, CUTFREQ, output_file_path):
    CUTFREQ = 3500
    patch = Transformer()
    patch.pitch(semitones, False)
    patch.tempo(0.95, 's')
    patch.treble(gain, CUTFREQ, 0.5)
    patch.build(FILE_NAME_PATH, output_file_path)
    return patch
Ejemplo n.º 4
0
def afraid_sox_init(speed,depth,number_of_bends,start_time_now,end_time_now,cents,filenameout):
	patch = Transformer()
	patch.tremolo(speed,depth)
	patch.tempo(1.05,'s')
	patch.gain(1.1)
	#patch.bend(number_of_bends,start_time_now,end_time_now,cents,50)			
	patch.build(FILE_NAME_PATH,filenameout)
	return patch
Ejemplo n.º 5
0
def happy_tensed_sox_init(filenameout,semitones,number_of_bends,start_time_now,end_time_now,cents,CUTFREQ,gain,QFACTOR):
	patch = Transformer()
	patch.pitch(semitones,False)
	patch.tempo(1.18,'s')
	patch.gain(gain)
	#patch.bend(number_of_bends,start_time_now,end_time_now,cents,50)			
	patch.treble(gain,CUTFREQ,0.5)
	patch.equalizer(CUTFREQ,QFACTOR,gain)
	patch.build(FILE_NAME_PATH,filenameout)
	return patch
Ejemplo n.º 6
0
def happy_sox_init(output_file_path, semitones, number_of_bends,
                   start_time_now, end_time_now, cents, CUTFREQ, gain,
                   QFACTOR):
    patch = Transformer()
    patch.pitch(semitones, False)
    patch.tempo(1.1, 's')
    patch.gain(2.0)
    #patch.bend(number_of_bends,start_time_now,end_time_now,cents,50)
    patch.treble(gain, CUTFREQ, 0.5)
    patch.equalizer(CUTFREQ, QFACTOR, gain)
    print FILE_NAME_PATH
    print output_file_path
    patch.build(FILE_NAME_PATH, output_file_path)
    return patch
Ejemplo n.º 7
0
def sad_patch(sampleFrequency, n_semitones, Qfactor, Gain):
    filenamein = "/home/dereje/Desktop/TestFolder/Test.wav"
    filenameout = "/home/dereje/Desktop/TestFolder/TestSad.wav"
    sad_patch = Transformer()
    if (sampleFrequency <= 16000):
        cutFreq = sampleFrequency / 2.5
        sad_patch.pitch(n_semitones, False)
        sad_patch.equalizer(cutFreq, Qfactor, Gain)
        sad_patch.build(filenamein, filenameout)
    else:
        cutFreq = 8000
        sad_patch.pitch(n_semitones, False)
        sad_patch.equalizer(cutFreq, Qfactor, Gain)
        sad_patch.build(filenamein, filenameout)

    return sad_patch