@kajidog/mcp-tts-voicevox 0.0.7 → 0.0.9
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.md +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -4
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/voicevox/api.d.ts +28 -0
- package/dist/voicevox/api.d.ts.map +1 -0
- package/dist/voicevox/error.d.ts +73 -0
- package/dist/voicevox/error.d.ts.map +1 -0
- package/dist/voicevox/index.d.ts +67 -0
- package/dist/voicevox/index.d.ts.map +1 -0
- package/dist/voicevox/index.js +12 -3
- package/dist/voicevox/player.d.ts +77 -0
- package/dist/voicevox/player.d.ts.map +1 -0
- package/dist/voicevox/player.js +8 -0
- package/dist/voicevox/queue/__tests__/manager.test.d.ts +2 -0
- package/dist/voicevox/queue/__tests__/manager.test.d.ts.map +1 -0
- package/dist/voicevox/queue/audio-generator.d.ts +33 -0
- package/dist/voicevox/queue/audio-generator.d.ts.map +1 -0
- package/dist/voicevox/queue/audio-player.d.ts +18 -0
- package/dist/voicevox/queue/audio-player.d.ts.map +1 -0
- package/dist/voicevox/queue/event-manager.d.ts +28 -0
- package/dist/voicevox/queue/event-manager.d.ts.map +1 -0
- package/dist/voicevox/queue/file-manager.d.ts +30 -0
- package/dist/voicevox/queue/file-manager.d.ts.map +1 -0
- package/dist/voicevox/queue/index.d.ts +7 -0
- package/dist/voicevox/queue/index.d.ts.map +1 -0
- package/dist/voicevox/queue/manager.d.ts +111 -0
- package/dist/voicevox/queue/manager.d.ts.map +1 -0
- package/dist/voicevox/queue/types.d.ts +96 -0
- package/dist/voicevox/queue/types.d.ts.map +1 -0
- package/dist/voicevox/types.d.ts +145 -0
- package/dist/voicevox/types.d.ts.map +1 -0
- package/dist/voicevox/utils.d.ts +13 -0
- package/dist/voicevox/utils.d.ts.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -52,6 +52,9 @@ await client.speak("こんにちは");
|
|
|
52
52
|
|
|
53
53
|
// テキストから音声ファイルを生成
|
|
54
54
|
const filePath = await client.generateAudioFile("こんにちは", "./output.wav");
|
|
55
|
+
|
|
56
|
+
// キューをクリア
|
|
57
|
+
await client.clearQueue();
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
## 主な機能
|
|
@@ -59,10 +62,13 @@ const filePath = await client.generateAudioFile("こんにちは", "./output.wav
|
|
|
59
62
|
- **テキスト読み上げ** (`speak`) - テキストを音声に変換して再生
|
|
60
63
|
- **クエリ生成** (`generate_query`) - 音声合成用クエリの作成
|
|
61
64
|
- **ファイル生成** (`synthesize_file`) - クエリから音声ファイルを生成
|
|
65
|
+
- **キュークリア** (`clear_queue`) - 現在の音声合成キューをすべてクリア
|
|
62
66
|
|
|
63
67
|
## 環境変数
|
|
64
68
|
|
|
65
69
|
- `VOICEVOX_URL`: VOICEVOXエンジンのURL(デフォルト: `http://localhost:50021`)
|
|
70
|
+
- `VOICEVOX_DEFAULT_SPEAKER`: デフォルト話者ID(例: `1`)
|
|
71
|
+
- `VOICEVOX_DEFAULT_SPEED_SCALE`: デフォルト再生速度(例: `1.0`)
|
|
66
72
|
|
|
67
73
|
## ライセンス
|
|
68
74
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { VoicevoxClient } from "./voicevox";
|
|
3
|
+
import { AudioQuery, VoicevoxConfig, VoicevoxError, Score, Note, FrameAudioQuery } from "./voicevox/types";
|
|
4
|
+
export { AudioQuery, VoicevoxConfig, VoicevoxClient, VoicevoxError, Score, Note, FrameAudioQuery, };
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,KAAK,EACL,IAAI,EACJ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AA4L1B,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,KAAK,EACL,IAAI,EACJ,eAAe,GAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.VoicevoxError = void 0;
|
|
4
|
+
exports.VoicevoxError = exports.VoicevoxClient = void 0;
|
|
5
5
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
6
6
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const voicevox_1 = require("./voicevox");
|
|
9
|
+
Object.defineProperty(exports, "VoicevoxClient", { enumerable: true, get: function () { return voicevox_1.VoicevoxClient; } });
|
|
9
10
|
const types_1 = require("./voicevox/types");
|
|
10
11
|
Object.defineProperty(exports, "VoicevoxError", { enumerable: true, get: function () { return types_1.VoicevoxError; } });
|
|
11
12
|
const server = new mcp_js_1.McpServer({
|
|
12
13
|
name: "MCP TTS Voicevox",
|
|
13
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.9",
|
|
14
15
|
description: "A Voicevox server that converts text to speech for playback and saving.",
|
|
15
16
|
});
|
|
16
17
|
// VoicevoxClientを一度だけインスタンス化
|
|
@@ -30,8 +31,8 @@ const handleError = (error) => {
|
|
|
30
31
|
// テキストを音声に変換して再生
|
|
31
32
|
server.tool("speak", "Convert text to speech and play it", {
|
|
32
33
|
text: zod_1.z
|
|
33
|
-
.string()
|
|
34
|
-
.describe("
|
|
34
|
+
.array(zod_1.z.string())
|
|
35
|
+
.describe("Provide an array of sentences to synthesize and play in order. For faster playback start, it is recommended to make the first element short."),
|
|
35
36
|
speaker: zod_1.z
|
|
36
37
|
.number()
|
|
37
38
|
.optional()
|
|
@@ -126,6 +127,18 @@ server.tool("synthesize_file", "Generate an audio file and return its absolute p
|
|
|
126
127
|
return handleError(error);
|
|
127
128
|
}
|
|
128
129
|
});
|
|
130
|
+
// キュークリアツール
|
|
131
|
+
server.tool("clear_queue", "Clear the current synthesis queue", {}, async () => {
|
|
132
|
+
try {
|
|
133
|
+
await voicevoxClient.clearQueue();
|
|
134
|
+
return {
|
|
135
|
+
content: [{ type: "text", text: "キューをクリアしました" }],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
return handleError(error);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
129
142
|
server.connect(new stdio_js_1.StdioServerTransport()).catch((error) => {
|
|
130
143
|
console.error("Error connecting to MCP transport:", error);
|
|
131
144
|
process.exit(1);
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AudioQuery } from "./types";
|
|
2
|
+
export declare class VoicevoxApi {
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
constructor(baseUrl: string);
|
|
5
|
+
/**
|
|
6
|
+
* テキストから音声合成用クエリを生成
|
|
7
|
+
*/
|
|
8
|
+
generateQuery(text: string, speaker?: number): Promise<AudioQuery>;
|
|
9
|
+
/**
|
|
10
|
+
* 音声合成用クエリから音声ファイルを生成
|
|
11
|
+
*/
|
|
12
|
+
synthesize(query: AudioQuery, speaker?: number): Promise<ArrayBuffer>;
|
|
13
|
+
/**
|
|
14
|
+
* プリセットを使用してテキストから音声合成用クエリを生成
|
|
15
|
+
*/
|
|
16
|
+
generateQueryFromPreset(text: string, presetId: number, coreVersion?: string): Promise<AudioQuery>;
|
|
17
|
+
/**
|
|
18
|
+
* APIリクエストを実行
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
private makeRequest;
|
|
22
|
+
/**
|
|
23
|
+
* URLの正規化
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private normalizeUrl;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/voicevox/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAiB,MAAM,SAAS,CAAC;AAGpD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,MAAM;IAI3B;;OAEG;IACU,aAAa,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,UAAU,CAAC;IAetB;;OAEG;IACU,UAAU,CACrB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,WAAW,CAAC;IAiBvB;;OAEG;IACU,uBAAuB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,CAAC;IAuBtB;;;OAGG;YACW,WAAW;IAuCzB;;;OAGG;IACH,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* エラーハンドリングを行い、適切なエラーメッセージとともに例外をスローします
|
|
3
|
+
* @param message エラーメッセージのプレフィックス
|
|
4
|
+
* @param error 発生したエラー
|
|
5
|
+
* @returns never(常に例外をスロー)
|
|
6
|
+
*/
|
|
7
|
+
export declare function handleError(message: string, error: unknown): never;
|
|
8
|
+
/**
|
|
9
|
+
* エラーハンドリングを行い、エラーメッセージを返します (例外をスローしない)
|
|
10
|
+
* @param message エラーメッセージのプレフィックス
|
|
11
|
+
* @param error 発生したエラー
|
|
12
|
+
* @returns エラーメッセージ
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatError(message: string, error: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* VOICEVOX関連のエラーコード
|
|
17
|
+
*/
|
|
18
|
+
export declare enum VoicevoxErrorCode {
|
|
19
|
+
API_CONNECTION_ERROR = "api_connection_error",
|
|
20
|
+
QUERY_GENERATION_ERROR = "query_generation_error",
|
|
21
|
+
SYNTHESIS_ERROR = "synthesis_error",
|
|
22
|
+
FILE_OPERATION_ERROR = "file_operation_error",
|
|
23
|
+
PLAYBACK_ERROR = "playback_error",
|
|
24
|
+
QUEUE_OPERATION_ERROR = "queue_operation_error",
|
|
25
|
+
UNKNOWN_ERROR = "unknown_error"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* VOICEVOXエラークラス
|
|
29
|
+
*/
|
|
30
|
+
export declare class VoicevoxError extends Error {
|
|
31
|
+
code: VoicevoxErrorCode;
|
|
32
|
+
originalError?: unknown;
|
|
33
|
+
constructor(message: string, code?: VoicevoxErrorCode, originalError?: unknown);
|
|
34
|
+
/**
|
|
35
|
+
* エラー発生箇所とスタックトレースを含むエラーの詳細情報を取得
|
|
36
|
+
*/
|
|
37
|
+
getDetailedMessage(): string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* エラーハンドリングユーティリティクラス
|
|
41
|
+
* アプリケーション全体で統一されたエラーハンドリングを提供
|
|
42
|
+
*/
|
|
43
|
+
export declare class ErrorHandler {
|
|
44
|
+
/**
|
|
45
|
+
* エラーをVoicevoxError形式に変換して例外をスロー
|
|
46
|
+
*/
|
|
47
|
+
static throw(message: string, code?: VoicevoxErrorCode, originalError?: unknown): never;
|
|
48
|
+
/**
|
|
49
|
+
* APIエラーを処理
|
|
50
|
+
*/
|
|
51
|
+
static handleApiError(message: string, error: unknown): never;
|
|
52
|
+
/**
|
|
53
|
+
* クエリ生成エラーを処理
|
|
54
|
+
*/
|
|
55
|
+
static handleQueryGenerationError(message: string, error: unknown): never;
|
|
56
|
+
/**
|
|
57
|
+
* 音声合成エラーを処理
|
|
58
|
+
*/
|
|
59
|
+
static handleSynthesisError(message: string, error: unknown): never;
|
|
60
|
+
/**
|
|
61
|
+
* ファイル操作エラーを処理
|
|
62
|
+
*/
|
|
63
|
+
static handleFileError(message: string, error: unknown): never;
|
|
64
|
+
/**
|
|
65
|
+
* 再生エラーを処理
|
|
66
|
+
*/
|
|
67
|
+
static handlePlaybackError(message: string, error: unknown): never;
|
|
68
|
+
/**
|
|
69
|
+
* キュー操作エラーを処理
|
|
70
|
+
*/
|
|
71
|
+
static handleQueueError(message: string, error: unknown): never;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/voicevox/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAIlE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAInE;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,oBAAoB,yBAAyB;IAC7C,sBAAsB,2BAA2B;IACjD,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,cAAc,mBAAmB;IACjC,qBAAqB,0BAA0B;IAC/C,aAAa,kBAAkB;CAChC;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,IAAI,EAAE,iBAAiB,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;gBAGtB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,iBAAmD,EACzD,aAAa,CAAC,EAAE,OAAO;IAQzB;;OAEG;IACH,kBAAkB,IAAI,MAAM;CAY7B;AAED;;;GAGG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,KAAK,CACV,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,iBAAmD,EACzD,aAAa,CAAC,EAAE,OAAO,GACtB,KAAK;IAKR;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;IAI7D;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;IAIzE;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;IAInE;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;IAI9D;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;IAIlE;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK;CAGhE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AudioQuery, VoicevoxConfig } from "./types";
|
|
2
|
+
export declare class VoicevoxClient {
|
|
3
|
+
private readonly player;
|
|
4
|
+
private readonly api;
|
|
5
|
+
private readonly defaultSpeaker;
|
|
6
|
+
private readonly defaultSpeedScale;
|
|
7
|
+
private readonly maxSegmentLength;
|
|
8
|
+
constructor(config: VoicevoxConfig);
|
|
9
|
+
/**
|
|
10
|
+
* テキストを音声に変換して再生します
|
|
11
|
+
* @param text 変換するテキストまたはテキストの配列
|
|
12
|
+
* @param speaker 話者ID(オプション)
|
|
13
|
+
* @param speedScale 再生速度(オプション)
|
|
14
|
+
* @returns 処理結果のメッセージ
|
|
15
|
+
*/
|
|
16
|
+
speak(text: string | string[], speaker?: number, speedScale?: number): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* テキストから音声合成用クエリを生成します
|
|
19
|
+
* @param text 変換するテキスト
|
|
20
|
+
* @param speaker 話者ID(オプション)
|
|
21
|
+
* @param speedScale 再生速度(オプション)
|
|
22
|
+
* @returns 音声合成用クエリ
|
|
23
|
+
*/
|
|
24
|
+
generateQuery(text: string, speaker?: number, speedScale?: number): Promise<AudioQuery>;
|
|
25
|
+
/**
|
|
26
|
+
* テキストから直接音声ファイルを生成します
|
|
27
|
+
* @param textOrQuery テキストまたは音声合成用クエリ
|
|
28
|
+
* @param outputPath 出力ファイルパス(オプション、省略時は一時ファイル)
|
|
29
|
+
* @param speaker 話者ID(オプション)
|
|
30
|
+
* @param speedScale 再生速度(オプション)
|
|
31
|
+
* @returns 生成した音声ファイルのパス
|
|
32
|
+
*/
|
|
33
|
+
generateAudioFile(textOrQuery: string | AudioQuery, outputPath?: string, speaker?: number, speedScale?: number): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* テキストを音声ファイル生成キューに追加します
|
|
36
|
+
* @param text テキスト
|
|
37
|
+
* @param speaker 話者ID(オプション)
|
|
38
|
+
* @param speedScale 再生速度(オプション)
|
|
39
|
+
* @returns 処理結果のメッセージ
|
|
40
|
+
*/
|
|
41
|
+
enqueueAudioGeneration(text: string, speaker?: number, speedScale?: number): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* 音声合成用クエリを音声ファイル生成キューに追加します
|
|
44
|
+
* @param query 音声合成用クエリ
|
|
45
|
+
* @param speaker 話者ID(オプション)
|
|
46
|
+
* @param speedScale 再生速度(オプション)
|
|
47
|
+
* @returns 処理結果のメッセージ
|
|
48
|
+
*/
|
|
49
|
+
enqueueAudioGeneration(query: AudioQuery, speaker?: number, speedScale?: number): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* 話者IDを取得(指定がない場合はデフォルト値を使用)
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private getSpeakerId;
|
|
55
|
+
/**
|
|
56
|
+
* 再生速度を取得(指定がない場合はデフォルト値を使用)
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private getSpeedScale;
|
|
60
|
+
private validateConfig;
|
|
61
|
+
/**
|
|
62
|
+
* キューをクリア
|
|
63
|
+
*/
|
|
64
|
+
clearQueue(): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export * from "./types";
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voicevox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKrD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;gBAE9B,MAAM,EAAE,cAAc;IASlC;;;;;;OAMG;IACU,KAAK,CAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IA+ClB;;;;;;OAMG;IACU,aAAa,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IAYtB;;;;;;;OAOG;IACU,iBAAiB,CAC5B,WAAW,EAAE,MAAM,GAAG,UAAU,EAChC,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IA8ClB;;;;;;OAMG;IACU,sBAAsB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IAElB;;;;;;OAMG;IACU,sBAAsB,CACjC,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IA4DlB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzC;AAGD,cAAc,SAAS,CAAC"}
|
package/dist/voicevox/index.js
CHANGED
|
@@ -30,7 +30,7 @@ class VoicevoxClient {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* テキストを音声に変換して再生します
|
|
33
|
-
* @param text
|
|
33
|
+
* @param text 変換するテキストまたはテキストの配列
|
|
34
34
|
* @param speaker 話者ID(オプション)
|
|
35
35
|
* @param speedScale 再生速度(オプション)
|
|
36
36
|
* @returns 処理結果のメッセージ
|
|
@@ -39,8 +39,11 @@ class VoicevoxClient {
|
|
|
39
39
|
try {
|
|
40
40
|
const speakerId = this.getSpeakerId(speaker);
|
|
41
41
|
const speed = this.getSpeedScale(speedScale);
|
|
42
|
-
const segments = (0, utils_1.splitText)(text, this.maxSegmentLength);
|
|
43
42
|
const queueManager = this.player.getQueueManager();
|
|
43
|
+
// 文字列配列の場合は直接使用、文字列の場合は分割して配列に変換
|
|
44
|
+
const segments = Array.isArray(text)
|
|
45
|
+
? text
|
|
46
|
+
: (0, utils_1.splitText)(text, this.maxSegmentLength);
|
|
44
47
|
if (segments.length === 0) {
|
|
45
48
|
return "テキストが空です";
|
|
46
49
|
}
|
|
@@ -65,7 +68,7 @@ class VoicevoxClient {
|
|
|
65
68
|
console.error("残りのセグメント処理中にエラーが発生しました:", error);
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
|
-
return `音声生成キューに追加しました: ${text}`;
|
|
71
|
+
return `音声生成キューに追加しました: ${Array.isArray(text) ? text.join(" ") : text}`;
|
|
69
72
|
}
|
|
70
73
|
catch (error) {
|
|
71
74
|
return (0, error_1.formatError)("音声生成中にエラーが発生しました", error);
|
|
@@ -206,6 +209,12 @@ class VoicevoxClient {
|
|
|
206
209
|
throw new Error("無効なVOICEVOXのURLです");
|
|
207
210
|
}
|
|
208
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* キューをクリア
|
|
214
|
+
*/
|
|
215
|
+
async clearQueue() {
|
|
216
|
+
return this.player.clearQueue();
|
|
217
|
+
}
|
|
209
218
|
}
|
|
210
219
|
exports.VoicevoxClient = VoicevoxClient;
|
|
211
220
|
// 型定義の再エクスポート
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AudioQuery } from "./types";
|
|
2
|
+
import { VoicevoxQueueManager } from "./queue";
|
|
3
|
+
/**
|
|
4
|
+
* VOICEVOX音声プレイヤークラス
|
|
5
|
+
* キュー管理システムを使用して音声の合成と再生を行う
|
|
6
|
+
*/
|
|
7
|
+
export declare class VoicevoxPlayer {
|
|
8
|
+
private queueManager;
|
|
9
|
+
/**
|
|
10
|
+
* コンストラクタ
|
|
11
|
+
* @param voicevoxUrl VOICEVOX Engine API URL
|
|
12
|
+
* @param prefetchSize 事前生成するアイテム数
|
|
13
|
+
*/
|
|
14
|
+
constructor(voicevoxUrl?: string, prefetchSize?: number);
|
|
15
|
+
/**
|
|
16
|
+
* テキストをキューに追加
|
|
17
|
+
* @param text 合成するテキスト
|
|
18
|
+
* @param speaker 話者ID
|
|
19
|
+
*/
|
|
20
|
+
enqueue(text: string, speaker?: number): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* クエリを使ってキューに追加
|
|
23
|
+
* @param query 音声合成用クエリ
|
|
24
|
+
* @param speaker 話者ID
|
|
25
|
+
*/
|
|
26
|
+
enqueueWithQuery(query: AudioQuery, speaker?: number): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* テキストから音声合成用クエリを生成
|
|
29
|
+
* キューマネージャーの内部機能を使用
|
|
30
|
+
* @param text 合成するテキスト
|
|
31
|
+
* @param speaker 話者ID
|
|
32
|
+
*/
|
|
33
|
+
generateQuery(text: string, speaker?: number): Promise<AudioQuery>;
|
|
34
|
+
/**
|
|
35
|
+
* 音声合成用クエリから音声ファイルを生成
|
|
36
|
+
* 重複を避けるためにQueueManagerの機能に委譲
|
|
37
|
+
*
|
|
38
|
+
* @param query 音声合成用クエリ
|
|
39
|
+
* @param output 出力ファイルパスまたは出力ディレクトリ(省略時は一時ディレクトリに生成)
|
|
40
|
+
* @param speaker 話者ID
|
|
41
|
+
*/
|
|
42
|
+
synthesizeToFile(query: AudioQuery, output?: string, speaker?: number): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* 再生を開始
|
|
45
|
+
*/
|
|
46
|
+
startPlayback(): void;
|
|
47
|
+
/**
|
|
48
|
+
* 再生を一時停止
|
|
49
|
+
*/
|
|
50
|
+
pausePlayback(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 再生を再開
|
|
53
|
+
*/
|
|
54
|
+
resumePlayback(): void;
|
|
55
|
+
/**
|
|
56
|
+
* キュー内のアイテム数を取得
|
|
57
|
+
*/
|
|
58
|
+
getQueueLength(): number;
|
|
59
|
+
/**
|
|
60
|
+
* キューが空かどうかを確認
|
|
61
|
+
*/
|
|
62
|
+
isQueueEmpty(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* キューが再生中かどうかを確認
|
|
65
|
+
*/
|
|
66
|
+
isPlaying(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* キューマネージャーインスタンスを取得
|
|
69
|
+
* 高度な操作のため公開
|
|
70
|
+
*/
|
|
71
|
+
getQueueManager(): VoicevoxQueueManager;
|
|
72
|
+
/**
|
|
73
|
+
* キューをクリア
|
|
74
|
+
*/
|
|
75
|
+
clearQueue(): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=player.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../src/voicevox/player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAmC,MAAM,SAAS,CAAC;AAiBhF;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAuB;IAE3C;;;;OAIG;gBAED,WAAW,GAAE,MAAiC,EAC9C,YAAY,GAAE,MAAU;IAsB1B;;;;OAIG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtE;;;;OAIG;IACU,gBAAgB,CAC3B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;OAKG;IACU,aAAa,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,UAAU,CAAC;IAStB;;;;;;;OAOG;IACU,gBAAgB,CAC3B,KAAK,EAAE,UAAU,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,MAAM,CAAC;IAkBlB;;OAEG;IACI,aAAa,IAAI,IAAI;IAI5B;;OAEG;IACI,aAAa,IAAI,IAAI;IAI5B;;OAEG;IACI,cAAc,IAAI,IAAI;IAI7B;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,YAAY,IAAI,OAAO;IAI9B;;OAEG;IACI,SAAS,IAAI,OAAO;IAM3B;;;OAGG;IACI,eAAe,IAAI,oBAAoB;IAI9C;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAKzC"}
|
package/dist/voicevox/player.js
CHANGED
|
@@ -140,5 +140,13 @@ class VoicevoxPlayer {
|
|
|
140
140
|
getQueueManager() {
|
|
141
141
|
return this.queueManager;
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* キューをクリア
|
|
145
|
+
*/
|
|
146
|
+
async clearQueue() {
|
|
147
|
+
return withErrorHandling(async () => {
|
|
148
|
+
await this.queueManager.clearQueue();
|
|
149
|
+
}, "キューのクリア中にエラーが発生しました");
|
|
150
|
+
}
|
|
143
151
|
}
|
|
144
152
|
exports.VoicevoxPlayer = VoicevoxPlayer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.test.d.ts","sourceRoot":"","sources":["../../../../src/voicevox/queue/__tests__/manager.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VoicevoxApi } from "../api";
|
|
2
|
+
import { AudioQuery } from "../types";
|
|
3
|
+
import { QueueItem, QueueItemStatus } from "./types";
|
|
4
|
+
import { AudioFileManager } from "./file-manager";
|
|
5
|
+
/**
|
|
6
|
+
* 音声生成クラス
|
|
7
|
+
* 音声合成処理を担当
|
|
8
|
+
*/
|
|
9
|
+
export declare class AudioGenerator {
|
|
10
|
+
private api;
|
|
11
|
+
private fileManager;
|
|
12
|
+
constructor(apiInstance: VoicevoxApi, fileManager: AudioFileManager);
|
|
13
|
+
/**
|
|
14
|
+
* テキストから音声クエリを生成
|
|
15
|
+
* @param text テキスト
|
|
16
|
+
* @param speaker 話者ID
|
|
17
|
+
* @returns 音声合成クエリ
|
|
18
|
+
*/
|
|
19
|
+
generateQuery(text: string, speaker: number): Promise<AudioQuery>;
|
|
20
|
+
/**
|
|
21
|
+
* テキストから音声データを生成してアイテムに設定
|
|
22
|
+
* @param item 処理対象のキューアイテム
|
|
23
|
+
* @param updateStatus ステータス更新コールバック関数
|
|
24
|
+
*/
|
|
25
|
+
generateAudio(item: QueueItem, updateStatus: (item: QueueItem, status: QueueItemStatus) => void): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* クエリから音声データを生成してアイテムに設定
|
|
28
|
+
* @param item 処理対象のキューアイテム (queryが必須)
|
|
29
|
+
* @param updateStatus ステータス更新コールバック関数
|
|
30
|
+
*/
|
|
31
|
+
generateAudioFromQuery(item: QueueItem, updateStatus: (item: QueueItem, status: QueueItemStatus) => void): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=audio-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-generator.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/audio-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,WAAW,CAAmB;gBAE1B,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB;IAKnE;;;;;OAKG;IACU,aAAa,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC;IAatB;;;;OAIG;IACU,aAAa,CACxB,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,KAAK,IAAI,GAC/D,OAAO,CAAC,IAAI,CAAC;IA6BhB;;;;OAIG;IACU,sBAAsB,CACjC,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,KAAK,IAAI,GAC/D,OAAO,CAAC,IAAI,CAAC;CAwBjB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 音声再生クラス
|
|
3
|
+
* 音声ファイルの再生処理を担当
|
|
4
|
+
*/
|
|
5
|
+
export declare class AudioPlayer {
|
|
6
|
+
/**
|
|
7
|
+
* 音声ファイルを再生
|
|
8
|
+
* @param filePath 再生する音声ファイルのパス
|
|
9
|
+
*/
|
|
10
|
+
playAudio(filePath: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* エラーをログ出力
|
|
13
|
+
* @param message エラーメッセージ
|
|
14
|
+
* @param error エラーオブジェクト
|
|
15
|
+
*/
|
|
16
|
+
logError(message: string, error: unknown): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=audio-player.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-player.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/audio-player.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,qBAAa,WAAW;IACtB;;;OAGG;IACU,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAMvD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { QueueEventType, QueueEventListener, QueueItem } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* イベント管理クラス
|
|
4
|
+
* キュー関連イベントの管理と発火を担当
|
|
5
|
+
*/
|
|
6
|
+
export declare class EventManager {
|
|
7
|
+
private eventListeners;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* イベントリスナーを追加
|
|
11
|
+
* @param event イベントタイプ
|
|
12
|
+
* @param listener リスナー関数
|
|
13
|
+
*/
|
|
14
|
+
addEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
15
|
+
/**
|
|
16
|
+
* イベントリスナーを削除
|
|
17
|
+
* @param event イベントタイプ
|
|
18
|
+
* @param listener リスナー関数
|
|
19
|
+
*/
|
|
20
|
+
removeEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
21
|
+
/**
|
|
22
|
+
* イベントを発火
|
|
23
|
+
* @param event 発火するイベントのタイプ
|
|
24
|
+
* @param item 関連するキューアイテム(オプション)
|
|
25
|
+
*/
|
|
26
|
+
emitEvent(event: QueueEventType, item?: QueueItem): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=event-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-manager.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/event-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAExE;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAAwD;;IAS9E;;;;OAIG;IACI,gBAAgB,CACrB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI;IAQP;;;;OAIG;IACI,mBAAmB,CACxB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI;IAUP;;;;OAIG;IACI,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI;CAahE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 一時ファイル管理クラス
|
|
3
|
+
* 音声ファイルの一時保存と削除を担当
|
|
4
|
+
*/
|
|
5
|
+
export declare class AudioFileManager {
|
|
6
|
+
/**
|
|
7
|
+
* 一時ファイルのパスを生成
|
|
8
|
+
* @returns 一時ファイルのフルパス
|
|
9
|
+
*/
|
|
10
|
+
createTempFilePath(): string;
|
|
11
|
+
/**
|
|
12
|
+
* 一時ファイルを削除
|
|
13
|
+
* @param filePath 削除するファイルのパス
|
|
14
|
+
*/
|
|
15
|
+
deleteTempFile(filePath: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* バイナリーデータを一時ファイルに保存
|
|
18
|
+
* @param audioData 音声バイナリーデータ
|
|
19
|
+
* @returns 保存した一時ファイルのパス
|
|
20
|
+
*/
|
|
21
|
+
saveTempAudioFile(audioData: ArrayBuffer): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* バイナリーデータを指定されたパスに保存
|
|
24
|
+
* @param audioData 音声バイナリーデータ
|
|
25
|
+
* @param output 出力ファイルパスまたは出力ディレクトリ
|
|
26
|
+
* @returns 保存したファイルのパス
|
|
27
|
+
*/
|
|
28
|
+
saveAudioFile(audioData: ArrayBuffer, output: string): Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=file-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/file-manager.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B;;;OAGG;IACI,kBAAkB,IAAI,MAAM;IAKnC;;;OAGG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D;;;;OAIG;IACU,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAUvE;;;;;OAKG;IACU,aAAa,CACxB,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;CAgCnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { VoicevoxApi } from "../api";
|
|
2
|
+
import { AudioQuery } from "../types";
|
|
3
|
+
import { QueueItem, QueueItemStatus, QueueEventType, QueueEventListener, QueueManager } from "./types";
|
|
4
|
+
import { AudioFileManager } from "./file-manager";
|
|
5
|
+
import { AudioGenerator } from "./audio-generator";
|
|
6
|
+
/**
|
|
7
|
+
* VOICEVOXキュー管理クラス
|
|
8
|
+
* 音声合成タスクのキュー管理と実行を担当
|
|
9
|
+
*/
|
|
10
|
+
export declare class VoicevoxQueueManager implements QueueManager {
|
|
11
|
+
private queue;
|
|
12
|
+
private isPlaying;
|
|
13
|
+
private isPaused;
|
|
14
|
+
private prefetchSize;
|
|
15
|
+
private currentPlayingItem;
|
|
16
|
+
private api;
|
|
17
|
+
private fileManager;
|
|
18
|
+
private eventManager;
|
|
19
|
+
private audioGenerator;
|
|
20
|
+
private audioPlayer;
|
|
21
|
+
/**
|
|
22
|
+
* コンストラクタ
|
|
23
|
+
* @param apiInstance VOICEVOX APIクライアントのインスタンス
|
|
24
|
+
* @param prefetchSize 事前生成するアイテム数
|
|
25
|
+
*/
|
|
26
|
+
constructor(apiInstance: VoicevoxApi, prefetchSize?: number);
|
|
27
|
+
/**
|
|
28
|
+
* キューに新しいテキストを追加
|
|
29
|
+
*/
|
|
30
|
+
enqueueText(text: string, speaker: number): Promise<QueueItem>;
|
|
31
|
+
/**
|
|
32
|
+
* キューに音声合成用クエリを追加
|
|
33
|
+
* @param query 音声合成用クエリ
|
|
34
|
+
* @param speaker 話者ID
|
|
35
|
+
* @returns 作成されたキューアイテム
|
|
36
|
+
*/
|
|
37
|
+
enqueueQuery(query: AudioQuery, speaker: number): Promise<QueueItem>;
|
|
38
|
+
/**
|
|
39
|
+
* キューからアイテムを削除
|
|
40
|
+
* @param itemId 削除するアイテムのID
|
|
41
|
+
* @returns 削除に成功したかどうか
|
|
42
|
+
*/
|
|
43
|
+
removeItem(itemId: string): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* キューをクリア
|
|
46
|
+
*/
|
|
47
|
+
clearQueue(): Promise<void>;
|
|
48
|
+
startPlayback(): Promise<void>;
|
|
49
|
+
pausePlayback(): Promise<void>;
|
|
50
|
+
resumePlayback(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* 次のアイテムを再生する
|
|
53
|
+
* 最初のREADY状態のアイテムを再生します
|
|
54
|
+
*/
|
|
55
|
+
playNext(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* イベントリスナーを追加
|
|
58
|
+
*/
|
|
59
|
+
addEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
60
|
+
/**
|
|
61
|
+
* イベントリスナーを削除
|
|
62
|
+
*/
|
|
63
|
+
removeEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
64
|
+
/**
|
|
65
|
+
* 現在のキュー内のアイテムを取得
|
|
66
|
+
*/
|
|
67
|
+
getQueue(): QueueItem[];
|
|
68
|
+
/**
|
|
69
|
+
* 特定のアイテムの状態を取得
|
|
70
|
+
*/
|
|
71
|
+
getItemStatus(itemId: string): QueueItemStatus | null;
|
|
72
|
+
/**
|
|
73
|
+
* キュー処理実行
|
|
74
|
+
* キューにある音声の生成と再生を処理
|
|
75
|
+
*/
|
|
76
|
+
private processQueue;
|
|
77
|
+
/**
|
|
78
|
+
* 次のアイテムの音声を事前に生成 (プリフェッチ)
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private prefetchAudio;
|
|
82
|
+
/**
|
|
83
|
+
* アイテムの状態を更新し、イベントを発火
|
|
84
|
+
* @param item 状態を更新するアイテム
|
|
85
|
+
* @param status 新しい状態
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
private updateItemStatus;
|
|
89
|
+
/**
|
|
90
|
+
* バイナリーデータを一時ファイルに保存
|
|
91
|
+
* @param audioData 音声バイナリーデータ
|
|
92
|
+
* @returns 保存した一時ファイルのパス
|
|
93
|
+
*/
|
|
94
|
+
saveTempAudioFile(audioData: ArrayBuffer): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* AudioGeneratorインスタンスを取得
|
|
97
|
+
* @returns AudioGeneratorインスタンス
|
|
98
|
+
*/
|
|
99
|
+
getAudioGenerator(): AudioGenerator;
|
|
100
|
+
/**
|
|
101
|
+
* FileManagerインスタンスを取得
|
|
102
|
+
* @returns AudioFileManagerインスタンス
|
|
103
|
+
*/
|
|
104
|
+
getFileManager(): AudioFileManager;
|
|
105
|
+
/**
|
|
106
|
+
* API インスタンスを取得
|
|
107
|
+
* @returns VoicevoxApi インスタンス
|
|
108
|
+
*/
|
|
109
|
+
getApi(): VoicevoxApi;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,kBAAkB,CAA0B;IAGpD,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;IAEjC;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,YAAY,GAAE,MAAU;IAW9D;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAuCpE;;;;;OAKG;IACU,YAAY,CACvB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC;IA0BrB;;;;OAIG;IACU,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BzD;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAS9B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5C;;;OAGG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtC;;OAEG;IACI,gBAAgB,CACrB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI;IAIP;;OAEG;IACI,mBAAmB,CACxB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI;IAIP;;OAEG;IACI,QAAQ,IAAI,SAAS,EAAE;IAK9B;;OAEG;IACI,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAK5D;;;OAGG;YACW,YAAY;IAiF1B;;;OAGG;YACW,aAAa;IA+B3B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;;;OAIG;IACU,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvE;;;OAGG;IACI,iBAAiB,IAAI,cAAc;IAI1C;;;OAGG;IACI,cAAc,IAAI,gBAAgB;IAIzC;;;OAGG;IACI,MAAM,IAAI,WAAW;CAG7B"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { AudioQuery } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* キューアイテムの状態
|
|
4
|
+
*/
|
|
5
|
+
export declare enum QueueItemStatus {
|
|
6
|
+
PENDING = "pending",// 初期状態
|
|
7
|
+
GENERATING = "generating",// 音声生成中
|
|
8
|
+
READY = "ready",// 再生準備完了
|
|
9
|
+
PLAYING = "playing",// 再生中
|
|
10
|
+
DONE = "done",// 再生完了
|
|
11
|
+
PAUSED = "paused",// 一時停止中
|
|
12
|
+
ERROR = "error"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* キューアイテムの情報
|
|
16
|
+
*/
|
|
17
|
+
export interface QueueItem {
|
|
18
|
+
id: string;
|
|
19
|
+
text: string;
|
|
20
|
+
speaker: number;
|
|
21
|
+
status: QueueItemStatus;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
audioData?: ArrayBuffer;
|
|
24
|
+
tempFile?: string;
|
|
25
|
+
query?: AudioQuery;
|
|
26
|
+
error?: Error;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* キュー管理イベントの種類
|
|
30
|
+
*/
|
|
31
|
+
export declare enum QueueEventType {
|
|
32
|
+
ITEM_ADDED = "item_added",// アイテム追加
|
|
33
|
+
ITEM_REMOVED = "item_removed",// アイテム削除
|
|
34
|
+
ITEM_STATUS_CHANGED = "item_status_changed",// 状態変更
|
|
35
|
+
ITEM_COMPLETED = "item_completed",// アイテム再生完了
|
|
36
|
+
QUEUE_CLEARED = "queue_cleared",// キュークリア
|
|
37
|
+
PLAYBACK_STARTED = "playback_started",// 再生開始
|
|
38
|
+
PLAYBACK_PAUSED = "playback_paused",// 再生一時停止
|
|
39
|
+
PLAYBACK_RESUMED = "playback_resumed",// 再生再開
|
|
40
|
+
PLAYBACK_COMPLETED = "playback_completed",// 再生完了
|
|
41
|
+
ERROR = "error"
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* キューイベントリスナー関数の型
|
|
45
|
+
*/
|
|
46
|
+
export type QueueEventListener = (event: QueueEventType, item?: QueueItem) => void;
|
|
47
|
+
/**
|
|
48
|
+
* キュー管理のインターフェース
|
|
49
|
+
*/
|
|
50
|
+
export interface QueueManager {
|
|
51
|
+
/**
|
|
52
|
+
* キューに新しいテキストを追加
|
|
53
|
+
*/
|
|
54
|
+
enqueueText(text: string, speaker: number, isKara?: boolean): Promise<QueueItem>;
|
|
55
|
+
/**
|
|
56
|
+
* キューに音声合成用クエリを追加
|
|
57
|
+
*/
|
|
58
|
+
enqueueQuery(query: AudioQuery, speaker: number): Promise<QueueItem>;
|
|
59
|
+
/**
|
|
60
|
+
* キューからアイテムを削除
|
|
61
|
+
*/
|
|
62
|
+
removeItem(itemId: string): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* キューをクリア
|
|
65
|
+
*/
|
|
66
|
+
clearQueue(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* 再生を開始
|
|
69
|
+
*/
|
|
70
|
+
startPlayback(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* 再生を一時停止
|
|
73
|
+
*/
|
|
74
|
+
pausePlayback(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* 再生を再開
|
|
77
|
+
*/
|
|
78
|
+
resumePlayback(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* イベントリスナーを追加
|
|
81
|
+
*/
|
|
82
|
+
addEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
83
|
+
/**
|
|
84
|
+
* イベントリスナーを削除
|
|
85
|
+
*/
|
|
86
|
+
removeEventListener(event: QueueEventType, listener: QueueEventListener): void;
|
|
87
|
+
/**
|
|
88
|
+
* 現在のキュー内のアイテムを取得
|
|
89
|
+
*/
|
|
90
|
+
getQueue(): QueueItem[];
|
|
91
|
+
/**
|
|
92
|
+
* 特定のアイテムの状態を取得
|
|
93
|
+
*/
|
|
94
|
+
getItemStatus(itemId: string): QueueItemStatus | null;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/voicevox/queue/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;GAEG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY,CAAE,OAAO;IAC5B,UAAU,eAAe,CAAE,QAAQ;IACnC,KAAK,UAAU,CAAE,SAAS;IAC1B,OAAO,YAAY,CAAE,MAAM;IAC3B,IAAI,SAAS,CAAE,OAAO;IACtB,MAAM,WAAW,CAAE,QAAQ;IAC3B,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,UAAU,eAAe,CAAE,SAAS;IACpC,YAAY,iBAAiB,CAAE,SAAS;IACxC,mBAAmB,wBAAwB,CAAE,OAAO;IACpD,cAAc,mBAAmB,CAAE,WAAW;IAC9C,aAAa,kBAAkB,CAAE,SAAS;IAC1C,gBAAgB,qBAAqB,CAAE,OAAO;IAC9C,eAAe,oBAAoB,CAAE,SAAS;IAC9C,gBAAgB,qBAAqB,CAAE,OAAO;IAC9C,kBAAkB,uBAAuB,CAAE,OAAO;IAClD,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK,EAAE,cAAc,EACrB,IAAI,CAAC,EAAE,SAAS,KACb,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,WAAW,CACT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,CAAC,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAErE;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhC;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE5E;;OAEG;IACH,mBAAmB,CACjB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI,CAAC;IAER;;OAEG;IACH,QAAQ,IAAI,SAAS,EAAE,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;CACvD"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VOICEVOXクライアントの設定オブジェクト
|
|
3
|
+
*/
|
|
4
|
+
export interface VoicevoxConfig {
|
|
5
|
+
/** VOICEVOXエンジンのURL */
|
|
6
|
+
url: string;
|
|
7
|
+
/** デフォルトの話者ID */
|
|
8
|
+
defaultSpeaker: number;
|
|
9
|
+
/** デフォルトの再生速度 */
|
|
10
|
+
defaultSpeedScale?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 音声合成用のクエリ
|
|
14
|
+
*/
|
|
15
|
+
export interface AudioQuery {
|
|
16
|
+
/** アクセント句のリスト */
|
|
17
|
+
accent_phrases: AccentPhrase[];
|
|
18
|
+
/** 全体の話速 */
|
|
19
|
+
speedScale: number;
|
|
20
|
+
/** 全体の音高 */
|
|
21
|
+
pitchScale: number;
|
|
22
|
+
/** 全体の抑揚 */
|
|
23
|
+
intonationScale: number;
|
|
24
|
+
/** 全体の音量 */
|
|
25
|
+
volumeScale: number;
|
|
26
|
+
/** 音声の前の無音時間 */
|
|
27
|
+
prePhonemeLength: number;
|
|
28
|
+
/** 音声の後の無音時間 */
|
|
29
|
+
postPhonemeLength: number;
|
|
30
|
+
/** 音声データの出力サンプリングレート */
|
|
31
|
+
outputSamplingRate: number;
|
|
32
|
+
/** 音声データをステレオ出力するか否か */
|
|
33
|
+
outputStereo: boolean;
|
|
34
|
+
/** AquesTalk風記法によるテキスト */
|
|
35
|
+
kana?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 文字列またはAudioQueryのいずれかを受け入れる型
|
|
39
|
+
*/
|
|
40
|
+
export type StringOrAudioQuery = string | AudioQuery;
|
|
41
|
+
/**
|
|
42
|
+
* アクセント句ごとの情報
|
|
43
|
+
*/
|
|
44
|
+
export interface AccentPhrase {
|
|
45
|
+
/** モーラのリスト */
|
|
46
|
+
moras: Mora[];
|
|
47
|
+
/** アクセント箇所 */
|
|
48
|
+
accent: number;
|
|
49
|
+
/** 後ろに無音を付けるかどうか */
|
|
50
|
+
pause_mora?: Mora;
|
|
51
|
+
/** 疑問形かどうか */
|
|
52
|
+
is_interrogative?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* モーラ(子音+母音)ごとの情報
|
|
56
|
+
*/
|
|
57
|
+
export interface Mora {
|
|
58
|
+
/** 文字 */
|
|
59
|
+
text: string;
|
|
60
|
+
/** 子音の音素 */
|
|
61
|
+
consonant?: string;
|
|
62
|
+
/** 子音の音長 */
|
|
63
|
+
consonant_length?: number;
|
|
64
|
+
/** 母音の音素 */
|
|
65
|
+
vowel: string;
|
|
66
|
+
/** 母音の音長 */
|
|
67
|
+
vowel_length: number;
|
|
68
|
+
/** 音高 */
|
|
69
|
+
pitch: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 歌唱パラメータ
|
|
73
|
+
*/
|
|
74
|
+
export interface SingingParameters {
|
|
75
|
+
/** 全体の話速 */
|
|
76
|
+
speedScale?: number;
|
|
77
|
+
/** 全体の音高 */
|
|
78
|
+
pitchScale?: number;
|
|
79
|
+
/** 全体の抑揚 */
|
|
80
|
+
intonationScale?: number;
|
|
81
|
+
/** 全体の音量 */
|
|
82
|
+
volumeScale?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 楽譜情報
|
|
86
|
+
*/
|
|
87
|
+
export interface Score {
|
|
88
|
+
/** 音符のリスト */
|
|
89
|
+
notes: Note[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 音符ごとの情報
|
|
93
|
+
*/
|
|
94
|
+
export interface Note {
|
|
95
|
+
/** ID */
|
|
96
|
+
id?: string | null;
|
|
97
|
+
/** 音階 */
|
|
98
|
+
key?: number;
|
|
99
|
+
/** 音符のフレーム長 */
|
|
100
|
+
frame_length: number;
|
|
101
|
+
/** 音符の歌詞 */
|
|
102
|
+
lyric: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* フレームごとの音声合成用のクエリ
|
|
106
|
+
*/
|
|
107
|
+
export interface FrameAudioQuery {
|
|
108
|
+
/** フレームごとの基本周波数 */
|
|
109
|
+
f0: number[];
|
|
110
|
+
/** フレームごとの音量 */
|
|
111
|
+
volume: number[];
|
|
112
|
+
/** 音素のリスト */
|
|
113
|
+
phonemes: FramePhoneme[];
|
|
114
|
+
/** 全体の音量 */
|
|
115
|
+
volumeScale: number;
|
|
116
|
+
/** 音声データの出力サンプリングレート */
|
|
117
|
+
outputSamplingRate: number;
|
|
118
|
+
/** 音声データをステレオ出力するか否か */
|
|
119
|
+
outputStereo: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 音素の情報
|
|
123
|
+
*/
|
|
124
|
+
export interface FramePhoneme {
|
|
125
|
+
/** 音素 */
|
|
126
|
+
phoneme: string;
|
|
127
|
+
/** 音素のフレーム長 */
|
|
128
|
+
frame_length: number;
|
|
129
|
+
/** 音符のID */
|
|
130
|
+
note_id?: string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* VOICEVOXエラークラス
|
|
134
|
+
*/
|
|
135
|
+
export declare class VoicevoxError extends Error {
|
|
136
|
+
/** ステータスコード */
|
|
137
|
+
statusCode: number;
|
|
138
|
+
/**
|
|
139
|
+
* VOICEVOXエラーを初期化する
|
|
140
|
+
* @param message エラーメッセージ
|
|
141
|
+
* @param statusCode ステータスコード
|
|
142
|
+
*/
|
|
143
|
+
constructor(message: string, statusCode: number);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/voicevox/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* テキストを自然な区切りで分割します
|
|
3
|
+
* @param text 分割するテキスト
|
|
4
|
+
* @param maxLength セグメントの最大長
|
|
5
|
+
* @returns 分割されたテキストの配列
|
|
6
|
+
*/
|
|
7
|
+
export declare function splitText(text: string, maxLength: number): string[];
|
|
8
|
+
/**
|
|
9
|
+
* テスト環境かどうかを判定します
|
|
10
|
+
* @returns テスト環境の場合はtrue、それ以外の場合はfalse
|
|
11
|
+
*/
|
|
12
|
+
export declare function isTestEnvironment(): boolean;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/voicevox/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAsEnE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kajidog/mcp-tts-voicevox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "VOICEVOX integration for MCP - Text-to-Speech server using VOICEVOX engine",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
6
7
|
"bin": {
|
|
7
8
|
"mcp-tts-voicevox": "dist/index.js"
|
|
8
9
|
},
|