feat: make exception for voice 043 in kr and en

This commit is contained in:
Haoyu Xu
2025-08-02 21:16:13 +08:00
parent 57d5cac582
commit 8ad0aba8cf
6 changed files with 66 additions and 13 deletions

View File

@@ -251,10 +251,16 @@ export default class Voice {
#nextVoice() {
const getVoiceId = () => {
const id =
this.#voice.list[
Math.floor(Math.random() * this.#voice.list.length)
]
let list = this.#voice.list
if (
this.#config.language === 'EN' ||
this.#config.language === 'KR'
) {
// filter out CN_043 as this voice is not available in en and kr
list = list.filter((item) => item !== 'CN_043')
}
const id = list[Math.floor(Math.random() * list.length)]
console.log(id, list, this.#config.language)
return id === this.#voice.id.last ? getVoiceId() : id
}
this.#playVoice(getVoiceId())