marytts.setVoice(voice.getName());
try {
AudioInputStream audio = marytts.generateAudio(text);
AudioPlayer player = new AudioPlayer(audio);
player.start();
player.join();
} catch (SynthesisException e) {
logger.error("Error during tts generation: {}", e.getLocalizedMessage(), e);
} catch (InterruptedException e) {
logger.error("Error during tts playback: {}", e.getLocalizedMessage(), e);