예제 #1
0
def initialize(voice = default_jtalk_voice):
	global player, voice_args
	global speaker_attenuation
	voice_args = voice
	speaker_attenuation = voice_args['speaker_attenuation']
	if not _espeak.espeakDLL:
		_espeak.initialize()
		log.debug("jtalk using eSpeak version %s" % _espeak.info())
	_espeak.setVoiceByLanguage("en")
	_espeak.setVoiceAndVariant(variant=voice["espeak_variant"])
	if not player:
		player = nvwave.WavePlayer(channels=1, samplesPerSec=voice_args['samp_rate'], bitsPerSample=16, outputDevice=config.conf["speech"]["outputDevice"])
	if not _bgthread.bgThread:
		_bgthread.initialize()
	if not mecab:
		Mecab_initialize(log.info, jtalk_dir, dic_dir, user_dics)
	jtalkPrepare.setup()

	jt_dll = os.path.join(jtalk_dir, 'libopenjtalk.dll')
	log.debug('jt_dll %s' % jt_dll)
	libjt_initialize(jt_dll)
	log.debug(libjt_version())

	if os.path.isfile(voice_args['htsvoice']):
		libjt_load(voice_args['htsvoice'])
		log.info("loaded " + voice_args['htsvoice'])
	else:
		log.error("load error " + voice_args['htsvoice'])
	libjt_set_alpha(voice_args['alpha'])
	libjt_set_beta(voice_args['beta'])
예제 #2
0
def runTasks():
    jtalkPrepare.setup()
    count = 0
    for item in tests:
        msg = item[0]
        msg = unicode_normalize(msg)
        s = jtalkPrepare.convert(msg)
        if item[1] != s:
            _print("expected:%s result:%s" % (item[1], s))
            count += 1
    return count
예제 #3
0
def runTasks():
	jtalkPrepare.setup()
	count = 0
	for item in tests:
		msg = item[0]
		normalized = unicode_normalize(msg)
		s = jtalkPrepare.convert(normalized)
		if item[1] != s:
			_print('input:%s normalized:%s result:%s expected:%s' % (msg, normalized, s, item[1]))
			count += 1
	return count