Amit
Amit

Reputation: 1672

mbrola voice throws ProcessException "No audio data read" on linux CentOS

I am using mbrola voice (us1) on CentOS. I am trying to save the audio as wav file. But at the line (in bold below) - voice.speak(), it throws an exception ProcessException "No audio data read". It works fine when I run it on windows environment or even works on Linux with Kevin16 voice . Tried googling why voice.speak() command behaves this way for mbrola voices but could not find anything. Below is code, any clue ?

public static void createAudioFile(String text, String fileName) {
    AudioPlayer audioPlayer = null;

    System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
    Voice voice;
    VoiceManager vm =  VoiceManager.getInstance();
    voice = vm.getVoice("mbrola_us1");
    //voice = vm.getVoice("kevin16");
    voice.allocate();

    try{
        String directoryPath = audioDir+fileName;
        audioPlayer = new SingleFileAudioPlayer(directoryPath,Type.WAVE);
        voice.setAudioPlayer(audioPlayer);
        **voice.speak(text);**
        voice.deallocate();
        audioPlayer.close();

    }
    catch(Exception e){
        e.printStackTrace();
    }

}

Upvotes: 2

Views: 136

Answers (0)

Related Questions