Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27
  1. #21
    Join Date
    Jul 2010
    Location
    Jamshoro, Satabo Khairpur Mirs
    Posts
    21
    Rep Power
    0

  2. #22
    emmy22 is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default Re: Problem with mbrola.base

    I had the same problem: (System property "mbrola.base" is undefined. Will not use MBROLA voices.
    But i solved it by importing all the necessary jar files from freeTTS. and including the following code:
    System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoic eDirectory");

  3. #23
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default Re: Problem with mbrola.base

    Thanks, that helps to get rid of that nasty little message.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #24
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default Re: Problem with mbrola.base

    I dusted off this old thread because finally I have those mbrola voices operational: I did this (figured it out by trial and error):

    1) create a directory anywhere on your hard disk;
    2) store an executable 'mbrola' (or 'mbrola.exe' for MS Windows) file in that directory;
    3) from the mbrola site download the voice(s) in that directory;
    4) create an System property 'mbrola.base' with the value equal to the complete path of that directory.

    voila; the mbrola voices mbrola_us1, mbrola_us2 and mbrola_us3 should work.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #25
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Problem with mbrola.base

    I was trying this recently myself and gave up in disgust after wasting much of two days.

    Quote Originally Posted by JosAH View Post
    2) store an executable 'mbrola' (or 'mbrola.exe' for MS Windows) file in that directory;
    Would that be the 88 KB executable identified on their site as being for DOS, that comes in a dowbnload named mbr301d.zip (115 KB)? The only Windows executable I could find to download is MbrolaTools35.exe, which installs mbredit.exe, mbroli.exe, phoplayer.exe and (d'oh) unins000.exe -- but no mbrola.exe.

    I found it orders of magnitude easier to develop a Windows-only tts solution using VBScript. I'm hoping to add a Linux version once (if!) I can fathom how to get Festival text output into Java -- hence the abstract superclass.
    Java Code:
    package speech;
    
    import java.io.File;
    import java.io.IOException;
    import java.net.URL;
    
    public abstract class Speaker {
    
      protected Process process;
      protected File scriptFile;
      protected String[] voices;
      protected int voiceIndex = 0;
      protected int pitch = 0;
      protected int rate = -2;
      protected int volume = 50;
     
      protected Speaker() {
        populateVoiceArray();
        makeScriptFile();
      }
    
      protected abstract void populateVoiceArray();
    
      protected abstract void makeScriptFile();
    
      public Process speakAndWait(String call) {
        process = speak(call);
        try {
          process.waitFor();
        } catch (InterruptedException ex) {
          ex.printStackTrace();
        }
        return process;
      }
    
      public abstract Process speak(String call);
    
      public void shutUp() {
        if (process != null) {
          process.destroy();
        }
      }
    
      public String[] getVoices() {
        return voices;
      }
    
      public int getVoiceIndex() {
        return voiceIndex;
      }
    
      public void setVoiceIndex(int voiceIndex) {
        this.voiceIndex = voiceIndex;
      }
    
      public int getPitch() {
        return pitch;
      }
    
      public void setPitch(int pitch) {
        if (pitch > 10) {
          pitch = 10;
          return;
        }
        if (pitch < -10) {
          pitch = -10;
          return;
        }
        this.pitch = pitch;
      }
    
      public int getRate() {
        return rate;
      }
    
      public void setRate(int rate) {
        if (rate > 10) {
          rate = 10;
          return;
        }
        if (rate < -10) {
          rate = -10;
          return;
        }
        this.rate = rate;
      }
    
      public int getVolume() {
        return volume;
      }
    
      public void setVolume(int volume) {
        this.volume = volume;
      }
    }
    Java Code:
    package speech;
    
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.Scanner;
    
    public class WindowsSpeaker extends Speaker {
    
      protected void populateVoiceArray() {
        Scanner input = null;
        try {
          String voicesScript = ""
                  + "Set voice = CreateObject(\"Sapi.SpVoice\")\n"
                  + "Set voices = voice.getVoices\n"
                  + "wscript.echo voices.Count\n"
                  + "For Each v in voices\n"
                  + "  wscript.echo v.GetDescription\n"
                  + "Next\n";
          File file = File.createTempFile("Voices", ".vbs");
          file.deleteOnExit();
          FileWriter fw = new java.io.FileWriter(file);
          fw.write(voicesScript);
          fw.close();
          Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
          input = new Scanner(p.getInputStream());
    
          voices = new String[input.nextInt()];
          int index = 0;
          input.nextLine();
          while (input.hasNextLine()) {
            voices[index] = input.nextLine();
            index++;
          }
        } catch (IOException ex) {
          ex.printStackTrace();
        } finally {
          if (input != null) {
            input.close();
          }
        }
      }
    
      protected void makeScriptFile() {
        String speakScript = ""
                + "Set speaker = CreateObject(\"Sapi.SpVoice\")\n"
                + "Set voices = speaker.getVoices\n"
                + "Set speaker.voice = voices.item(WScript.Arguments(1))\n"
                + "speaker.Volume = WScript.Arguments(2)\n"
                + "speaker.Rate = WScript.Arguments(3)\n"
                + "speaker.Speak (WScript.Arguments(0))\n"
                + "speaker.WaitUntilDone\n";
        FileWriter fw = null;
        try {
          scriptFile = File.createTempFile("HousieCall", ".vbs");
          scriptFile.deleteOnExit();
          fw = new java.io.FileWriter(scriptFile);
          fw.write(speakScript);
        } catch (IOException ex) {
          ex.printStackTrace();
        } finally {
          if (fw != null) {
            try {
              fw.close();
            } catch (IOException ex) {
              ex.printStackTrace();
            }
          }
        }
      }
    
      public Process speak(String call) {
        process = null;
        try {
          process = Runtime.getRuntime().exec("cscript //NoLogo " + scriptFile.getPath()
                  + " \"<pitch middle='" + pitch + "'/> "
                  + call + "\" "
                  + voiceIndex + " " + volume + " " + rate);
        } catch (IOException ex) {
          ex.printStackTrace();
        }
        if (process == null) {
          throw new RuntimeException("Unable to launch VBScript");
        }
        return process;
      }
    }
    If you have Windows, you can see the classes in use, with a GUI front end, here.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #26
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Problem with mbrola.base

    And congratulations on the success!

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #27
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default Re: Problem with mbrola.base

    Quote Originally Posted by DarrylBurke View Post
    Would that be the 88 KB executable identified on their site as being for DOS, that comes in a dowbnload named mbr301d.zip (115 KB)? The only Windows executable I could find to download is MbrolaTools35.exe, which installs mbredit.exe, mbroli.exe, phoplayer.exe and (d'oh) unins000.exe -- but no mbrola.exe.
    Yep, that's the one; my windows box complains about a hostile executable so I had to turn that darn UAC off. And I did some more: in the jar file there's a MbrolaVoiceDirectory class and it only uses the (American) English voices us1, us2 and us3; I considered that a bit silly so I hacked that class a bit so I can load any mbrola voice I want. Everything (sort of) works ok now if only I could keep that stupid UAC make its mouth shut ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Page 2 of 2 FirstFirst 12

Similar Threads

  1. FreeTTS MBROLA problem
    By Fillis52 in forum New To Java
    Replies: 1
    Last Post: 01-16-2011, 05:48 AM
  2. Getting problem inserting data in data base
    By anupama in forum New To Java
    Replies: 4
    Last Post: 12-15-2010, 11:03 PM
  3. Base Conversion
    By javaman1 in forum New To Java
    Replies: 6
    Last Post: 12-10-2010, 08:32 PM
  4. Java with Data Base
    By Nerijus in forum New To Java
    Replies: 9
    Last Post: 05-21-2010, 12:54 PM
  5. [SOLVED] Base conversions
    By rlzyoner in forum New To Java
    Replies: 3
    Last Post: 12-10-2008, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •