Upload matcha_tts_raw.js
Browse files- js-esm/matcha_tts_raw.js +5 -4
js-esm/matcha_tts_raw.js
CHANGED
@@ -117,9 +117,9 @@ async infer(text, temperature, speed,spks=0) {
|
|
117 |
console.error("already processing")
|
118 |
return null
|
119 |
}
|
120 |
-
|
121 |
try{
|
122 |
-
|
123 |
|
124 |
const dic = this.processText(text);
|
125 |
console.log(`x:${dic.x.join(", ")}`);
|
@@ -163,11 +163,12 @@ const output = await this.session.run(send_data);
|
|
163 |
const wav_array = output.wav.data;
|
164 |
const x_lengths_array = output.wav_lengths.data;
|
165 |
|
166 |
-
this.processing = false
|
167 |
return wav_array;
|
168 |
}catch (exception){
|
169 |
-
|
170 |
return null
|
|
|
|
|
171 |
}
|
172 |
}
|
173 |
|
|
|
117 |
console.error("already processing")
|
118 |
return null
|
119 |
}
|
120 |
+
|
121 |
try{
|
122 |
+
this.processing = true; // try ブロック内で設定
|
123 |
|
124 |
const dic = this.processText(text);
|
125 |
console.log(`x:${dic.x.join(", ")}`);
|
|
|
163 |
const wav_array = output.wav.data;
|
164 |
const x_lengths_array = output.wav_lengths.data;
|
165 |
|
|
|
166 |
return wav_array;
|
167 |
}catch (exception){
|
168 |
+
console.error("Inference error:", exception);
|
169 |
return null
|
170 |
+
}finally{
|
171 |
+
this.processing = false;
|
172 |
}
|
173 |
}
|
174 |
|