Skip to content

Commit

Permalink
Merge pull request #71 from jambonz/feat/azure_private_endpoint
Browse files Browse the repository at this point in the history
support tts stream private endpoint
  • Loading branch information
davehorton authored May 14, 2024
2 parents eb57f4d + 90d6048 commit acb2d0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/synth-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ async function _synthOnPremMicrosoft(logger, {
text,
filePath
}) {
const {use_custom_tts, custom_tts_endpoint_url} = credentials;
const {use_custom_tts, custom_tts_endpoint_url, api_key} = credentials;
let content = text;

if (use_custom_tts && !content.startsWith('<speak')) {
Expand All @@ -404,7 +404,8 @@ async function _synthOnPremMicrosoft(logger, {
const post = bent('POST', 'buffer', {
'X-Microsoft-OutputFormat': trimSilence ? 'raw-8khz-16bit-mono-pcm' : 'audio-16khz-32kbitrate-mono-mp3',
'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);
return mp3;
Expand Down Expand Up @@ -452,6 +453,7 @@ const synthMicrosoft = async(logger, {
params += ',write_cache_file=1';
if (region) params += `,region=${region}`;
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_PORT) params += `,http_proxy_port=${process.env.JAMBONES_HTTP_PROXY_PORT}`;
params += '}';
Expand Down

0 comments on commit acb2d0c

Please sign in to comment.