在java中gender_语音xml:lang =“en-US”xml:gender =“男”名称=“Microsoft服务器语音文本总是在女性语音中...

我只是想开发一个将文本转换为语音的功能 . 这里的问题是,转换总是发生在女性的声音中,即使我已经指定 xml:gender 为男性 . 这是我的功能,无论如何我可以用男声将我的文本转换成音频吗?

textToSpeech("This is a test to check the conversion of text to speech");

function textToSpeech(text: string) {

const requestOptions: request.CoreOptions = {

headers: {

"Ocp-Apim-Subscription-Key": config.speech.bingSpeech.key1,

}

};

request.post(

`${config.speech.bingSpeech.authEndPoint}/issueToken`,

requestOptions,

(err, response, body) => {

const accessToken = response.body;

const payLoad = `

${text}

`;

const requestOptions: request.CoreOptions = {

headers: {

"X-Microsoft-OutputFormat": "audio-16khz-128kbitrate-mono-mp3",

"Content-Type": "application/ssml+xml",

"Host": "speech.platform.bing.com",

"Content-Length": payLoad.length,

"Authorization": "Bearer " + accessToken,

"User-Agent": "NodeJS"

},

body: payLoad

};

request.post(

config.speech.bingSpeech.synthesizeUrl,

requestOptions

).pipe(fs.createWriteStream(__dirname + "/output.mp3"));

}

)

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值