user481404
user481404

Reputation: 21

Troubleshooting "System property mbrola.base is undefined. Will not use MBROLA voices" when converting text to speech using FreeTTS

 import com.sun.speech.freetts.*;
 import java.util.*; 

 public class Demofreetts
  {
   private String speaktext;
   public void doSpeak(String speak, String voice)
    {
     speaktext = speak;
     try
      {
       VoiceManager voiceManager = VoiceManager.getInstance();
       Voice voices = voiceManager.getVoice(voice);
       Voice sp = null;

       if(voices != null)
         sp = voices;

       else
         System.out.println("No Voice Available");



        sp.allocate();
        sp.speak(speaktext);
        sp.deallocate();



      }
     catch(Exception e)
      {
       e.printStackTrace();
      }
    }
   public static void main(String[]args)
   {
    Demofreetts obj = new Demofreetts();
    obj.doSpeak(args[0],"Kelvin16");
   }
  } 

The above code causes the following error:

System property "mbrola.base" is undefined.  Will not use MBROLA voices
No Voice Available
java.lang.NullPointerException
        at Demofreetts.doSpeak(Demofreetts.java:24)
        at Demofreetts.main(Demofreetts.java:39)

Upvotes: 0

Views: 2612

Answers (3)

yosef  girma
yosef girma

Reputation: 181

Here is the solution

Change the string voice parameter to one of the following.

1.kevin16 (all letters should be written in small case) 2.alan (this is also your next option alternate to kevin16 voice. but the message System property "mbrola.base" is undefined. Will not use MBROLA voices. Still exist but you can get the voice that you need.fortunately you can solve this problem by setting the property of mbrola voice. Using

     System.setProperty (" mbrola.base" ,"here the pathof property");.

Anyways it works for me please give it a try.

Upvotes: 0

smsm 094
smsm 094

Reputation: 11

just add System.setProperty

  System.setProperty("mbrola.base", "C:\\Users\\iup\\workspace\\newpro\\mbrola");
  VoiceManager voiceManager = VoiceManager.getInstance();

Upvotes: 0

Nelson
Nelson

Reputation: 29

You can convert the text to speech in Java using freetts1.2 API. It is quite simple to use. This link could be useful for you. It has an example program

http://learnsharelive.blogspot.com/2011/01/convert-text-to-speech-java-freetts12.html

Upvotes: 1

Related Questions