Tình hình là em có xài đoạn code như ri
BASE_URL="https://www.googleapis.com/language/translate/v2?key=[key]&q=hello%20world&source=en&target=de";
public static void main(String[] args) {
say("Hallo Welt");
}
public static void say(String text) {
try {
File f = new File("translate_tts.mp3");
String sentence = URLEncoder.encode(text,"UTF-8");
String urlString = MessageFormat.format(BASE_URL, sentence,"en");
BinaryResource res = new Resty().bytes(new URI(urlString));
res.save(f);
FileInputStream in = new FileInputStream(f);
Audio audio = Audio.getInstance();
audio.play(in);
Player p = new Player(in);
p.play();
p.close();
f.delete();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (JavaLayerException e) {
e.printStackTrace();
}
}
mà nó lại lỗi, huhu, có thánh nào rành java giúp em. em muốn xài để sử dụng text to speech
A không biết làm nhưng vào chào chú một tiếng =))
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?