From 52c862f56b9df0c8a494bf86663e1e2a13192f50 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 2 Dec 2023 23:56:43 +0900 Subject: [PATCH] =?UTF-8?q?aques=20=E5=AE=9F=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aques.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/aques.py b/aques.py index 3a625bc..c3755d8 100644 --- a/aques.py +++ b/aques.py @@ -1,4 +1,5 @@ from ctypes import * +import subprocess class Aques: @@ -14,14 +15,9 @@ class Aques: with open (phont_file, 'rb') as f: phont = f.read () - aqkoe = cdll.LoadLibrary ('libAqKanji2Koe.so') - dic_path: str = './aq_dic' - err = c_int (0) - aqkoe.AqKanji2Koe_Create.restype = c_void_p - handle = aqkoe.AqKanji2Koe_Create (dic_path.encode ('utf-8'), byref (err)) - koe: str = '' - aqkoe.AqKanji2Koe_Convert.restype = c_int - aqkoe.AqKanji2Koe_Convert (handle, text.encode ('utf-8'), koe, 4096) + p = subprocess.Popen ('./aques', stdin = subprocess.PIPE, + stdout = subprocess.PIPE) + koe = p.communicate (text.encode ())[0].decode () aqtk = cdll.LoadLibrary ('libAquesTalk2Eva.so') aqtk.AquesTalk2_Synthe_Utf8.restype = POINTER (ARRAY (c_ubyte, 0))