Hi Frank;
I am still trying but it doesn't work through client server.I am
waiting your reply.Show me your code so that i can complete my
project.
Please help Me?
Regard
Waqar
On May 28, 12:48 pm, frankl <[EMAIL PROTECTED]> wrote:
> Thank you for you help, Waqar
>
> We are so excited, we succeed to output a wav file with FreeTTS on
> Android and use MediaPlayer project from this group to play it.
>
> On May 27, 3:39 pm, "Waqar Zahour" <[EMAIL PROTECTED]> wrote:
>
> > Hi Frank;
> > I am also working on porting FreeTTS on Android.
>
> > I am working previous one month, I think you have to write to the client in
> > android and which connect to the server which is in java but i am still
> > facing problems.
> > Here is a code of server which is in java.
>
> > import com.sun.speech.freetts.Voice;
> > import com.sun.speech.freetts.VoiceManager;
> > import com.sun.speech.freetts.audio.JavaClipAudioPlayer;
> > import java.io.*;
> > import java.net.*;
>
> > /**
> > * Simple program to demonstrate the use of the FreeTTS speech
> > * synthesizer. This simple program shows how to use FreeTTS
> > * without requiring the Java Speech API (JSAPI).
> > */
> > public class FreeTTSHelloWorld {
>
> > /**
> > * Example of how to list all the known voices.
> > */
> > public static void listAllVoices() {
> > System.out.println();
> > System.out.println("All voices available:");
> > VoiceManager voiceManager = VoiceManager.getInstance();
> > Voice[] voices = voiceManager.getVoices();
> > for (int i = 0; i < voices.length; i++) {
> > System.out.println(" " + voices[i].getName()
> > + " (" + voices[i].getDomain() + " domain)");
> > }
> > }
>
> > public static void main(String[] args) throws IOException{
> > Socket cs = null;
> > ServerSocket ss = null;
> > try {
> > ss = new ServerSocket(4444);
> > cs = ss.accept();
> > } catch (IOException e) {
> > System.out.println("Could not listen on port: 4444");
> > System.exit(-1);
> > }
> > PrintWriter pw = new PrintWriter(cs.getOutputStream(),true);
> > BufferedReader br = new BufferedReader(new
> > InputStreamReader(cs.getInputStream()));
>
> > String inputLine;
>
> > while ((inputLine = br.readLine()) != null) {
> > System.out.println("Message From the Client>" + inputLine);
>
> > listAllVoices();
>
> > String voiceName = (args.length > 0)
> > ? args[0]
> > : "kevin16";
>
> > System.out.println();
> > System.out.println("Using voice: " + voiceName);
>
> > /* The VoiceManager manages all the voices for FreeTTS.
> > */
> > VoiceManager voiceManager = VoiceManager.getInstance();
> > Voice helloVoice = voiceManager.getVoice(voiceName);
>
> > if (helloVoice == null) {
> > System.err.println(
> > "Cannot find a voice named "
> > + voiceName + ". Please specify a different
> > voice.");
> > System.exit(1);
> > }
>
> > /* Allocates the resources for the voice.
> > */
> > helloVoice.allocate();
>
> > /* Synthesize speech.
> > */
> > helloVoice.speak(inputLine);
>
> > /* Clean up and leave.
> > */
> > //helloVoice.deallocate();
> > System.exit(0);
> > //pw.println("Do you want to Play More:");
> > //pw.println("Enter Text: ");
>
> > }
> > pw.close();
> > br.close();
> > cs.close();
> > ss.close();
>
> > }
>
> > }
>
> > Here is a code of client in Android .
>
> > import java.io.PrintWriter;
> > import java.net.Socket;
> > import android.app.Activity;
> > import android.os.Bundle;
> > import com.lums.R;
>
> > public class HelloAndroid extends Activity {
> > /** Called when the activity is first created. */
> > @Override
> > public void onCreate(Bundle icicle) {
> > super.onCreate(icicle);
>
> > setContentView(R.layout.main);
> > client("Hello World");
>
> > }
>
> > public void client(String temp){
>
> > try {
> > Socket s = new Socket("localhost",4444);
> > PrintWriter pw = new PrintWriter(s.getOutputStream(),true);
>
> > System.out.println("Connected to Server");
>
> > pw.println(temp);
>
> > } catch (Exception e) {
> > System.out.println("Could not listen on port: 4444");
> > System.exit(-1);
> > }
> > }
>
> > }
>
> > Here is a Code but i still faces the problem.Give me your Code I''ll try my
> > best.
>
> > Regard
> > Waqar Zahoor
>
> > On Tue, May 27, 2008 at 8:33 AM, frankl <[EMAIL PROTECTED]> wrote:
>
> > > [text to speech] [text-to-speech] [text2speech] [tts]
> > > =====================================
>
> > > Hi,
>
> > > Our team is working on proting FreeTTS on Android.
>
> > > In last month, we succeeded to import FreeTTS sources code into
> > > Android and resolved most of issues and errors i.e. lack of packages
> > > and the issue of loading voice configuration. but we are stuck with
> > > the exception threw from the speak method of FreeTTS. The speak method
> > > is complicated, we are still researching it.
>
> > > On the other hand, we tried to output speech to an audio file with wav
> > > format to see if FreeTTS can generate speech on Android. But we got
> > > the error "Type is not supported". The exception is from the write
> > > method of AudioSystem class which is for writing audio data from a
> > > specified input stream to a specified audio file in Android. Then, we
> > > tried not to output the wav file, but pass the input stream generated
> > > by FreeTTS to MediaPlayer in Android. We failed again, and got an
> > > error without any error message.
>
> > > Anyone can help us?
>
> > > Thanks
> > > Frank- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---