mirror of
https://github.com/jambonz/speech-utils.git
synced 2025-12-19 03:37:49 +00:00
Merge pull request #71 from jambonz/feat/azure_private_endpoint
support tts stream private endpoint
This commit is contained in:
@@ -380,7 +380,7 @@ async function _synthOnPremMicrosoft(logger, {
|
|||||||
text,
|
text,
|
||||||
filePath
|
filePath
|
||||||
}) {
|
}) {
|
||||||
const {use_custom_tts, custom_tts_endpoint_url} = credentials;
|
const {use_custom_tts, custom_tts_endpoint_url, api_key} = credentials;
|
||||||
let content = text;
|
let content = text;
|
||||||
|
|
||||||
if (use_custom_tts && !content.startsWith('<speak')) {
|
if (use_custom_tts && !content.startsWith('<speak')) {
|
||||||
@@ -404,7 +404,8 @@ async function _synthOnPremMicrosoft(logger, {
|
|||||||
const post = bent('POST', 'buffer', {
|
const post = bent('POST', 'buffer', {
|
||||||
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
|
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
|
||||||
'Content-Type': 'application/ssml+xml',
|
'Content-Type': 'application/ssml+xml',
|
||||||
'User-Agent': 'Jambonz'
|
'User-Agent': 'Jambonz',
|
||||||
|
...(api_key && {'Ocp-Apim-Subscription-Key': api_key})
|
||||||
});
|
});
|
||||||
const mp3 = await post(custom_tts_endpoint_url, content);
|
const mp3 = await post(custom_tts_endpoint_url, content);
|
||||||
return mp3;
|
return mp3;
|
||||||
@@ -452,6 +453,7 @@ const synthMicrosoft = async(logger, {
|
|||||||
params += ',write_cache_file=1';
|
params += ',write_cache_file=1';
|
||||||
if (region) params += `,region=${region}`;
|
if (region) params += `,region=${region}`;
|
||||||
if (custom_tts_endpoint) params += `,endpointId=${custom_tts_endpoint}`;
|
if (custom_tts_endpoint) params += `,endpointId=${custom_tts_endpoint}`;
|
||||||
|
if (custom_tts_endpoint_url) params += `,endpoint=${custom_tts_endpoint_url}`;
|
||||||
if (process.env.JAMBONES_HTTP_PROXY_IP) params += `,http_proxy_ip=${process.env.JAMBONES_HTTP_PROXY_IP}`;
|
if (process.env.JAMBONES_HTTP_PROXY_IP) params += `,http_proxy_ip=${process.env.JAMBONES_HTTP_PROXY_IP}`;
|
||||||
if (process.env.JAMBONES_HTTP_PROXY_PORT) params += `,http_proxy_port=${process.env.JAMBONES_HTTP_PROXY_PORT}`;
|
if (process.env.JAMBONES_HTTP_PROXY_PORT) params += `,http_proxy_port=${process.env.JAMBONES_HTTP_PROXY_PORT}`;
|
||||||
params += '}';
|
params += '}';
|
||||||
|
|||||||
Reference in New Issue
Block a user