接口: Phoneme的放出no-ref-no-vae/mix-phoneme版本的, 只要中文聲音

1. c++編譯並使用.so

g++ demo.cpp CrystalDll.so -o main

export LD_LIBRARY_PATH="./"
./main

2. 對接CrystalTTS的邊界情況和標貝數據的邊界情況以及聲韻母統一.

CrystalTTS: 

這是個測試,有沒有裝你好啊汪仔。

zh-e4|sh-iy4|g-e5|@c-e4|sh-iy4|@。iou3|m-ei2|iou3|@zh-uang1|n-i6|h-ao3|a5|@uang1|z-ix1|@。

標貝: 

中文韻律結構標註包含韻律詞(#1)、韻律短語(#2)、語調短語(#3)、句末(#4)四個層級的標註。

該公司#1 當時#1 表示#3,將於#1 本週一#2 公佈#1 正式#1 消息#4。

gai1 gong1 si1 dang1 shi2 biao3 shi4 jiang1 yu2 ben3 zhou1 yi1 gong1 bu4 zheng4 shi4 xiao1 xi5

後來預處理的是靜北師兄的G2P:

所以對比起來, https://blog.csdn.net/brandon2015/article/details/50218777和標貝的實際上不好區分, 而Crystal明顯最小單位是韻律短語#2, 而#1的停頓太小, 忽略掉, 去嘗試. 

目前是加成#2, 然後中間多些標點, 能夠彌補語調短語.

聲韻母類別是統一的, 靜北師兄的G2P和Crystal是一個庫, 但是有些結尾的轉換是不同的, 上下文和算法的不同所導致, 都是正確的, 對於合成也沒有影響. 但是下一版自己數據的設定需要統一.

3. python調用C++的.so庫, 並且修正handle指針的4字節和8字節

https://www.douban.com/note/133696430/

https://bbs.csdn.net/topics/392194401

def __init__(self, dllpath = u'./CrystalDll.so'):
        self._dllpath = dllpath
        print(os.path.abspath(dllpath))
        self._libc = ctypes.cdll.LoadLibrary(self._dllpath)
        print('load ok')
        self._tts = None

    #def initialize(self, textpath = u'CrystalTTS/data/putonghua/text'):
    def initialize(self, textpath = u'../data/putonghua/text'):
        langtag = c_wchar_p(u"zh-cmn")
        dirtext = c_wchar_p(textpath)
        dirvoice= c_wchar_p(u"")
        
        class handle_t(Structure):
            pass
        self._libc.ttsInitialize.restype = POINTER(handle_t)

        self._tts = self._libc.ttsInitialize(langtag, dirtext, dirvoice)

綜合起來, 使用如下(注意路徑):

# Crasytal TTS./home/ec2-user/Tmp_why_interface_for_Demo_child0.2/tmp_tacotron_why_child0.2/CrystalTTS/demo
sys.path.append('/home/ec2-user/Tmp_why_interface_for_Demo_child0.2/tmp_tacotron_why_child0.2/CrystalTTS/demo')
from CrystalTTS import CrystalTTS

CTOP = CrystalTTS(dllpath = u'/home/ec2-user/Tmp_why_interface_for_Demo_child0.2/tmp_tacotron_why_child0.2/CrystalTTS/demo/CrystalDll.so')
CTOP.initialize(textpath = u'/home/ec2-user/Tmp_why_interface_for_Demo_child0.2/tmp_tacotron_why_child0.2/CrystalTTS/data/putonghua/text')


c2p = settings.CTOP
	
	text = str
	print(text)
	Crystal_file_name = 'child0.2_' +time.strftime('%Y-%m-%d%H-%M-%S_', time.localtime(time.time())) + change_int2str(random.randint(100000, 999999)) + '.txt'
	tag_ans = c2p.textAnalyze(text, Crystal_file_name)
	if tag_ans != 1:
		return HttpResponse('CtystalTTS is wrong, try again~')
	with open(Crystal_file_name, 'r', encoding='utf-8-sig') as f:
		raw_phoneme = f.read().strip()
	print(raw_phoneme)
	phoneme = raw_phoneme.replace('-', '_').replace('|', '_ _').replace('@', '/_2_ _').replace('。', '。_ _').replace('1', '_1').replace('2', '_2').replace('3', '_3').replace('4', '_4').replace('5', '_5').replace('6', '_6')
	

4. 綜合搭建

[hujk17@mjrc-server10 Tmp_why_interface_for_DemoAndIterate]$ scp -r CrystalTTS 54.175.104.170@ec2-user:/home/ec2-user/Tmp_why_interface_for_Demo_child0.2/tmp_tacotron_why_child0.2/
ssh: Could not resolve hostname ec2-user: Name or service not known
lost connection

http://54.175.104.170:8000/rango/index/wai4_dao4_ke1_ji4_shi4_yi5_ge4_hen3_bang4_de5_tuan2_dui4_yi5_ge4_hen3_bang4_de5_tuan2_dui4/

標點符號不能出現在url中, 是個問題.如何解決?

韻律邊界當做#2, 會有些不舒服,

所以重新訓練模型, 使用Crystal前端處理. 查看效果.

Crystal retrain child0.2 效果

1.7w的效果就很好, 只是好像又把標點符號弄沒了. 在訓練。

解決標點符號:

https://regexcheatsheet.com/

https://docs.djangoproject.com/en/1.9/topics/http/urls/

測試它:

合併實驗:

1.7w步的實驗還挺好, 爲了對接, 直接遷入到測試過的網站中.

Tensorflow 同時加載多個模型,以及與keras模型混用:

https://blog.csdn.net/googler_offer/article/details/91416521

但是現在先不用, 浪費時間, 採取多個端口開django的方法.


但是科研的時候, 仍使用: 訓練語料都有標註好的韻律邊界信息.

注意utf-8-sig的使用, 測一下第一個文本的發音. UTF-8文件的boom問題. *********以前的實驗都有點漏掉這個! 

聲調中有6?這是怎麼回事?

python的replace太難受了. 只能一連串的用.

直觀上, teacherForce的結果更有韻律, 所以思考如何接近, 或者啓用那個rate.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章