Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/java-speech-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkylion007 <dragonsrcool.aaron@gmail.com>2013-08-25 23:47:49 +0400
committerSkylion007 <dragonsrcool.aaron@gmail.com>2013-08-25 23:47:49 +0400
commitcfdd99d4580d5bc7e8d01681ce9548c028d614b9 (patch)
tree5e0fbfdc665fc327ee5e05d1370c80f65ddfc02f
parent0e64bb33625ada06123329ceb4776d729fafdb65 (diff)
Significant Code Optimization!
x2 or more speed improvement due to removal of unnecessary auto-detections while still allowing for someone to auto detect multiple language with a List<String>!
-rw-r--r--src/com/darkprograms/speech/synthesiser/Synthesiser.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/darkprograms/speech/synthesiser/Synthesiser.java b/src/com/darkprograms/speech/synthesiser/Synthesiser.java
index 3169a2a..2821601 100644
--- a/src/com/darkprograms/speech/synthesiser/Synthesiser.java
+++ b/src/com/darkprograms/speech/synthesiser/Synthesiser.java
@@ -83,12 +83,6 @@ public class Synthesiser {
*/
public InputStream getMP3Data(String synthText) throws Exception {
- if(synthText.length()>100){
- List<String> fragments = parseString(synthText);//parses String if too long
- return getMP3Data(fragments);
- }
-
-
String languageCode = this.languageCode;//Ensures retention of language settings if set to auto
if(languageCode == null || languageCode.equals("") || languageCode.equalsIgnoreCase("auto")){
@@ -103,6 +97,16 @@ public class Synthesiser {
languageCode = "en-us";//Reverts to Default Language if it can't detect it.
}
}
+
+ if(synthText.length()>100){
+ List<String> fragments = parseString(synthText);//parses String if too long
+ String tmp = getLanguage();
+ setLanguage(languageCode);//Keeps it from autodetecting each fragment.
+ InputStream out = getMP3Data(fragments);
+ setLanguage(tmp);//Reverts it to it's previous Language such as auto.
+ return out;
+ }
+
String encoded = URLEncoder.encode(synthText, "UTF-8"); //Encode