We are about to switch to a new forum software. Until then we have removed the registration on this forum.
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
AudioPlayer player;
Minim minim;
String MP3_Link = "";
void setup()
{
MP3_Link = doStuff();
println(MP3_Link);
player = minim.loadFile( MP3_Link + ".mp3", 2048);
player.loop();
}
String doStuff()
{
String language = "ko-KR";
String text = "Hello";
String urlData = "http://"+"translate.google.com/translate_tts?tl=";
urlData = urlData + language + "&q=" + encode(text);
println(urlData);
return urlData;
}
String encode(String text)
{
try
{
return java.net.URLEncoder.encode(text, "UTF-8");
}
catch (Exception e)
{
return "";
}
}
Good morning. nice to meet you.
I found the source code in the forum, but it does not work.
Is there a way to solve this? (I want to work in Android mode.)
Answers
@Gwak===
minim does not work with android so you get a NPE: use mediaPlayer + setDataSource(yoururl)
Dear akenaton,
Is the url wrong?
Or is it(source code) wrong?
@GWAK===
code is wrong: you are looking for an asset and not for an url. the url seems to work though i don't understand why you use "+". you never prepare and start the player.
(mod: the +s are fine, just string concat - i added them when i broke up the url to stop the forum formatter adding erroneous href markup)
@koogs===
ah! ok....but the code is wrong!