@aituber-onair/core 0.14.0 → 0.16.0
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/dist/constants/gemini.d.ts +1 -0
- package/dist/constants/gemini.js +2 -0
- package/dist/constants/gemini.js.map +1 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/core/AITuberOnAirCore.d.ts +1 -1
- package/dist/core/AITuberOnAirCore.js +1 -1
- package/dist/core/AITuberOnAirCore.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/services/chat/providers/claude/ClaudeChatService.js +2 -7
- package/dist/services/chat/providers/claude/ClaudeChatService.js.map +1 -1
- package/dist/services/chat/providers/gemini/GeminiChatService.js +5 -10
- package/dist/services/chat/providers/gemini/GeminiChatService.js.map +1 -1
- package/dist/services/chat/providers/openai/OpenAIChatService.js +8 -27
- package/dist/services/chat/providers/openai/OpenAIChatService.js.map +1 -1
- package/dist/types/index.d.ts +1 -8
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +1 -1
- package/dist/utils/chatServiceHttpClient.d.ts +46 -0
- package/dist/utils/chatServiceHttpClient.js +126 -0
- package/dist/utils/chatServiceHttpClient.js.map +1 -0
- package/dist/utils/emotionParser.d.ts +45 -0
- package/dist/utils/emotionParser.js +55 -0
- package/dist/utils/emotionParser.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/screenplay.js +5 -13
- package/dist/utils/screenplay.js.map +1 -1
- package/dist/utils/streamTextAccumulator.d.ts +24 -0
- package/dist/utils/streamTextAccumulator.js +43 -0
- package/dist/utils/streamTextAccumulator.js.map +1 -0
- package/package.json +4 -1
- package/dist/constants/voiceEngine.d.ts +0 -9
- package/dist/constants/voiceEngine.js +0 -12
- package/dist/constants/voiceEngine.js.map +0 -1
- package/dist/services/voice/VoiceEngineAdapter.d.ts +0 -46
- package/dist/services/voice/VoiceEngineAdapter.js +0 -205
- package/dist/services/voice/VoiceEngineAdapter.js.map +0 -1
- package/dist/services/voice/VoiceService.d.ts +0 -65
- package/dist/services/voice/VoiceService.js +0 -2
- package/dist/services/voice/VoiceService.js.map +0 -1
- package/dist/services/voice/engines/AivisSpeechEngine.d.ts +0 -16
- package/dist/services/voice/engines/AivisSpeechEngine.js +0 -80
- package/dist/services/voice/engines/AivisSpeechEngine.js.map +0 -1
- package/dist/services/voice/engines/MinimaxEngine.d.ts +0 -131
- package/dist/services/voice/engines/MinimaxEngine.js +0 -372
- package/dist/services/voice/engines/MinimaxEngine.js.map +0 -1
- package/dist/services/voice/engines/NijiVoiceEngine.d.ts +0 -11
- package/dist/services/voice/engines/NijiVoiceEngine.js +0 -105
- package/dist/services/voice/engines/NijiVoiceEngine.js.map +0 -1
- package/dist/services/voice/engines/NoneEngine.d.ts +0 -28
- package/dist/services/voice/engines/NoneEngine.js +0 -34
- package/dist/services/voice/engines/NoneEngine.js.map +0 -1
- package/dist/services/voice/engines/OpenAiEngine.d.ts +0 -9
- package/dist/services/voice/engines/OpenAiEngine.js +0 -35
- package/dist/services/voice/engines/OpenAiEngine.js.map +0 -1
- package/dist/services/voice/engines/VoiceEngine.d.ts +0 -25
- package/dist/services/voice/engines/VoiceEngine.js +0 -2
- package/dist/services/voice/engines/VoiceEngine.js.map +0 -1
- package/dist/services/voice/engines/VoiceEngineFactory.d.ts +0 -15
- package/dist/services/voice/engines/VoiceEngineFactory.js +0 -40
- package/dist/services/voice/engines/VoiceEngineFactory.js.map +0 -1
- package/dist/services/voice/engines/VoicePeakEngine.d.ts +0 -19
- package/dist/services/voice/engines/VoicePeakEngine.js +0 -58
- package/dist/services/voice/engines/VoicePeakEngine.js.map +0 -1
- package/dist/services/voice/engines/VoiceVoxEngine.d.ts +0 -19
- package/dist/services/voice/engines/VoiceVoxEngine.js +0 -77
- package/dist/services/voice/engines/VoiceVoxEngine.js.map +0 -1
- package/dist/services/voice/engines/index.d.ts +0 -8
- package/dist/services/voice/engines/index.js +0 -8
- package/dist/services/voice/engines/index.js.map +0 -1
- package/dist/services/voice/messages.d.ts +0 -3
- package/dist/services/voice/messages.js +0 -43
- package/dist/services/voice/messages.js.map +0 -1
- package/dist/types/nijiVoice.d.ts +0 -27
- package/dist/types/nijiVoice.js +0 -2
- package/dist/types/nijiVoice.js.map +0 -1
- package/dist/types/voice.d.ts +0 -35
- package/dist/types/voice.js +0 -19
- package/dist/types/voice.js.map +0 -1
- package/dist/types/voiceEngine.d.ts +0 -1
- package/dist/types/voiceEngine.js +0 -2
- package/dist/types/voiceEngine.js.map +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { textToScreenplay } from '../../utils/screenplay';
|
|
2
|
-
/**
|
|
3
|
-
* Adapter implementation for using existing voice engines
|
|
4
|
-
*/
|
|
5
|
-
export class VoiceEngineAdapter {
|
|
6
|
-
/**
|
|
7
|
-
* Constructor
|
|
8
|
-
* @param options Voice service options
|
|
9
|
-
*/
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.isPlayingAudio = false;
|
|
12
|
-
this.audioElement = null;
|
|
13
|
-
this.options = options;
|
|
14
|
-
// Create reusable audio element
|
|
15
|
-
if (typeof window !== 'undefined') {
|
|
16
|
-
this.audioElement = document.createElement('audio');
|
|
17
|
-
this.audioElement.addEventListener('ended', () => {
|
|
18
|
-
this.isPlayingAudio = false;
|
|
19
|
-
if (this.options.onComplete) {
|
|
20
|
-
this.options.onComplete();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Speak the screenplay as audio
|
|
27
|
-
* @param screenplay Screenplay (text and emotion)
|
|
28
|
-
* @param options Audio playback options
|
|
29
|
-
*/
|
|
30
|
-
async speak(screenplay, options) {
|
|
31
|
-
try {
|
|
32
|
-
if (this.isPlayingAudio) {
|
|
33
|
-
this.stop();
|
|
34
|
-
}
|
|
35
|
-
this.isPlayingAudio = true;
|
|
36
|
-
// Import existing VoiceEngineFactory dynamically
|
|
37
|
-
const { VoiceEngineFactory } = await import('./engines/VoiceEngineFactory');
|
|
38
|
-
// Map emotion to style used by existing engine
|
|
39
|
-
const getStyleFromEmotion = (emotion) => {
|
|
40
|
-
switch (emotion) {
|
|
41
|
-
case 'angry':
|
|
42
|
-
return 'angry';
|
|
43
|
-
case 'happy':
|
|
44
|
-
return 'happy';
|
|
45
|
-
case 'sad':
|
|
46
|
-
return 'sad';
|
|
47
|
-
case 'surprised':
|
|
48
|
-
return 'surprised';
|
|
49
|
-
default:
|
|
50
|
-
return 'neutral';
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
// Convert to Talk type for VoiceEngine
|
|
54
|
-
const talk = {
|
|
55
|
-
style: getStyleFromEmotion(screenplay.emotion || 'neutral'),
|
|
56
|
-
message: screenplay.text,
|
|
57
|
-
};
|
|
58
|
-
const engine = VoiceEngineFactory.getEngine(this.options.engineType);
|
|
59
|
-
// カスタムエンドポイントURLの設定
|
|
60
|
-
if (engine.setApiEndpoint) {
|
|
61
|
-
// エンジンタイプに応じてカスタムエンドポイントURLを設定
|
|
62
|
-
switch (this.options.engineType) {
|
|
63
|
-
case 'voicevox':
|
|
64
|
-
if (this.options.voicevoxApiUrl) {
|
|
65
|
-
engine.setApiEndpoint(this.options.voicevoxApiUrl);
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
case 'voicepeak':
|
|
69
|
-
if (this.options.voicepeakApiUrl) {
|
|
70
|
-
engine.setApiEndpoint(this.options.voicepeakApiUrl);
|
|
71
|
-
}
|
|
72
|
-
break;
|
|
73
|
-
case 'aivisSpeech':
|
|
74
|
-
if (this.options.aivisSpeechApiUrl) {
|
|
75
|
-
engine.setApiEndpoint(this.options.aivisSpeechApiUrl);
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// MiniMaxエンジンの場合、GroupIdを設定
|
|
81
|
-
if (this.options.engineType === 'minimax' && engine.setGroupId) {
|
|
82
|
-
if (this.options.groupId) {
|
|
83
|
-
engine.setGroupId(this.options.groupId);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
console.warn('MiniMax engine requires GroupId, but it is not provided in options');
|
|
87
|
-
}
|
|
88
|
-
// エンドポイントの設定もMinimaxEngineでサポートされている場合
|
|
89
|
-
if (this.options.endpoint && engine.setEndpoint) {
|
|
90
|
-
engine.setEndpoint(this.options.endpoint);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Get audio data
|
|
94
|
-
const audioBuffer = await engine.fetchAudio(talk, // Use any for type compatibility
|
|
95
|
-
this.options.speaker, this.options.apiKey);
|
|
96
|
-
// If there is a custom playback process, use it
|
|
97
|
-
if (this.options.onPlay) {
|
|
98
|
-
await this.options.onPlay(audioBuffer, options);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// Default playback process
|
|
102
|
-
await this.playAudioBuffer(audioBuffer, options?.audioElementId);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
console.error('Error in speak:', error);
|
|
106
|
-
this.isPlayingAudio = false;
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Speak text as audio
|
|
112
|
-
* @param text Text (with emotion tags) to speak
|
|
113
|
-
* @param options Audio playback options
|
|
114
|
-
*/
|
|
115
|
-
async speakText(text, options) {
|
|
116
|
-
// Convert text to screenplay and play
|
|
117
|
-
const screenplay = textToScreenplay(text);
|
|
118
|
-
return this.speak(screenplay, options);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Get whether currently playing
|
|
122
|
-
*/
|
|
123
|
-
isPlaying() {
|
|
124
|
-
return this.isPlayingAudio;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Stop playback
|
|
128
|
-
*/
|
|
129
|
-
stop() {
|
|
130
|
-
if (this.audioElement) {
|
|
131
|
-
this.audioElement.pause();
|
|
132
|
-
this.audioElement.currentTime = 0;
|
|
133
|
-
}
|
|
134
|
-
this.isPlayingAudio = false;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Update service settings
|
|
138
|
-
* @param options New settings options
|
|
139
|
-
*/
|
|
140
|
-
updateOptions(options) {
|
|
141
|
-
this.options = { ...this.options, ...options };
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Play audio buffer
|
|
145
|
-
* @param audioBuffer Audio data ArrayBuffer
|
|
146
|
-
* @param audioElementId ID of HTML element to play audio (use internal element if omitted)
|
|
147
|
-
*/
|
|
148
|
-
async playAudioBuffer(audioBuffer, audioElementId) {
|
|
149
|
-
return new Promise((resolve, reject) => {
|
|
150
|
-
try {
|
|
151
|
-
// If not in browser environment, do nothing
|
|
152
|
-
if (typeof window === 'undefined') {
|
|
153
|
-
this.isPlayingAudio = false;
|
|
154
|
-
resolve();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
// Create Blob from audio data
|
|
158
|
-
const blob = new Blob([audioBuffer], { type: 'audio/wav' });
|
|
159
|
-
const url = URL.createObjectURL(blob);
|
|
160
|
-
// Get/create audio element for playback
|
|
161
|
-
let audioEl = this.audioElement;
|
|
162
|
-
if (audioElementId) {
|
|
163
|
-
const customAudioEl = document.getElementById(audioElementId);
|
|
164
|
-
if (customAudioEl) {
|
|
165
|
-
audioEl = customAudioEl;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (!audioEl) {
|
|
169
|
-
reject(new Error('Audio element not available'));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
// Set event listeners
|
|
173
|
-
const onEnded = () => {
|
|
174
|
-
this.isPlayingAudio = false;
|
|
175
|
-
URL.revokeObjectURL(url);
|
|
176
|
-
audioEl?.removeEventListener('ended', onEnded);
|
|
177
|
-
if (this.options.onComplete) {
|
|
178
|
-
this.options.onComplete();
|
|
179
|
-
}
|
|
180
|
-
resolve();
|
|
181
|
-
};
|
|
182
|
-
const onError = (e) => {
|
|
183
|
-
this.isPlayingAudio = false;
|
|
184
|
-
URL.revokeObjectURL(url);
|
|
185
|
-
audioEl?.removeEventListener('error', onError);
|
|
186
|
-
reject(new Error(`Audio playback error: ${e.message}`));
|
|
187
|
-
};
|
|
188
|
-
audioEl.addEventListener('ended', onEnded);
|
|
189
|
-
audioEl.addEventListener('error', onError);
|
|
190
|
-
// Play audio
|
|
191
|
-
audioEl.src = url;
|
|
192
|
-
audioEl.play().catch((error) => {
|
|
193
|
-
this.isPlayingAudio = false;
|
|
194
|
-
URL.revokeObjectURL(url);
|
|
195
|
-
reject(error);
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
this.isPlayingAudio = false;
|
|
200
|
-
reject(error);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=VoiceEngineAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceEngineAdapter.js","sourceRoot":"","sources":["../../../src/services/voice/VoiceEngineAdapter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAK7B;;;OAGG;IACH,YAAY,OAA4B;QAPhC,mBAAc,GAAY,KAAK,CAAC;QAChC,iBAAY,GAA4B,IAAI,CAAC;QAOnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,gCAAgC;QAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAA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AK,CAAC;oBAC5B,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;oBACzB,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBAC/C,MAAM,CACJ,IAAI,KAAK,CAAC,yBAA0B,CAAgB,CAAC,OAAO,EAAE,CAAC,CAChE,CAAC;gBACJ,CAAC,CAAC;gBAEF,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC3C,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAE3C,aAAa;gBACb,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;gBAClB,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC7B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;oBAC5B,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;oBACzB,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ChatScreenplay, VoiceEngineType } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Voice service settings options
|
|
4
|
-
*/
|
|
5
|
-
export interface VoiceServiceOptions {
|
|
6
|
-
/** Speaker ID */
|
|
7
|
-
speaker: string;
|
|
8
|
-
/** Engine type (voicevox, voicepeak, openai, nijivoice, aivisSpeech) */
|
|
9
|
-
engineType: VoiceEngineType;
|
|
10
|
-
/** API key (if needed) */
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
/** Audio playback callback */
|
|
13
|
-
onPlay?: (audioBuffer: ArrayBuffer, options?: AudioPlayOptions) => Promise<void>;
|
|
14
|
-
/** Audio playback complete callback */
|
|
15
|
-
onComplete?: () => void;
|
|
16
|
-
/** Custom VOICEVOX API endpoint URL */
|
|
17
|
-
voicevoxApiUrl?: string;
|
|
18
|
-
/** Custom VOICEPEAK API endpoint URL */
|
|
19
|
-
voicepeakApiUrl?: string;
|
|
20
|
-
/** Custom AIVIS SPEECH API endpoint URL */
|
|
21
|
-
aivisSpeechApiUrl?: string;
|
|
22
|
-
/** MiniMax Group ID (required for MiniMax engine) */
|
|
23
|
-
groupId?: string;
|
|
24
|
-
/** MiniMax endpoint ('global' or 'china') */
|
|
25
|
-
endpoint?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Audio playback options
|
|
29
|
-
*/
|
|
30
|
-
export interface AudioPlayOptions {
|
|
31
|
-
/** ID of HTML element to play audio */
|
|
32
|
-
audioElementId?: string;
|
|
33
|
-
/** Enable animation processing */
|
|
34
|
-
enableAnimation?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Voice service interface
|
|
38
|
-
*/
|
|
39
|
-
export interface VoiceService {
|
|
40
|
-
/**
|
|
41
|
-
* Speak screenplay as audio
|
|
42
|
-
* @param screenplay Screenplay (text and emotion)
|
|
43
|
-
* @param options Audio playback options (default settings if omitted)
|
|
44
|
-
*/
|
|
45
|
-
speak(screenplay: ChatScreenplay, options?: AudioPlayOptions): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Speak text as audio
|
|
48
|
-
* @param text Text (with emotion tags) to speak
|
|
49
|
-
* @param options Audio playback options (default settings if omitted)
|
|
50
|
-
*/
|
|
51
|
-
speakText(text: string, options?: AudioPlayOptions): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Get whether currently playing
|
|
54
|
-
*/
|
|
55
|
-
isPlaying(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Stop playback
|
|
58
|
-
*/
|
|
59
|
-
stop(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Update service settings
|
|
62
|
-
* @param options New settings options
|
|
63
|
-
*/
|
|
64
|
-
updateOptions(options: Partial<VoiceServiceOptions>): void;
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceService.js","sourceRoot":"","sources":["../../../src/services/voice/VoiceService.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Talk } from '../../../types';
|
|
2
|
-
import { VoiceEngine } from './VoiceEngine';
|
|
3
|
-
/**
|
|
4
|
-
* AivisSpeech voice synthesis engine
|
|
5
|
-
*/
|
|
6
|
-
export declare class AivisSpeechEngine implements VoiceEngine {
|
|
7
|
-
private apiEndpoint;
|
|
8
|
-
fetchAudio(input: Talk, speaker: string): Promise<ArrayBuffer>;
|
|
9
|
-
private adjustEmotionParameters;
|
|
10
|
-
getTestMessage(textVoiceText?: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Set custom API endpoint URL
|
|
13
|
-
* @param apiUrl custom API endpoint URL
|
|
14
|
-
*/
|
|
15
|
-
setApiEndpoint(apiUrl: string): void;
|
|
16
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { AIVIS_SPEECH_API_URL } from '../../../constants';
|
|
2
|
-
/**
|
|
3
|
-
* AivisSpeech voice synthesis engine
|
|
4
|
-
*/
|
|
5
|
-
export class AivisSpeechEngine {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.apiEndpoint = AIVIS_SPEECH_API_URL;
|
|
8
|
-
}
|
|
9
|
-
async fetchAudio(input, speaker) {
|
|
10
|
-
const talk = input;
|
|
11
|
-
// talk.styleから感情を取得
|
|
12
|
-
const emotion = talk.style || 'neutral';
|
|
13
|
-
const text = talk.message.trim();
|
|
14
|
-
const ttsQueryResponse = await fetch(`${this.apiEndpoint}/audio_query?speaker=${speaker}&text=${encodeURIComponent(text)}`, { method: 'POST' });
|
|
15
|
-
if (!ttsQueryResponse.ok) {
|
|
16
|
-
throw new Error('Failed to fetch TTS query from AivisSpeech Engine.');
|
|
17
|
-
}
|
|
18
|
-
const ttsQueryJson = await ttsQueryResponse.json();
|
|
19
|
-
// adjust parameters according to emotion
|
|
20
|
-
this.adjustEmotionParameters(ttsQueryJson, emotion);
|
|
21
|
-
const synthesisResponse = await fetch(`${this.apiEndpoint}/synthesis?speaker=${speaker}`, {
|
|
22
|
-
method: 'POST',
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'Transfer-Encoding': 'chunked',
|
|
26
|
-
},
|
|
27
|
-
body: JSON.stringify(ttsQueryJson),
|
|
28
|
-
});
|
|
29
|
-
if (!synthesisResponse.ok) {
|
|
30
|
-
throw new Error('Failed to fetch TTS synthesis result from AivisSpeech Engine.');
|
|
31
|
-
}
|
|
32
|
-
const blob = await synthesisResponse.blob();
|
|
33
|
-
return await blob.arrayBuffer();
|
|
34
|
-
}
|
|
35
|
-
adjustEmotionParameters(ttsQueryJson, emotion) {
|
|
36
|
-
// default values
|
|
37
|
-
ttsQueryJson.speedScale = 1.0;
|
|
38
|
-
ttsQueryJson.pitchScale = 0.0;
|
|
39
|
-
ttsQueryJson.intonationScale = 1.0;
|
|
40
|
-
ttsQueryJson.tempoDynamicsScale = 1.0;
|
|
41
|
-
switch (emotion.toLowerCase()) {
|
|
42
|
-
case 'happy':
|
|
43
|
-
ttsQueryJson.speedScale = 1.1;
|
|
44
|
-
ttsQueryJson.pitchScale = 0.05;
|
|
45
|
-
ttsQueryJson.intonationScale = 1.2;
|
|
46
|
-
ttsQueryJson.tempoDynamicsScale = 1.1;
|
|
47
|
-
break;
|
|
48
|
-
case 'sad':
|
|
49
|
-
ttsQueryJson.speedScale = 0.9;
|
|
50
|
-
ttsQueryJson.pitchScale = -0.03;
|
|
51
|
-
ttsQueryJson.intonationScale = 0.8;
|
|
52
|
-
ttsQueryJson.tempoDynamicsScale = 0.9;
|
|
53
|
-
break;
|
|
54
|
-
case 'angry':
|
|
55
|
-
ttsQueryJson.speedScale = 1.0;
|
|
56
|
-
ttsQueryJson.pitchScale = 0.0;
|
|
57
|
-
ttsQueryJson.intonationScale = 1.4;
|
|
58
|
-
ttsQueryJson.tempoDynamicsScale = 1.2;
|
|
59
|
-
break;
|
|
60
|
-
case 'surprised':
|
|
61
|
-
ttsQueryJson.speedScale = 1.2;
|
|
62
|
-
ttsQueryJson.pitchScale = 0.07;
|
|
63
|
-
ttsQueryJson.intonationScale = 1.3;
|
|
64
|
-
ttsQueryJson.tempoDynamicsScale = 1.0;
|
|
65
|
-
break;
|
|
66
|
-
// default: "neutral" etc. other than default values
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
getTestMessage(textVoiceText) {
|
|
70
|
-
return textVoiceText || 'アイビススピーチを使用します';
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Set custom API endpoint URL
|
|
74
|
-
* @param apiUrl custom API endpoint URL
|
|
75
|
-
*/
|
|
76
|
-
setApiEndpoint(apiUrl) {
|
|
77
|
-
this.apiEndpoint = apiUrl;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=AivisSpeechEngine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AivisSpeechEngine.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/AivisSpeechEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAI1D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACU,gBAAW,GAAW,oBAAoB,CAAC;IA2FrD,CAAC;IAzFC,KAAK,CAAC,UAAU,CAAC,KAAW,EAAE,OAAe;QAC3C,MAAM,IAAI,GAAG,KAAa,CAAC;QAC3B,oBAAoB;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QA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,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,UAAU,GAAG,IAAI,CAAC;gBAC/B,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,YAAY,CAAC,kBAAkB,GAAG,GAAG,CAAC;gBACtC,MAAM;YACR,KAAK,KAAK;gBACR,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC;gBAChC,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,YAAY,CAAC,kBAAkB,GAAG,GAAG,CAAC;gBACtC,MAAM;YACR,KAAK,OAAO;gBACV,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,YAAY,CAAC,kBAAkB,GAAG,GAAG,CAAC;gBACtC,MAAM;YACR,KAAK,WAAW;gBACd,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC;gBAC9B,YAAY,CAAC,UAAU,GAAG,IAAI,CAAC;gBAC/B,YAAY,CAAC,eAAe,GAAG,GAAG,CAAC;gBACnC,YAAY,CAAC,kBAAkB,GAAG,GAAG,CAAC;gBACtC,MAAM;YACR,oDAAoD;QACtD,CAAC;IACH,CAAC;IAED,cAAc,CAAC,aAAsB;QACnC,OAAO,aAAa,IAAI,gBAAgB,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { Talk } from '../../../types';
|
|
2
|
-
import { VoiceEngine } from './VoiceEngine';
|
|
3
|
-
/**
|
|
4
|
-
* MiniMax endpoint types
|
|
5
|
-
*/
|
|
6
|
-
export type MinimaxEndpoint = 'global' | 'china';
|
|
7
|
-
/**
|
|
8
|
-
* MiniMax voice speaker information
|
|
9
|
-
*/
|
|
10
|
-
export interface MinimaxVoiceSpeaker {
|
|
11
|
-
voice_id: string;
|
|
12
|
-
voice_name: string;
|
|
13
|
-
gender: string;
|
|
14
|
-
language: string;
|
|
15
|
-
preview_audio?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* MiniMax TTS voice synthesis engine
|
|
19
|
-
*/
|
|
20
|
-
export declare class MinimaxEngine implements VoiceEngine {
|
|
21
|
-
private groupId?;
|
|
22
|
-
private model;
|
|
23
|
-
private defaultVoiceId;
|
|
24
|
-
private language;
|
|
25
|
-
private endpoint;
|
|
26
|
-
/**
|
|
27
|
-
* Set GroupId for MiniMax API
|
|
28
|
-
*
|
|
29
|
-
* GroupId is a unique identifier for the user group in MiniMax's system.
|
|
30
|
-
* Unlike other TTS engines that only require an API key, MiniMax requires both
|
|
31
|
-
* an API key and a GroupId for authentication and usage tracking.
|
|
32
|
-
*
|
|
33
|
-
* This GroupId is used by MiniMax for:
|
|
34
|
-
* - User group management
|
|
35
|
-
* - Usage statistics tracking
|
|
36
|
-
* - Billing and quota management
|
|
37
|
-
*
|
|
38
|
-
* You must obtain this pre-generated value from your MiniMax account dashboard.
|
|
39
|
-
*
|
|
40
|
-
* @param groupId GroupId for MiniMax API (required for production synthesis)
|
|
41
|
-
*/
|
|
42
|
-
setGroupId(groupId: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Set endpoint region for MiniMax API
|
|
45
|
-
* @param endpoint Endpoint region ('global' or 'china')
|
|
46
|
-
*/
|
|
47
|
-
setEndpoint(endpoint: MinimaxEndpoint): void;
|
|
48
|
-
/**
|
|
49
|
-
* Set model for MiniMax TTS
|
|
50
|
-
* @param model Model name (speech-02-hd, speech-02-turbo, speech-01-hd, speech-01-turbo)
|
|
51
|
-
*/
|
|
52
|
-
setModel(model: string): void;
|
|
53
|
-
/**
|
|
54
|
-
* Set language boost
|
|
55
|
-
* @param language Language to boost recognition
|
|
56
|
-
*/
|
|
57
|
-
setLanguage(language: string): void;
|
|
58
|
-
/**
|
|
59
|
-
* Get current API endpoint URL based on selected endpoint
|
|
60
|
-
* @returns API endpoint URL
|
|
61
|
-
*/
|
|
62
|
-
private getTtsApiUrl;
|
|
63
|
-
/**
|
|
64
|
-
* Get current voice list API endpoint URL based on selected endpoint
|
|
65
|
-
* @returns Voice list API endpoint URL
|
|
66
|
-
*/
|
|
67
|
-
private getVoiceListApiUrl;
|
|
68
|
-
/**
|
|
69
|
-
* Get available voice speakers list
|
|
70
|
-
* Requires only API key
|
|
71
|
-
* @param apiKey MiniMax API key
|
|
72
|
-
* @returns Promise<MinimaxVoiceSpeaker[]>
|
|
73
|
-
*/
|
|
74
|
-
getVoiceList(apiKey: string): Promise<MinimaxVoiceSpeaker[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Test voice synthesis with minimal requirements
|
|
77
|
-
* Requires API key and voice ID, but not GroupId
|
|
78
|
-
* @param text Text to synthesize (shorter text recommended for testing)
|
|
79
|
-
* @param voiceId Voice ID to test
|
|
80
|
-
* @param apiKey MiniMax API key
|
|
81
|
-
* @returns Promise<ArrayBuffer>
|
|
82
|
-
*/
|
|
83
|
-
testVoice(text: string, voiceId: string, apiKey: string): Promise<ArrayBuffer>;
|
|
84
|
-
/**
|
|
85
|
-
* Full production audio synthesis
|
|
86
|
-
* Requires API key, voice ID, and GroupId
|
|
87
|
-
* @param input Talk object
|
|
88
|
-
* @param speaker Voice ID
|
|
89
|
-
* @param apiKey MiniMax API key
|
|
90
|
-
* @param voiceActor Not used for MiniMax (for interface compatibility)
|
|
91
|
-
* @returns Promise<ArrayBuffer>
|
|
92
|
-
*/
|
|
93
|
-
fetchAudio(input: Talk, speaker: string, apiKey?: string, voiceActor?: any): Promise<ArrayBuffer>;
|
|
94
|
-
/**
|
|
95
|
-
* Audio synthesis with flexible GroupId requirement
|
|
96
|
-
* @param input Talk object
|
|
97
|
-
* @param speaker Voice ID
|
|
98
|
-
* @param apiKey MiniMax API key
|
|
99
|
-
* @param requireGroupId Whether to require GroupId (default: true)
|
|
100
|
-
* @returns Promise<ArrayBuffer>
|
|
101
|
-
*/
|
|
102
|
-
fetchAudioWithOptions(input: Talk, speaker: string, apiKey?: string, requireGroupId?: boolean): Promise<ArrayBuffer>;
|
|
103
|
-
/**
|
|
104
|
-
* Check if GroupId is configured
|
|
105
|
-
* @returns boolean
|
|
106
|
-
*/
|
|
107
|
-
hasGroupId(): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Get current endpoint setting
|
|
110
|
-
* @returns MinimaxEndpoint
|
|
111
|
-
*/
|
|
112
|
-
getEndpoint(): MinimaxEndpoint;
|
|
113
|
-
/**
|
|
114
|
-
* Set custom API endpoint URL (VoiceEngine interface compatibility)
|
|
115
|
-
* @param apiUrl custom API endpoint URL
|
|
116
|
-
*/
|
|
117
|
-
setApiEndpoint(apiUrl: string): void;
|
|
118
|
-
/**
|
|
119
|
-
* Get voice settings based on emotion
|
|
120
|
-
* @param emotion Emotion type
|
|
121
|
-
* @returns Voice settings
|
|
122
|
-
*/
|
|
123
|
-
private getVoiceSettings;
|
|
124
|
-
/**
|
|
125
|
-
* Convert hex string to ArrayBuffer
|
|
126
|
-
* @param hex Hex string
|
|
127
|
-
* @returns ArrayBuffer
|
|
128
|
-
*/
|
|
129
|
-
private hexToArrayBuffer;
|
|
130
|
-
getTestMessage(textVoiceText?: string): string;
|
|
131
|
-
}
|