@mekuru/coeiroink 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.jp.md ADDED
@@ -0,0 +1,115 @@
1
+ # @mekuru/coeiroink
2
+
3
+ [English](README.md)
4
+
5
+ Mekuru Movie Maker のセリフを、COEIROINK v2 で読み上げる `Coeiroink` 部品です。
6
+
7
+ ## セットアップ
8
+
9
+ [COEIROINK v2](https://coeiroink.com/download) をインストールし、「キャラクターダウンロード」で声を追加して再起動します。接続先は `http://127.0.0.1:50032`。名前・UUID・スタイルは `/v1/speakers` で確認できます。`COEIROINK:つくよみちゃん` などのクレジットを記載し、声の利用規約に従ってください。
10
+
11
+ Bun 1.4 以上・libx264 付き ffmpeg・ffprobe・日本語フォントを用意し、プロジェクトに追加します。
12
+
13
+ ```sh
14
+ bun add -d @mekuru/core @mekuru/cli @mekuru/coeiroink
15
+ ```
16
+
17
+ `tsconfig.json` に `jsx: "react-jsx"` と `jsxImportSource: "@mekuru/core"` を設定します。`bun create @mekuru` では設定済みです。
18
+
19
+ ## 簡単な使い方
20
+
21
+ `src/main.tsx` に保存します。
22
+
23
+ ```tsx
24
+ import { writeXml } from "@mekuru/core";
25
+ import { Coeiroink } from "@mekuru/coeiroink";
26
+
27
+ const text = "こんにちは。";
28
+
29
+ await writeXml(
30
+ ".mekuru/main.xml",
31
+ <mekuru size="1280x720" fps={30}>
32
+ <stack>
33
+ <Coeiroink speaker="つくよみちゃん/れいせい">{text}</Coeiroink>
34
+ <text x="50%" y="50%" anchor="center" size={60} color="#FFFFFF">{text}</text>
35
+ </stack>
36
+ </mekuru>,
37
+ );
38
+ ```
39
+
40
+ ```sh
41
+ bun src/main.tsx
42
+ bunx mekuru-server .mekuru/main.xml
43
+ ```
44
+
45
+ `http://localhost:3333` でプレビューします。書き出しは `bunx mekuru-compiler .mekuru/main.xml -o video.mp4`。
46
+
47
+ ## キャラクター
48
+
49
+ `<Coeiroink>` に渡すキャラクターごとの設定をエクスポートしています。展開して使い、ほかの props も追加できます。
50
+
51
+ ```tsx
52
+ import { Coeiroink, tsukuyomi } from "@mekuru/coeiroink";
53
+
54
+ <Coeiroink {...tsukuyomi}>こんにちは。</Coeiroink>;
55
+ ```
56
+
57
+ | エクスポート | 名前 | `speaker` |
58
+ | --- | --- | --- |
59
+ | `tsukuyomi` | つくよみちゃん | `"つくよみちゃん"` |
60
+ | `mana` | MANA | `"MANA"` |
61
+ | `kana` | KANA | `"KANA"` |
62
+ | `ofutonp` | おふとんP | `"おふとんP"` |
63
+ | `ayaka` | AI声優-朱花 | `"AI声優-朱花"` |
64
+ | `aoba` | AI声優-青葉 | `"AI声優-青葉"` |
65
+ | `ginga` | AI声優-銀芽 | `"AI声優-銀芽"` |
66
+ | `kanae` | AI声優-金苗 | `"AI声優-金苗"` |
67
+ | `dia` | ディアちゃん | `"ディアちゃん"` |
68
+ | `arma` | アルマちゃん | `"アルマちゃん"` |
69
+ | `lilin` | リリンちゃん | `"リリンちゃん"` |
70
+ | `croix` | クロワちゃん | `"クロワちゃん"` |
71
+ | `andzie` | アンジーさん | `"アンジーさん"` |
72
+ | `ameno` | アメノちゃん | `"アメノちゃん"` |
73
+
74
+ ## 詳しい使い方
75
+
76
+ ### 声の設定 (`CoeiroinkProps`)
77
+
78
+ - `speaker`: 必須: 話者名、`"話者名/スタイル名"`、speakerUuid(`/スタイル名` も指定可)、または数値のスタイル ID。名前・UUID だけなら最初のスタイルを選びます。
79
+ - `speed`: 話す速さの倍率。既定は `1`。
80
+ - `pitch`: COEIROINK の単位での声の高さの調整。既定は `0`。
81
+ - `intonation`: 抑揚の強さ。既定は `1`。
82
+ - `volume`: 合成時の音量の倍率。既定は `1`。
83
+ - `pre`・`post`: 読み上げの前後の無音(秒)。既定はそれぞれ `0.1`。
84
+ - `pause`: 「、」などの句読点の無音(秒)。既定では省略し、エンジンに任せます。
85
+ - `url`: エンジンのベース URL。既定は `http://127.0.0.1:50032`。
86
+
87
+ 話者が見つからない場合は、エラーに利用可能な話者・スタイル名を表示します。`/v1/speakers` とダウンロード状態を確認し、アプリを再起動してください。
88
+
89
+ ### テキストと時間
90
+
91
+ - `children`: セリフ。文字列・数値・フラグメント・`<br />`。空の読み上げはエラー。
92
+ - `name`: タイムラインの話者名。既定: `speaker`。
93
+ - `reading`: 読みの辞書。例: `{ Mekuru: "めくる" }`。長いキーを優先し、表示は変えない。
94
+ - `gap`: セリフの後の無音(フレーム)。既定: `Math.round(0.3 * fps)`(30 fps で9)。
95
+ - `gain-db`: 再生音量の調整(dB)。既定: 調整なし。
96
+ - `len`: 無音を含む全体のフレーム数。既定: 音声の長さを切り上げた値 + `gap`。話速は変えない。
97
+ - `id`・`at`: 生成する `<dur>` の識別名と開始時刻。[時間の属性](../../docs/reference/Syntax.jp.md#時間の属性)を参照。
98
+
99
+ ルビ `|表示《よみ》` は「よみ」を読み、タイムラインには「表示」を残します。半角 `|` と `漢字《かんじ》` も使用できます。`<br />` は空白になり、ほかの要素は入れられません。セリフの連続再生は `<seq>`、字幕との同時表示は `<stack>`、口パクは[立ち絵の `Talk`](../portrait/README.jp.md) を使います。
100
+
101
+ ### キャッシュとプレビュー
102
+
103
+ - 音声はエンジン・声の設定・読み上げテキストをキーに `.mekuru/cache/tts/` へ保存。キャッシュ済みならエンジン停止中も使用できます。
104
+ - 接続先や再生設定の変更では再合成しません。同名のモデルを更新した場合などは、該当する WAV を削除して再生成します。
105
+ - `writeXml()` は合成中に無音の下書きを出し、完了後に XML を更新します。動画の書き出し前に `await` してください。
106
+
107
+ ### 接続
108
+
109
+ 接続先は `url` → `MEKURU_COEIROINK_URL` → 既定 URL の順で決まります。Bun と同じ環境から確認します。
110
+
111
+ ```sh
112
+ curl http://127.0.0.1:50032/v1/speakers
113
+ ```
114
+
115
+ 接続できない場合は起動状態とポートを確認します。Windows のエンジンには [WSL の mirrored ネットワーク](https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking)で `127.0.0.1` から接続できます。
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @mekuru/coeiroink
2
+
3
+ [日本語](README.jp.md)
4
+
5
+ The `Coeiroink` component reads Mekuru Movie Maker dialogue using COEIROINK v2.
6
+
7
+ ## Setup
8
+
9
+ Install [COEIROINK v2](https://coeiroink.com/download), download the desired voice from the app, and restart it. The engine listens on `http://127.0.0.1:50032`; `/v1/speakers` lists names, UUIDs, and styles. Include a credit such as `COEIROINK:つくよみちゃん` and follow the voice's terms.
10
+
11
+ Requires Bun 1.4+, ffmpeg with libx264, ffprobe, and Japanese fonts. Install in the project folder:
12
+
13
+ ```sh
14
+ bun add -d @mekuru/core @mekuru/cli @mekuru/coeiroink
15
+ ```
16
+
17
+ In `tsconfig.json`, set `jsx: "react-jsx"` and `jsxImportSource: "@mekuru/core"` (already set by `bun create @mekuru`).
18
+
19
+ ## Quick start
20
+
21
+ Save as `src/main.tsx`:
22
+
23
+ ```tsx
24
+ import { writeXml } from "@mekuru/core";
25
+ import { Coeiroink } from "@mekuru/coeiroink";
26
+
27
+ const text = "こんにちは。";
28
+
29
+ await writeXml(
30
+ ".mekuru/main.xml",
31
+ <mekuru size="1280x720" fps={30}>
32
+ <stack>
33
+ <Coeiroink speaker="つくよみちゃん/れいせい">{text}</Coeiroink>
34
+ <text x="50%" y="50%" anchor="center" size={60} color="#FFFFFF">{text}</text>
35
+ </stack>
36
+ </mekuru>,
37
+ );
38
+ ```
39
+
40
+ ```sh
41
+ bun src/main.tsx
42
+ bunx mekuru-server .mekuru/main.xml
43
+ ```
44
+
45
+ Preview: `http://localhost:3333`. Export with `bunx mekuru-compiler .mekuru/main.xml -o video.mp4`.
46
+
47
+ ## Characters
48
+
49
+ The package exports each character's settings for `<Coeiroink>`. Spread one and add other props as needed.
50
+
51
+ ```tsx
52
+ import { Coeiroink, tsukuyomi } from "@mekuru/coeiroink";
53
+
54
+ <Coeiroink {...tsukuyomi}>こんにちは。</Coeiroink>;
55
+ ```
56
+
57
+ | Export | Name | `speaker` |
58
+ | --- | --- | --- |
59
+ | `tsukuyomi` | つくよみちゃん | `"つくよみちゃん"` |
60
+ | `mana` | MANA | `"MANA"` |
61
+ | `kana` | KANA | `"KANA"` |
62
+ | `ofutonp` | おふとんP | `"おふとんP"` |
63
+ | `ayaka` | AI声優-朱花 | `"AI声優-朱花"` |
64
+ | `aoba` | AI声優-青葉 | `"AI声優-青葉"` |
65
+ | `ginga` | AI声優-銀芽 | `"AI声優-銀芽"` |
66
+ | `kanae` | AI声優-金苗 | `"AI声優-金苗"` |
67
+ | `dia` | ディアちゃん | `"ディアちゃん"` |
68
+ | `arma` | アルマちゃん | `"アルマちゃん"` |
69
+ | `lilin` | リリンちゃん | `"リリンちゃん"` |
70
+ | `croix` | クロワちゃん | `"クロワちゃん"` |
71
+ | `andzie` | アンジーさん | `"アンジーさん"` |
72
+ | `ameno` | アメノちゃん | `"アメノちゃん"` |
73
+
74
+ ## Detailed usage
75
+
76
+ ### Voice (`CoeiroinkProps`)
77
+
78
+ - `speaker`: Required. A speaker name, `"speaker/style"`, speaker UUID (optionally followed by `/style`), or numeric style ID. A name or UUID alone selects its first style.
79
+ - `speed`: Speaking speed multiplier. Default: `1`.
80
+ - `pitch`: Pitch adjustment in COEIROINK's units. Default: `0`.
81
+ - `intonation`: Intonation strength. Default: `1`.
82
+ - `volume`: Synthesis volume multiplier. Default: `1`.
83
+ - `pre`, `post`: Silence before and after speech, in seconds. Default: `0.1` each.
84
+ - `pause`: Pause length for punctuation such as `、`, in seconds. Omitted by default, leaving it to the engine.
85
+ - `url`: Base URL; default `http://127.0.0.1:50032`.
86
+
87
+ Unknown speakers are reported with the available speaker/style names. Check `/v1/speakers` and restart the app after downloading a voice.
88
+
89
+ ### Text and timing
90
+
91
+ - `children`: Dialogue: strings, numbers, fragments, or `<br />`. Empty speech is an error.
92
+ - `name`: Timeline speaker label. Default: `speaker`.
93
+ - `reading`: Pronunciation dictionary, e.g. `{ Mekuru: "めくる" }`. Longer keys win; displayed text is unchanged.
94
+ - `gap`: Trailing silence in frames. Default: `Math.round(0.3 * fps)` (9 at 30 fps).
95
+ - `gain-db`: Playback gain in dB. Default: no adjustment.
96
+ - `len`: Total frames, including the gap. Default: rounded-up audio duration + `gap`. Does not change speaking speed.
97
+ - `id`, `at`: Identifier and start timing for the generated `<dur>`; see [timing](../../docs/reference/Syntax.md#timing-attributes).
98
+
99
+ Ruby `|表示《よみ》` reads `よみ` and keeps `表示` in the timeline. ASCII `|` and `漢字《かんじ》` also work. `<br />` becomes a space; other nested elements are rejected. Use `<seq>` for successive lines and `<stack>` for speech with subtitles. For lip sync, wrap a line in a [portrait's `Talk`](../portrait/README.md).
100
+
101
+ ### Cache and preview
102
+
103
+ - Audio is cached in `.mekuru/cache/tts/` by engine, voice settings, and spoken text. Cached lines work without a running engine.
104
+ - Connection URLs and playback settings do not invalidate audio. Remove the cached WAV to regenerate speech after changing a server or updating a model under the same name.
105
+ - `writeXml()` writes a silent draft while synthesizing, then replaces it with completed XML. Await it before video export.
106
+
107
+ ### Connection
108
+
109
+ `url` → `MEKURU_COEIROINK_URL` → the default URL, in that order. Check from the same environment as Bun:
110
+
111
+ ```sh
112
+ curl http://127.0.0.1:50032/v1/speakers
113
+ ```
114
+
115
+ For connection errors, check the engine and port. On Windows, use [WSL mirrored networking](https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking) to reach the engine through `127.0.0.1`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mekuru/coeiroink",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The speech component <Coeiroink> of Mekuru Movie Maker: lines of speech read by COEIROINK",
5
5
  "type": "module",
6
6
  "exports": {
@@ -11,13 +11,13 @@
11
11
  ],
12
12
  "sideEffects": false,
13
13
  "peerDependencies": {
14
- "@mekuru/core": "^0.1.1"
14
+ "@mekuru/core": "^0.1.2"
15
15
  },
16
16
  "devDependencies": {
17
- "@mekuru/core": "0.1.1"
17
+ "@mekuru/core": "0.1.2"
18
18
  },
19
19
  "dependencies": {
20
- "@mekuru/speech": "^0.1.1"
20
+ "@mekuru/speech": "^0.1.2"
21
21
  },
22
22
  "engines": {
23
23
  "bun": ">=1.4"
@@ -0,0 +1,16 @@
1
+ import type { CoeiroinkProps } from "./index.tsx";
2
+
3
+ export const tsukuyomi = { name: "つくよみちゃん", speaker: "つくよみちゃん" } satisfies Partial<CoeiroinkProps>;
4
+ export const mana = { name: "MANA", speaker: "MANA" } satisfies Partial<CoeiroinkProps>;
5
+ export const kana = { name: "KANA", speaker: "KANA" } satisfies Partial<CoeiroinkProps>;
6
+ export const ofutonp = { name: "おふとんP", speaker: "おふとんP" } satisfies Partial<CoeiroinkProps>;
7
+ export const ayaka = { name: "AI声優-朱花", speaker: "AI声優-朱花" } satisfies Partial<CoeiroinkProps>;
8
+ export const aoba = { name: "AI声優-青葉", speaker: "AI声優-青葉" } satisfies Partial<CoeiroinkProps>;
9
+ export const ginga = { name: "AI声優-銀芽", speaker: "AI声優-銀芽" } satisfies Partial<CoeiroinkProps>;
10
+ export const kanae = { name: "AI声優-金苗", speaker: "AI声優-金苗" } satisfies Partial<CoeiroinkProps>;
11
+ export const dia = { name: "ディアちゃん", speaker: "ディアちゃん" } satisfies Partial<CoeiroinkProps>;
12
+ export const arma = { name: "アルマちゃん", speaker: "アルマちゃん" } satisfies Partial<CoeiroinkProps>;
13
+ export const lilin = { name: "リリンちゃん", speaker: "リリンちゃん" } satisfies Partial<CoeiroinkProps>;
14
+ export const croix = { name: "クロワちゃん", speaker: "クロワちゃん" } satisfies Partial<CoeiroinkProps>;
15
+ export const andzie = { name: "アンジーさん", speaker: "アンジーさん" } satisfies Partial<CoeiroinkProps>;
16
+ export const ameno = { name: "アメノちゃん", speaker: "アメノちゃん" } satisfies Partial<CoeiroinkProps>;
package/src/index.tsx CHANGED
@@ -110,3 +110,5 @@ export const Coeiroink = async (props: CoeiroinkProps): Promise<Awaited<JSX.Elem
110
110
  const { url, ...voice } = voiceOf(props);
111
111
  return line("coeiroink", props, String(props.speaker), voice, (say, out) => engine(url).synthesize(props, say, out));
112
112
  };
113
+
114
+ export * from "./characters.ts";