{"id":48015514,"url":"https://github.com/ayutaz/openjtalk-native","last_synced_at":"2026-04-04T13:43:28.529Z","repository":{"id":337530542,"uuid":"1154048033","full_name":"ayutaz/openjtalk-native","owner":"ayutaz","description":"Cross-platform OpenJTalk native shared library — Japanese text-to-phoneme C API for Windows, Linux, macOS, Android, and iOS","archived":false,"fork":false,"pushed_at":"2026-03-16T16:38:02.000Z","size":137,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-30T10:27:07.802Z","etag":null,"topics":["c-api","cross-platform","japanese","native","openjtalk","phoneme","tts"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayutaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-10T00:38:56.000Z","updated_at":"2026-03-16T16:35:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ayutaz/openjtalk-native","commit_stats":null,"previous_names":["ayutaz/openjtalk-native"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ayutaz/openjtalk-native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayutaz%2Fopenjtalk-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayutaz%2Fopenjtalk-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayutaz%2Fopenjtalk-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayutaz%2Fopenjtalk-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayutaz","download_url":"https://codeload.github.com/ayutaz/openjtalk-native/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayutaz%2Fopenjtalk-native/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31402276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-api","cross-platform","japanese","native","openjtalk","phoneme","tts"],"created_at":"2026-04-04T13:43:28.332Z","updated_at":"2026-04-04T13:43:28.466Z","avatar_url":"https://github.com/ayutaz.png","language":"C","readme":"# openjtalk-native\n\n**[English](#english)**\n\nクロスプラットフォームの OpenJTalk ネイティブ共有ライブラリ。日本語テキストから音素への変換機能を C API として提供します。\n\n## サポートプラットフォーム\n\n| プラットフォーム | アーキテクチャ | 出力 |\n|:--|:--|:--|\n| Windows | x64 | `openjtalk_native.dll` |\n| Linux | x86_64 | `libopenjtalk_native.so` |\n| macOS | arm64 + x86_64 | `libopenjtalk_native.dylib` |\n| Android | arm64-v8a, armeabi-v7a, x86, x86_64 | `libopenjtalk_native.so` |\n| iOS | arm64 | `libopenjtalk_native.a` |\n\n## プリビルドバイナリ\n\n[Releases](https://github.com/ayutaz/openjtalk-native/releases) ページからプラットフォーム別のプリビルドバイナリをダウンロードできます。\n\n各リリースには SHA256 チェックサムファイル (`SHA256SUMS.txt`) が含まれています。ダウンロード後に整合性を確認してください:\n\n```bash\nsha256sum -c SHA256SUMS.txt\n```\n\n## 辞書ファイル\n\nOpenJTalk の動作には MeCab 辞書（UTF-8 版）が必要です。\n\n1. [Open JTalk のダウンロードページ](https://open-jtalk.sourceforge.net/) から `open_jtalk_dic_utf_8-1.11.tar.gz` を取得\n2. 任意のディレクトリに展開\n3. `openjtalk_native_create()` に辞書ディレクトリのパスを指定\n\n辞書ディレクトリには `sys.dic`, `matrix.bin`, `char.bin`, `unk.dic` が含まれている必要があります。\n\n## ビルド\n\n### 前提条件\n\n- CMake 3.10 以上\n- C99 対応コンパイラ\n- Linux/macOS: autotools (autoconf, automake, libtool)\n- Windows: MSVC または MinGW\n\n### Linux / macOS\n\n```bash\n./scripts/fetch_dependencies.sh\n./scripts/build_dependencies.sh\ncmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON\ncmake --build build -j$(nproc)\ncd build \u0026\u0026 ctest --output-on-failure\n```\n\n### Windows\n\n```powershell\n.\\scripts\\fetch_dependencies.ps1\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build --config Release\n```\n\n### Android\n\nDocker を使用してクロスコンパイルします:\n\n```bash\ndocker build -f docker/Dockerfile.android -t openjtalk-android .\ndocker run --rm -v \"${PWD}:/workspace\" -w /workspace openjtalk-android bash -c \"\n  ./scripts/fetch_dependencies.sh\n  ./scripts/build_dependencies_android.sh\n  cmake -B build \\\n    -DCMAKE_TOOLCHAIN_FILE=\\$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \\\n    -DANDROID_ABI=arm64-v8a \\\n    -DANDROID_PLATFORM=android-21 \\\n    -DCMAKE_BUILD_TYPE=Release\n  cmake --build build -j\\$(nproc)\n\"\n```\n\n### iOS\n\n```bash\n./scripts/fetch_dependencies.sh\n./scripts/build_dependencies_ios.sh\ncmake -B build_ios \\\n  -DCMAKE_SYSTEM_NAME=iOS \\\n  -DCMAKE_OSX_ARCHITECTURES=arm64 \\\n  -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \\\n  -DCMAKE_BUILD_TYPE=Release \\\n  -DIOS=ON\ncmake --build build_ios\n```\n\n## API\n\n### 基本的な使い方\n\n```c\n#include \"openjtalk_native.h\"\n\n// インスタンス作成（辞書パスを指定）\nvoid* handle = openjtalk_native_create(\"/path/to/open_jtalk_dic_utf_8-1.11\");\nif (!handle) {\n    // エラー: 辞書が見つからない、またはメモリ不足\n    return;\n}\n\n// 音素変換\nOpenJTalkNativePhonemeResult* result = openjtalk_native_phonemize(handle, \"こんにちは\");\nif (result) {\n    printf(\"Phonemes: %s\\n\", result-\u003ephonemes);       // e.g., \"pau k o N n i ch i w a pau\"\n    printf(\"Count: %d\\n\", result-\u003ephoneme_count);\n\n    // 結果の解放（呼び出し元の責任）\n    openjtalk_native_free_result(result);\n}\n\n// インスタンス破棄\nopenjtalk_native_destroy(handle);\n```\n\n### プロソディ付き音素変換\n\n```c\nOpenJTalkNativeProsodyResult* prosody = openjtalk_native_phonemize_with_prosody(handle, \"東京は晴れです\");\nif (prosody) {\n    for (int i = 0; i \u003c prosody-\u003ephoneme_count; i++) {\n        // A1: アクセント核からの相対位置\n        // A2: アクセント句内の位置（1始まり）\n        // A3: アクセント句のモーラ数\n        printf(\"A1=%d A2=%d A3=%d\\n\",\n            prosody-\u003eprosody_a1[i], prosody-\u003eprosody_a2[i], prosody-\u003eprosody_a3[i]);\n    }\n    openjtalk_native_free_prosody_result(prosody);\n}\n```\n\n### オプション設定\n\n```c\n// 利用可能なオプションキー:\n//   \"speech_rate\" — 話速 (0.0 \u003c rate \u003c= 10.0, デフォルト: 1.0)\n//   \"pitch\"       — ピッチ (-20.0 \u003c= pitch \u003c= 20.0, デフォルト: 0.0)\n//   \"volume\"      — 音量 (0.0 \u003c= volume \u003c= 2.0, デフォルト: 1.0)\nopenjtalk_native_set_option(handle, \"speech_rate\", \"1.5\");\n\nconst char* val = openjtalk_native_get_option(handle, \"speech_rate\");\n// 注意: 戻り値はインスタンス内部バッファを指すため、次の get_option 呼び出しで上書きされます\n```\n\n### エラーハンドリング\n\n```c\nOpenJTalkNativePhonemeResult* result = openjtalk_native_phonemize(handle, text);\nif (!result) {\n    int err = openjtalk_native_get_last_error(handle);\n    printf(\"Error: %s\\n\", openjtalk_native_get_error_string(err));\n}\n```\n\n### スレッドセーフティ\n\n- `openjtalk_native_create()` で返されるハンドルはそれぞれ独立しています\n- 異なるハンドルは異なるスレッドから同時に使用できます\n- 同一ハンドルを複数スレッドから同時に使用してはいけません\n- `openjtalk_native_get_version()` と `openjtalk_native_get_error_string()` は任意のスレッドから安全に呼び出せます\n\n## ディレクトリ構成\n\n```\nopenjtalk-native/\n├── include/           パブリックヘッダー (openjtalk_native.h)\n├── src/               コア実装\n├── test/              テストコード\n├── scripts/           ビルドスクリプト\n├── docker/            Docker ビルド環境\n├── .github/workflows/ CI/CD ワークフロー\n└── external/          ビルド時にダウンロードされるソース（gitignore 対象）\n```\n\n## トラブルシューティング\n\n### 辞書が見つからない\n\n`openjtalk_native_create()` が `NULL` を返す場合、辞書パスが正しいか確認してください。パスには UTF-8 でエンコードされたディレクトリパスを指定します。\n\n### ビルド時に OpenJTalk ヘッダーが見つからない\n\n`fetch_dependencies.sh` (または `.ps1`) と `build_dependencies.sh` を先に実行してください。ヘッダーファイルは `external/install/include/` にインストールされます。\n\n### 入力テキストが長すぎる\n\n入力テキストは最大 4096 バイトに制限されています。これを超える入力は `OPENJTALK_NATIVE_ERROR_INVALID_INPUT` エラーを返します。テキストを分割して処理してください。\n\n## ライセンス\n\nBSD-3-Clause License - [LICENSE](LICENSE) を参照してください。\n\nOpenJTalk および HTS Engine API のライセンスに準じます。\n\n---\n\n\u003ca id=\"english\"\u003e\u003c/a\u003e\n\n# openjtalk-native (English)\n\n**[日本語](#openjtalk-native)**\n\nA cross-platform native shared library for OpenJTalk. Provides a C API for converting Japanese text to phonemes.\n\n## Supported Platforms\n\n| Platform | Architecture | Output |\n|:--|:--|:--|\n| Windows | x64 | `openjtalk_native.dll` |\n| Linux | x86_64 | `libopenjtalk_native.so` |\n| macOS | arm64 + x86_64 | `libopenjtalk_native.dylib` |\n| Android | arm64-v8a, armeabi-v7a, x86, x86_64 | `libopenjtalk_native.so` |\n| iOS | arm64 | `libopenjtalk_native.a` |\n\n## Prebuilt Binaries\n\nDownload prebuilt binaries for each platform from the [Releases](https://github.com/ayutaz/openjtalk-native/releases) page.\n\nEach release includes a SHA256 checksum file (`SHA256SUMS.txt`). Verify integrity after downloading:\n\n```bash\nsha256sum -c SHA256SUMS.txt\n```\n\n## Dictionary Files\n\nOpenJTalk requires a MeCab dictionary (UTF-8 version).\n\n1. Download `open_jtalk_dic_utf_8-1.11.tar.gz` from the [Open JTalk download page](https://open-jtalk.sourceforge.net/)\n2. Extract to any directory\n3. Pass the dictionary directory path to `openjtalk_native_create()`\n\nThe dictionary directory must contain `sys.dic`, `matrix.bin`, `char.bin`, and `unk.dic`.\n\n## Building\n\n### Prerequisites\n\n- CMake 3.10+\n- C99-compatible compiler\n- Linux/macOS: autotools (autoconf, automake, libtool)\n- Windows: MSVC or MinGW\n\n### Linux / macOS\n\n```bash\n./scripts/fetch_dependencies.sh\n./scripts/build_dependencies.sh\ncmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON\ncmake --build build -j$(nproc)\ncd build \u0026\u0026 ctest --output-on-failure\n```\n\n### Windows\n\n```powershell\n.\\scripts\\fetch_dependencies.ps1\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build --config Release\n```\n\n### Android\n\nCross-compile using Docker:\n\n```bash\ndocker build -f docker/Dockerfile.android -t openjtalk-android .\ndocker run --rm -v \"${PWD}:/workspace\" -w /workspace openjtalk-android bash -c \"\n  ./scripts/fetch_dependencies.sh\n  ./scripts/build_dependencies_android.sh\n  cmake -B build \\\n    -DCMAKE_TOOLCHAIN_FILE=\\$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \\\n    -DANDROID_ABI=arm64-v8a \\\n    -DANDROID_PLATFORM=android-21 \\\n    -DCMAKE_BUILD_TYPE=Release\n  cmake --build build -j\\$(nproc)\n\"\n```\n\n### iOS\n\n```bash\n./scripts/fetch_dependencies.sh\n./scripts/build_dependencies_ios.sh\ncmake -B build_ios \\\n  -DCMAKE_SYSTEM_NAME=iOS \\\n  -DCMAKE_OSX_ARCHITECTURES=arm64 \\\n  -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \\\n  -DCMAKE_BUILD_TYPE=Release \\\n  -DIOS=ON\ncmake --build build_ios\n```\n\n## API\n\n### Basic Usage\n\n```c\n#include \"openjtalk_native.h\"\n\n// Create an instance (specify dictionary path)\nvoid* handle = openjtalk_native_create(\"/path/to/open_jtalk_dic_utf_8-1.11\");\nif (!handle) {\n    // Error: dictionary not found or out of memory\n    return;\n}\n\n// Phoneme conversion\nOpenJTalkNativePhonemeResult* result = openjtalk_native_phonemize(handle, \"こんにちは\");\nif (result) {\n    printf(\"Phonemes: %s\\n\", result-\u003ephonemes);       // e.g., \"pau k o N n i ch i w a pau\"\n    printf(\"Count: %d\\n\", result-\u003ephoneme_count);\n\n    // Caller is responsible for freeing the result\n    openjtalk_native_free_result(result);\n}\n\n// Destroy instance\nopenjtalk_native_destroy(handle);\n```\n\n### Phonemization with Prosody\n\n```c\nOpenJTalkNativeProsodyResult* prosody = openjtalk_native_phonemize_with_prosody(handle, \"東京は晴れです\");\nif (prosody) {\n    for (int i = 0; i \u003c prosody-\u003ephoneme_count; i++) {\n        // A1: Relative position from accent nucleus\n        // A2: Position in accent phrase (1-based)\n        // A3: Total morae in accent phrase\n        printf(\"A1=%d A2=%d A3=%d\\n\",\n            prosody-\u003eprosody_a1[i], prosody-\u003eprosody_a2[i], prosody-\u003eprosody_a3[i]);\n    }\n    openjtalk_native_free_prosody_result(prosody);\n}\n```\n\n### Options\n\n```c\n// Available option keys:\n//   \"speech_rate\" — Speech rate multiplier (0.0 \u003c rate \u003c= 10.0, default: 1.0)\n//   \"pitch\"       — Pitch shift in semitones (-20.0 \u003c= pitch \u003c= 20.0, default: 0.0)\n//   \"volume\"      — Volume multiplier (0.0 \u003c= volume \u003c= 2.0, default: 1.0)\nopenjtalk_native_set_option(handle, \"speech_rate\", \"1.5\");\n\nconst char* val = openjtalk_native_get_option(handle, \"speech_rate\");\n// Note: returned pointer references an internal buffer, overwritten on next get_option call\n```\n\n### Error Handling\n\n```c\nOpenJTalkNativePhonemeResult* result = openjtalk_native_phonemize(handle, text);\nif (!result) {\n    int err = openjtalk_native_get_last_error(handle);\n    printf(\"Error: %s\\n\", openjtalk_native_get_error_string(err));\n}\n```\n\n### Thread Safety\n\n- Each handle returned by `openjtalk_native_create()` is independent\n- Different handles can be used concurrently from different threads\n- A single handle must NOT be used from multiple threads simultaneously\n- `openjtalk_native_get_version()` and `openjtalk_native_get_error_string()` are safe to call from any thread\n\n## Directory Structure\n\n```\nopenjtalk-native/\n├── include/           Public header (openjtalk_native.h)\n├── src/               Core implementation\n├── test/              Tests\n├── scripts/           Build scripts\n├── docker/            Docker build environments\n├── .github/workflows/ CI/CD workflows\n└── external/          Sources downloaded at build time (gitignored)\n```\n\n## Troubleshooting\n\n### Dictionary Not Found\n\nIf `openjtalk_native_create()` returns `NULL`, verify the dictionary path is correct. The path must be a UTF-8 encoded directory path.\n\n### OpenJTalk Headers Not Found During Build\n\nRun `fetch_dependencies.sh` (or `.ps1`) and `build_dependencies.sh` first. Header files are installed to `external/install/include/`.\n\n### Input Text Too Long\n\nInput text is limited to 4096 bytes. Inputs exceeding this limit return `OPENJTALK_NATIVE_ERROR_INVALID_INPUT`. Split the text into smaller chunks.\n\n## License\n\nBSD-3-Clause License - See [LICENSE](LICENSE).\n\nSubject to the licenses of OpenJTalk and HTS Engine API.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayutaz%2Fopenjtalk-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayutaz%2Fopenjtalk-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayutaz%2Fopenjtalk-native/lists"}