Skip to content

Commit

Permalink
Undo commit: 4a4317a except flac lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry authored and Jerry committed Aug 29, 2015
1 parent 5c11b0f commit 5be2e14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/com/darkprograms/speech/recognizer/GSpeechDuplex.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public interface Catchable{
/**
* User-defined language
*/
private String language = "de-de";
private String language = "auto";

/**
* The maximum size the API will tolerate
Expand Down
27 changes: 12 additions & 15 deletions src/com/darkprograms/speech/synthesiser/SynthesiserV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
*/
public class SynthesiserV2 {

// private static final String GOOGLE_SYNTHESISER_URL = "http://www.google.com/speech-api/v2/synthesize?enc=mpeg" +
// "&client=chromium";
private static final String GOOGLE_SYNTHESISER_URL = "http://translate.google.com/translate_tts?";
private static final String GOOGLE_SYNTHESISER_URL = "https://www.google.com/speech-api/v2/synthesize?enc=mpeg" +
"&client=chromium";

/**
* API_KEY used for requests
Expand Down Expand Up @@ -151,26 +150,24 @@ public InputStream getMP3Data(String synthText) throws IOException{
String encoded = URLEncoder.encode(synthText, "UTF-8"); //Encode

StringBuilder sb = new StringBuilder(GOOGLE_SYNTHESISER_URL);
// sb.append("&key=" + API_KEY);
sb.append("q=" + encoded);
sb.append("&tl=" + "de");
sb.append("&key=" + API_KEY);
sb.append("&text=" + encoded);
sb.append("&lang=" + languageCode);

// if(speed>=0 && speed<=2.0){
// sb.append("&speed=" + speed/2.0);
// }
//
// if(pitch>=0 && pitch<=2.0){
// sb.append("&pitch=" + pitch/2.0);
// }
if(speed>=0 && speed<=2.0){
sb.append("&speed=" + speed/2.0);
}

if(pitch>=0 && pitch<=2.0){
sb.append("&pitch=" + pitch/2.0);
}

URL url = new URL(sb.toString()); //create url
System.out.println("URL: " + url);

// Open New URL connection channel.
URLConnection urlConn = url.openConnection(); //Open connection

urlConn.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0"); //Adding header for user agent is required
urlConn.addRequestProperty("Referer", "http://translate.google.com/");

return urlConn.getInputStream();
}
Expand Down
32 changes: 0 additions & 32 deletions src/com/darkprograms/speech/synthesiser/Tester.java

This file was deleted.

0 comments on commit 5be2e14

Please sign in to comment.