Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tts-server-android发送的数据到手机里是一个字一个字读的 #45

Closed
zx3253773818 opened this issue Jan 27, 2023 · 4 comments

Comments

@zx3253773818
Copy link

大佬打扰了,请问是数据传输带空格吗还是怎么样😂,在tts-server-android内设置好测试语音时可以正常连读(系统设置tts后测试也可以正常连读),但是在阅读app内是一个字一个字读的,而配置google本地tts的可以正常连读,软件fbreader 手机1+7 pro 安卓12

@zx3253773818
Copy link
Author

B4QD8LCJLAUC%FHC)L{CN 1

@jing332
Copy link
Owner

jing332 commented Jan 27, 2023

这很明显是文本发过来时就是带空格的
检查阅读APP的净化和本APP的替换设置

@zx3253773818
Copy link
Author

谢谢,通过替换空格,可以正常阅读了,文本是正常的,手机系统更新后出现的问题,更新后原先用的tts app也是单字读,不知道是阅读软件还是系统的问题😂。大佬软件好用的!👍👍

@caton-hpg
Copy link

我也用的fbreader,也有相同的问题。 咱们“朗读规则” 里 怎么去空格?

我改了下.replace(/ /g, '')没有效果:

let SpeechRuleJS = {
    name: "旁白/对话",
    id: "ttsrv.multi_voice",
    author: "TTS Server",
    version: 4,
    tags: {narration: "旁白", dialogue: "对话"},

    handleText(text) {
        const list = [];
        let tmpStr = "";
        let endTag = "narration";

        text.split("").forEach((char, index) => {
            tmpStr += char;

            if (char === '“') {
                endTag = "dialogue";
                list.push({text: tmpStr, tag: "narration"});
                tmpStr = "";
            } else if (char === '”') {
                endTag = "narration";
                tmpStr = tmpStr.slice(0, -1)
                list.push({text: tmpStr, tag: "dialogue"});
                tmpStr = "";
            } else if (index === text.length - 1) {
                list.push({text: tmpStr, tag: endTag});
            }
        });

        return list;
    },

    splitText(text) {
        let separatorStr = "。??!!;;"

        let list = []
        let tmpStr = ""
        text.split("").forEach((char, index) => {
            tmpStr += char

            if (separatorStr.includes(char)) {
                list.push(tmpStr)
                tmpStr = ""
            } else if (index === text.length - 1) {
                list.push(tmpStr);
            }
        })

        return list.filter(item =>  item.replace(/[“”]/g, '').replace(/ /g, '').trim().length > 0);
    }

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants