Getting text-to-speech working and connecting it to java - java

Ok so I have an artificial intelligence system running on my Mac through terminal, on localhost with java. I want to make my ai speak without flash. There is an HTML tag that could be easily plugged into a tts script, but I don't want to output an mp3 file, I want to output an audio tag with autoplay and hidden so that it seems every time you get a response from the ai, it will speak too.

Google translate TTS implemented as a servlet would solve this problem, I think. See this implementation. That is of course if you don't mind installing Tomcat or equivalent.
The problem is, until when will Google Translate TTS be free?

Do you know about the JavaSpeech API and, for example, the FreeTTS implementation?

Related

Porting Android code to BlackBerry naitivly

I am trying to port an Android application to BlackBerry 10 and make it look naitive. I have written all the QML for the app but I cannot seem to get the code to work. Do I need to translate the Java into C++ and if I do, do I have to do it manually or would an automatic one do?
Also my application has many different classes which I am not sure how to integrate with the BlackBerry layout.
I am trying to port the open source messenger Telegram, if that's any use. http://telegram.org/source/
Assuming you want to do a proper port and know C++ and Java, a full rewrite would be best. You can probably copy a lot of code from the Java source, but there's no way an automated converter or direct copy would ever work in C++.
Most of the processes in BlackBerry are the same as in Android, all you'd really need to do is rewrite all the UI code and handlers to fit the BlackBerry Native SDK

Bluetooth from a webpage

Is it possible to have JavaScript which calls a Java file (or something of the sort), so we can connect to a Bluetooth device and send it commands from a web page?
If it is possible, what are some ideas behind it that I can use to get it working?
Sorry for my poor language, I am not really sure how to word it.
Java can be used to send files via Bluetooth, and there is a tutorial on it at http://today.java.net/pub/a/today/2004/07/27/bluetooth.html
You could run a Java applet from the web browser that would use Bluetooth, although it would probably come up with a warning asking if you want to give the applet access to the files on your computer. JavaScript, however, would not be necessary, since an applet can run directly on a webpage.

Send commands between two computers over the internet

I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details.
Extra details: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions?
So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP.
I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives?
Thank you
VNC
SSH
Remote Desktop (Windows)
You can write a WEB APPLICATION. The encryption part is solved by simple HTTPS usage. On the server side (your home computer with USB devices attached to it) you should use Python (since you're quite experienced with it) and a Python Web Framework you want (I.E. Django).
While it is an interesting programming question, perhaps you should ask it on ServerFault instead? There you can probably get a lot of nice input on web-based administration / control tools.
Unless this is a "for fun" project for you, there are about a jillion things out there that already do this. And if you want to control a computer from a web browser, be prepared to require installing some kind of custom plugin - since browsers can't touch arbitrary files on the local filesystem, execute local applications, or do other things that are flagrant security risks.
I've been using VNC for over a decade - free and easy.
http://en.wikipedia.org/wiki/Virtual_Network_Computing
Well, I think that java can work well, in fact you have to deal with system calls to manage usb devices and things like that (and as far as I know, PHP is not the best language to do this). Also shouldn't be so hard to create a basic server/client program, just use good encryption mechanism to not show commands around web.
I you are looking for solution you could use from any computer anywhere in the worls without the need to install any software on client pc, try logmein.com (http://secure.logmein.com).
It is free, reliable, works in any modern browser, you don't have to remmeber IPs and hope they won't change, ...
Or if this is a "for fun project" why not write a php script, open port 80 in your router so you can access you script from outside, possibly dynamically link some domain to your IP (http://www.dyndns.com/). In the script you would just login and then for example type the orders in textfield in some form in your script. Lets just say you want to do some command prompt stuf, so you will basically remotely construst a *.bat file for example. Then the script stores this a fromtheinternets.bat to a folder on your desktop that is being constantly monitored for changes. And when such a change is found you just activate the bat file.
Insecure? Yes (It could be made secureER)
Fun to write? Definitely
PS: I am new here, hope it's not "illegal" to post link to actual services, instead of wiki lists. This is by no means and advertisement, I am just a happy user. :)

Audio Stream Transcoding with Android

Let me first state that I do not know Java. I'm a .NET developer with solid C# skills, but I'm actually attempting to learn Java and the Android SDK at the same time (I know it's probably not ideal, but oh well, I'm adventurous :))
That said, my end goal is to write a streaming media player for Android that can accept Windows Media streams. I'm okay with restricting myself to Android 2.0 and greater if I need to. My current device is a Motorola Droid running Android 2.0.1. There is one online radio service I listen to religiously on my PC that only offers Windows Media streaming, and I'd like to transcode the stream so my Android device can play it.
Is such a thing possible? If so, would it be feasible (i.e., would it be too CPU intensive and kill the battery)? Should I be looking into doing this with the NDK in native code instead of Java? I'm not opposed to writing some sort of service in between that runs on a desktop computer (even in C#), but ideally I'd like to explore purely device-based options first. Where should I start?
Thanks in advance for any insight you can provide!
Having a proxy on your PC that captures windows audio output, encodes it, and sends it to your phone is perfectly possible. I had something like that 8 years ago on a linux-based PDA (sharp zaurus). The trick is that you're not trying to decode or access the XM radio stream directly, you're simply capturing what is being sent to the speakers on your desktop and re-sending it. There will be a minor hit in audio quality due to the re-encode, but shouldn't be too bad.
I've done cloud-to-phone transcoding using an alpha version of Android Cloud Services. The transcoding is transparently done on a server and the resulting stream is streamed on the phone. Might worth having a look. http://positivelydisruptive.blogspot.com/2010/08/streaming-m4a-files-using-android-cloud.html

How to read console output in j2me cellphones? Where does System.out.println() go?

When writing j2me applications for cellphones, using System.out.println() prints on the console if using an emulator. However, when the code is deployed on a cellphone, where does the console output go?
If it is impossible to see this in the untethered cellphone, is there a way to see it if the cellphone is still connected to the deploying PC [via USB] ?
On Symbian phones (Nokia, Sony-Ericsson, Motorola, Samsung, Panasonic, Siemens, check for the Series60, Series80, Series90 or UIQ platforms), You can retrieve both System.out and System.err. Most importantly, you can retrieve Throwable.printStackTrace() as well.
Early versions of Symbian OS came with a native tool called Redirector. It ended up becoming available to third party MIDlet developers too. It might be hard to find these days but can be re-developed using C++ code that plugs into the Symbian implementation of the C standard library that the Java Virtual Machine uses.
Newer versions of Symbian OS come with an additional GCF protocol that allows retrieval of System.out, System.err and Throwable.printStackTrace() by simply using
javax.microedition.io.Connector.openDataInputStream("redirect://");
You may need to use "redirect://test" on some versions of Series60, during the transition from the Sun Ltd cldc-hi virtual machine to the IBM J9 virtual machine.
The connection needs to be opened before you launch the MIDlet whose output you want to log so you'll need to open it in a separate MIDlet.
I found this question with answers on j2me logging. Maybe one can try this if nothing else works. A simple way to access System.out.println() would be nice though.
Thank you for your response QuickRecipesOnSymbian.
In the following article you can find a corresponding J2ME MIDlet to display the standard error/output on Symbian phones:
http://wiki.forum.nokia.com/index.php/How_to_get_System.out_output_from_a_MIDlet_and_save_it_to_a_file_in_S60_devices
The solution works fine on Samsung i8910 as well.
(As I'm a newbie on this site, I could not post more than one links, so you need to find the zip with the sources and the jar at the end of the article.)
The simple answer is: nowhere you can see them. It does print somewhere (since loads of phones slow down if you have loads of prints) but, on most phones, there's no way to access it.
Some devices do display the console output, for example Sony Ericssons, which show it all if tethered and running the on-device debugging program. You can find out which do it and which don't by searching the developer sites (if they exist) of the various manufacturers.
Your best bet is to write a small method that appends to a StringBuffer within your program. Then map a key press that will display the contents of the StringBuffer on screen. It is invaluable for searching for those nasty device issues.
The only input I can offer is that this will differ greatly on each platform. I work mainly with BlackBerrys and System.err goes to the devices event log but I have no idea where System.out goes.
You should also be sure to not include println in your production code.
I have seen some phones that actually have a memory leak when doing this (e.g. Sanyo 8400 on Sprint.
Logging on devices is always a problem with J2ME because there's not a standard implementation for it.
I can address you to GEAR. It's a J2ME graphic framework that implements also a "in-device" debug console where you can print your lines and display them on your screen.
BlackBerry J2ME devices for example can be connected to the computer and the debugger can connect to that device. Once you run a program on the actual device, your System.out OutputStream goes to the debugger console.

Categories

Resources