i have a question that is anything their like api end point on azure tts which porovide voices data with sample voice url apart from this voices/list endpoint this giv list of voices but i want like azure portal which that i play audio sample which i want to here and than used to go with perticular voice after hearing . i tried by using tts endpoint by provideing sample text but it uses credit which i dont want
app.get(‘/api/voicegallery’, async (req, res) => {
try {
const response = await axios.get(https://eastus.tts.speech.microsoft.com/cognitiveservices/voices/list, {
headers: {
‘Ocp-Apim-Subscription-Key’: subscriptionKey
}
});
if (response.status === 200) {
const voices = response.data;
// Example of transforming the response data if needed
const voicesWithSamples = voices.voices.map(voice => ({
name: voice.name,
locale: voice.locale,
gender: voice.gender,
style: voice.style,
sampleUrl: `https://your-cdn-or-service/${voice.name}/sample.mp3` // Modify as needed
}));
res.json(voicesWithSamples);
} else {
console.log('Azure API Response Status:', response.status);
res.status(response.status).send('Error fetching voices.');
}
} catch (error) {
console.error('Error fetching voices:', error.response ? error.response.data : error.message);
res.status(500).send('Error fetching voices.');
}
});
nirmal patidar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.