#include
#include
#include
void urdu_tts(char *text, float speed, float pitch, float volume) {
/* Create a text-to-speech engine. */
TTSEngine *engine = tts_engine_new();
/* Set the language to Urdu. */
tts_engine_set_language(engine, "ur");
/* Generate the audio. */
TTSAudio *audio = tts_engine_generate(engine, text, speed, pitch, volume);
/* Play the audio. */
tts_audio_play(audio);
/* Save the audio file to a file on your computer. */
tts_audio_save(audio, "output.wav");
/* Free the audio object. */
tts_audio_free(audio);
/* Free the text-to-speech engine object. */
tts_engine_free(engine);
}
int main() {
/* Get the user's input for text. */
char *text = malloc(1024);
printf("Enter your text: ");
fgets(text, 1024, stdin);
/* Get the user's input for speed, pitch, and volume. */
float speed = 1.0f;
float pitch = 1.0f;
float volume = 1.0f;
printf("Enter the speed (0-1): ");
scanf("%f", &speed);
printf("Enter the pitch (0-1): ");
scanf("%f", &pitch);
printf("Enter the volume (0-1): ");
scanf("%f", &volume);
/* Convert the text to Urdu text-to-speech. */
urdu_tts(text, speed, pitch, volume);
/* Free the text buffer. */
free(text);
return 0;
}
0 Comments
Thanks for reading my blog.