public final class SpeechSynthesizerV2 extends Object implements AudioWebsocketCallback
| 构造器和说明 |
|---|
SpeechSynthesizerV2()
CosyVoice Speech Synthesis SDK
|
SpeechSynthesizerV2(SpeechSynthesisParam param,
ResultCallback<SpeechSynthesisResult> callback)
CosyVoice Speech Synthesis SDK
|
SpeechSynthesizerV2(SpeechSynthesisParam param,
ResultCallback<SpeechSynthesisResult> callback,
String baseUrl)
CosyVoice Speech Synthesis SDK
|
SpeechSynthesizerV2(SpeechSynthesisParam param,
ResultCallback<SpeechSynthesisResult> callback,
String baseUrl,
ConnectionOptions connectionOptions)
CosyVoice Speech Synthesis SDK
|
SpeechSynthesizerV2(String baseUrl,
ConnectionOptions connectionOptions)
CosyVoice Speech Synthesis SDK
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
asyncStreamingComplete() |
ByteBuffer |
call(String text) |
ByteBuffer |
call(String text,
long timeoutMillis) |
void |
close() |
void |
connect() |
long |
getFirstPackageDelay()
First Package Delay is the time between start sending text and receive first audio package
|
String |
getLastRequestId() |
void |
onClose(int code,
String reason) |
void |
onError(okhttp3.WebSocket webSocket,
Throwable t) |
void |
onMessage(okhttp3.WebSocket webSocket,
ByteBuffer bytes) |
void |
onMessage(okhttp3.WebSocket webSocket,
String text) |
void |
onOpen() |
void |
sendText(String text) |
void |
startSynthesizer(boolean enableSsml) |
void |
stopSynthesizer() |
void |
streamingCall(String text) |
void |
streamingCancel() |
void |
streamingComplete() |
void |
streamingComplete(long completeTimeoutMillis) |
void |
updateParamAndCallback(SpeechSynthesisParam param,
ResultCallback<SpeechSynthesisResult> callback) |
public SpeechSynthesizerV2(SpeechSynthesisParam param, ResultCallback<SpeechSynthesisResult> callback, String baseUrl, ConnectionOptions connectionOptions)
param - Configuration for speech synthesis, including voice type, volume, etc.callback - In non-streaming output scenarios, this can be set to nullbaseUrl - Base URLconnectionOptions - Connection optionspublic SpeechSynthesizerV2(String baseUrl, ConnectionOptions connectionOptions)
baseUrl - Base URLconnectionOptions - Connection optionspublic SpeechSynthesizerV2()
public SpeechSynthesizerV2(SpeechSynthesisParam param, ResultCallback<SpeechSynthesisResult> callback, String baseUrl)
param - Configuration for speech synthesis, including voice type, volume, etc.callback - In non-streaming output scenarios, this can be set to nullbaseUrl - Base URLpublic SpeechSynthesizerV2(SpeechSynthesisParam param, ResultCallback<SpeechSynthesisResult> callback)
param - Configuration for speech synthesis, including voice type, volume, etc.callback - In non-streaming output scenarios, this can be set to nullpublic void updateParamAndCallback(SpeechSynthesisParam param, ResultCallback<SpeechSynthesisResult> callback)
public String getLastRequestId()
public void connect()
throws NoApiKeyException,
InterruptedException
public void close()
public void startSynthesizer(boolean enableSsml)
throws InterruptedException
public void sendText(String text)
public void stopSynthesizer()
public void onOpen()
onOpen 在接口中 AudioWebsocketCallbackpublic void onMessage(okhttp3.WebSocket webSocket,
String text)
onMessage 在接口中 AudioWebsocketCallbackpublic void onMessage(okhttp3.WebSocket webSocket,
ByteBuffer bytes)
onMessage 在接口中 AudioWebsocketCallbackpublic void onError(okhttp3.WebSocket webSocket,
Throwable t)
onError 在接口中 AudioWebsocketCallbackpublic void onClose(int code,
String reason)
onClose 在接口中 AudioWebsocketCallbackpublic long getFirstPackageDelay()
public void streamingComplete(long completeTimeoutMillis)
public void streamingComplete()
public void asyncStreamingComplete()
public void streamingCancel()
public void streamingCall(String text)
public ByteBuffer call(String text, long timeoutMillis) throws RuntimeException
RuntimeExceptionpublic ByteBuffer call(String text)
Copyright © 2026. All rights reserved.