@@ -98,6 +98,10 @@ def __init__(
9898 volume = 50 ,
9999 speech_rate = 1.0 ,
100100 pitch_rate = 1.0 ,
101+ seed = 0 ,
102+ synthesis_type = 0 ,
103+ instruction = None ,
104+ language_hints : list = None ,
101105 ):
102106 self .task_id = self .genUid ()
103107 self .apikey = apikey
@@ -109,6 +113,10 @@ def __init__(
109113 self .volume = volume
110114 self .speech_rate = speech_rate
111115 self .pitch_rate = pitch_rate
116+ self .seed = seed
117+ self .synthesis_type = synthesis_type
118+ self .instruction = instruction
119+ self .language_hints = language_hints
112120
113121 def genUid (self ):
114122 # 生成随机UUID
@@ -156,13 +164,19 @@ def getStartRequest(self, additional_params=None):
156164 'rate' : self .speech_rate ,
157165 'format' : self .format ,
158166 'pitch' : self .pitch_rate ,
167+ 'seed' : self .seed ,
168+ 'type' : self .synthesis_type
159169 },
160170 },
161171 }
162172 if self .format == 'opus' :
163173 cmd ['payload' ]['parameters' ]['bit_rate' ] = self .bit_rate
164174 if additional_params :
165175 cmd ['payload' ]['parameters' ].update (additional_params )
176+ if self .instruction is not None :
177+ cmd ['payload' ]['parameters' ]['instruction' ] = self .instruction
178+ if self .language_hints is not None :
179+ cmd ['payload' ]['parameters' ]['language_hints' ] = self .language_hints
166180 return json .dumps (cmd )
167181
168182 def getContinueRequest (self , text ):
@@ -207,6 +221,10 @@ def __init__(
207221 volume = 50 ,
208222 speech_rate = 1.0 ,
209223 pitch_rate = 1.0 ,
224+ seed = 0 ,
225+ synthesis_type = 0 ,
226+ instruction = None ,
227+ language_hints : list = None ,
210228 headers = None ,
211229 callback : ResultCallback = None ,
212230 workspace = None ,
@@ -237,6 +255,14 @@ def __init__(
237255 Dashscope workspace ID.
238256 url: str
239257 Dashscope WebSocket URL.
258+ seed: int
259+ The seed of the synthesizer, with a range from 0 to 65535. Default is 0.
260+ synthesis_type: int
261+ The type of the synthesizer, Default is 0.
262+ instruction: str
263+ The instruction of the synthesizer, max length is 128.
264+ language_hints: list
265+ The language hints of the synthesizer. supported language: zh, en.
240266 additional_params: Dict
241267 Additional parameters for the Dashscope API.
242268 """
@@ -271,6 +297,10 @@ def __init__(
271297 volume = volume ,
272298 speech_rate = speech_rate ,
273299 pitch_rate = pitch_rate ,
300+ seed = seed ,
301+ synthesis_type = synthesis_type ,
302+ instruction = instruction ,
303+ language_hints = language_hints
274304 )
275305 self .last_request_id = self .request .task_id
276306 self .start_event = threading .Event ()
0 commit comments