Commits

Yusuke MURAOKA committed 642b08b

made

Comments (0)

Files changed (2)

+AquesTalk2 demo for Mac OSX
+===========================
+
+This is a python script with ctypes to demonstrate making voice
+for AquesTalk2_ which is a famous voice engine in Japan.
+The script is written for Mac OSX. Perhaps it should be worked
+by only few changes on other OS such as Windows or Linux.
+
+.. _AquesTalk2: http://www.a-quest.com/products/aquestalk2.html
+
+If you are interesting the library, and want to use for your business,
+have a look at `the library license (in Japanese)`__.
+
+.. _license: http://www.a-quest.com/products/aquestalk2_licence.html
+__ license_
+
+I'm a programmer, NOT responsible for the license at all.
+
+MURAOKA Yusuke <yusuke@jbking.org>
+# -*- coding: utf8 -*-
+"""
+The MIT License
+
+Copyright (c) 2011 MURAOKA Yusuke <yusuke@jbking.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+"""
+
+from __future__ import print_function
+from ctypes import (cdll, byref, POINTER,
+                    c_int32, c_char)
+import sys
+
+if sys.maxint != 2147483647:
+    raise OSError("Use this script only in 32bit mode!")
+
+lib = cdll.LoadLibrary(
+    "/Applications/AqTk2App.app"
+    "/Contents/Frameworks/AquesTalk2.framework/Versions/Current"
+    "/AquesTalk2")
+
+size = c_int32()
+
+lib.AquesTalk2_Synthe.restype = POINTER(c_char)
+wav_p = lib.AquesTalk2_Synthe(
+        (u"こんにちは").encode("sjis"),
+        100,
+        byref(size),
+        0)
+
+if wav_p == 0:
+    raise ValueError("NULL: %d" % size.value)
+
+print("size is %d" % size.value)
+file('demo.wav', 'wb').write(wav_p[:size.value])
+
+lib.AquesTalk2_FreeWave(wav_p)