Example #1
0
def generateFramesAndTiming(ipaText,
                            speed=1,
                            basePitch=100,
                            inflection=0.5,
                            clauseType=None):
    phonemeList = IPAToPhonemes(ipaText)
    if len(phonemeList) == 0:
        return
    correctHPhonemes(phonemeList)
    calculatePhonemeTimes(phonemeList, speed)
    calculatePhonemePitches(phonemeList, speed, basePitch, inflection,
                            clauseType)
    for phoneme in phonemeList:
        frameDuration = phoneme.pop('_duration')
        fadeDuration = phoneme.pop('_fadeDuration')
        if phoneme.get('_silence'):
            yield None, frameDuration, fadeDuration
        else:
            frame = speechPlayer.Frame()
            frame.preFormantGain = 1.0
            frame.outputGain = 2.0
            applyPhonemeToFrame(frame, phoneme)
            yield frame, frameDuration, fadeDuration
import ctypes
import sys
import codecs
import ipa
import time
import speechPlayer
from lavPlayer import LavPlayer

speed=1

player=speechPlayer.SpeechPlayer(22050)
lavPlayer=LavPlayer(player,22050)

frame=speechPlayer.Frame()
frame.outputGain=1.0
frame.preFormantGain=1.0
frame.vibratoPitchOffset=0.1
frame.vibratoSpeed=5.5
frame.voicePitch=150
ipa.setFrame(frame,'æ')
frame.voiceAmplitude=0
player.queueFrame(frame,120/speed,100/speed)
frame.voiceAmplitude=1
player.queueFrame(frame,120/speed,40/speed)
ipa.setFrame(frame,'n')
frame.voicePitch=100
player.queueFrame(frame,120/speed,40/speed)
ipa.setFrame(frame,'ɑ')
frame.voicePitch=90
player.queueFrame(frame,80/speed,40/speed)
player.queueFrame(None,40/speed,40/speed)