简体   繁体   English

Google文字转语音延迟

[英]Google Text-To-Speech latency

I am creating a real-time voice application that involves the Google Text-To-Speech service. 我正在创建一个涉及Google Text-To-Speech服务的实时语音应用程序。 However, I am getting latencies of between 600-1100ms which is far too slow for my application. 但是,我得到的延迟在600-1100ms之间,这对于我的应用程序来说太慢了。 The audio is only around 3 seconds long, how can I improven this? 音频只有3秒左右,如何改善呢? (That latency is a measure of how long it take for me to send the request and then receive the audio). (该等待时间是我发送请求然后接收音频所花费的时间的度量)。

UPDATE UPDATE

The code I am using is: 我使用的代码是:

//I call this at the start of my program
TTSclient = TextToSpeechClient.Create();

//This is the method that I call everytime I make a TTS call in my program
public static Google.Protobuf.ByteString MakeTTS(string text)
    {
        SynthesisInput input = new SynthesisInput
        {
            Text = text
        };
        VoiceSelectionParams voice = new VoiceSelectionParams
        {
            LanguageCode = "en-AU",
            Name = "en-AU-Wavenet-A"
        };
        AudioConfig config = new AudioConfig
        {
            AudioEncoding = AudioEncoding.Linear16,
            SampleRateHertz = 16000,
            SpeakingRate = 0.9
        };
        var TTSresponse = TTSclient.SynthesizeSpeech(new SynthesizeSpeechRequest
        {
            Input = input,
            Voice = voice,
            AudioConfig = config
        });
        return TTSresponse.AudioContent;
    }

Thanks 谢谢

I recommend to check first the Latency median by API method in the metrics page of the TTS API . 我建议首先在TTS API指标页面中按API方法检查延迟中位数。 If you see there that the latency is between 600 to 1,100 ms, then I don't see much to do because all requests are done synchronously and since this is a shared resource, the SLA for those APIs only covers availability, not latency. 如果您看到那里的延迟在600到1,100毫秒之间,那么我就没什么大不了的,因为所有请求都是同步完成的,并且由于这是共享资源,因此这些API的SLA仅涵盖可用性,而不涉及延迟。

If the results you get there are way lower, then I can only think of two things that may slow down your results: the network's own latency or any additional processing being done. 如果获得的结果要低得多,那么我只能想到可能会减慢结果的两件事:网络自身的延迟或正在进行的任何其他处理。 If the latest is the case, then you would have to try and error different settings for your request (for example, I would wonder if specifying a device profile, since this feature is currently in beta, would probably result in a slightly slower response). 如果是最新的情况,那么您将不得不尝试为您的请求设置不同的设置(例如,我想知道是否指定设备配置文件,因为此功能目前处于测试阶段,可能会导致响应速度稍慢) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM