Open LarsZocher opened 7 years ago
// https://pastebin.com/C66n2dbD <-- after a while this was in the console
Hello :)
I have readen you code . Multiple mistakes i have seen ( Just to correct you , so you become better).
1)We never stop a Thread using stop() method . Possible it doesn't even exist on Java 9. 2)I need all the code in order to run it , where is the Plugin Manager ? :)
3)Create a repository with your project (in case you want to share it with me and people ) . I will of course help you .
4)Have you created you own GOOGLE_API_KEY
or you are using the one from the example :)
Waiting for your response to continue investigation .
GOOGLE_API_KEY = yours, because i dont know how to create my own, I tried but to get one i need to buy it on google, is there a way to get it free and with no credit card?
I dont know how to create a repository, but i uploaded my project files --> https://mega.nz/#!ug5FXCCb!lzqGzWI6EDGhlzc3x13q8u9ME9YQ1nQonkBuybD4IU4
what can i use instead of "stop()" ?
// in my file, there are 3 folders,
the plugins are not important, but i make it for later things, (I want to add the "speech commands" in the plugins)
1 ) You have to give credit card for GOOGLE_API_KEY , i will make a tutorial about it soon :)
2 ) I want from you to give 30 minutes of your life to learn how to create a repository for Github and how to upload it (GitHub Desktop is a useful application for uploading your files ) . I want you to try .
3 ) Instad of stop() we are using different techniques , like loops with flags and more , search on the web (Best ways to stop java Thread ) , it's quite a complex topic ( Threads are so beautiful once you learn them believe me ... actually it takes years to master the topic IT IS SOMETHING VERY IMPORTANT WITH MODERN COMPUTERS which have multiple CPU CORES )
In the mean time i will read your code and improve it.
Try this :
Class DotBot , line 95 you are missing an InterruptedException
, so when you stop the Listener something bad happens , try using ¨¨
try {
duplex.recognize(mic.getTargetDataLine(), mic.getAudioFormat());
} catch (IOException | LineUnavailableException | InterruptedException e) {
e.printStackTrace();
}```
here is my repository --> https://github.com/BubbleEgg/DotBot
Also
1) Use Java Logger for Debugging , all are ready for you :) so you focus on your project 2) Add comments 3) Add spaces between codes of lines sometimes .. 4) :)
ok, so is the problem fixed?
and when i try it with the InterruptedException, IntelliJ says that this exeption is never thrown? what can i do?
There is a problem here , even when you stop the Microphone the Thread nevers exits . Add
System.out.println("Exited Listening Thread....");
just before
});
listening.start();
There is a problem with the library microphone.close();
, hm i need to investigate this and it seems not something easy . Look , keep the interrupted exception , IntelliJ thinks is smarter that Java Compiler maybe lol . Try and tell me if you have again the problem you faced before.
As about the Thread stopping keep in mind the above and i will soon add Java Google Speech Recognition on XR3Player , then you know for soore i will investigate this issue :) .
it dont let me compile it, with the error
Well i got into this . Tell me your application has a pom.xml file ? Yes IntelliJ is correct about InterruptedException, you don't need it , i am using another version of the Java-Speech-Api that i have changed some things ....
In your project you must use V2.02 version of https://github.com/lkuza2/java-speech-api/releases
Though if you are using pom.xml with Maven modify this pom.xml for your needs , you have nothing to download Maven will take care for all the jars . I figured `java-speech-api
how to download from https://jitpack.io just know , i will update pom.xml of my repository accordingly .
[Remember this is the jar from the Owner of the Project ] , i am further modifying it to my repository ... [https://github.com/goxr3plus/java-speech-api ] [ The repository i made is experimental so always use the Owners one jar as shown below]
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JavaGoogleSpeechRecognizer</groupId>
<artifactId>JavaGoogleSpeechRecognizer</artifactId>
<version>1.0.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.lkuza2</groupId>
<artifactId>java-speech-api</artifactId>
<version>v2.02</version>
</dependency>
<dependency>
<groupId>net.sourceforge.javaflacencoder</groupId>
<artifactId>java-flac-encoder</artifactId>
<version>0.3.7</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20150729</version>
</dependency>
</dependencies>
<name>Java Google Speech Recognizer</name>
<description>Made by GOXR3PLUS STUDIO based on https://github.com/lkuza2/java-speech-api/</description>
<organization>
<name>GOXR3PLUS STUDIO</name>
</organization>
</project>
Since the owner Project released a lot of things have changed along with bug fixes . That might be what causing the problems ... lot of pull requests since [ January 2016 when the V2.02 releases ] -> https://github.com/lkuza2/java-speech-api/commits/master
so, i dont know how to use the pom.xml can you help me with that or do i need it anyway?, and I am using the V2.02? can you tell me what i have to do now?
//little update, I tried some things and now it works great. Now I'm using your version of the J.A.R.V.I.S and it workes good, but the method stopSpeechReginison() gives me a NullPointerExeption, so...
-->I use your JARVIS without the stopSpeechReginison() but it works. thx
You mean you downloaded the version of Jarvis from my repository? I just added stopSpeechRecognition() method yesterday and I didn't test it full. Gonna fix some things...
ok xD
I have fixed your problem and added a new SnapShot jar in my repository . Look : I am gonna create new github branches , one will transfer this project to Java 8 and some other branches which will contain new features .
I see that the owner of the project doesn't care for pull requests generally , either for emails i send so ....
I modified the repository , added example also how to use :) -> https://github.com/goxr3plus/java-speech-api
thats good :)
Hello, I try to make a bot like the "Alexa" from Amazon for my school project, and i found you on youtube... So, my problem is, that I want, that my Alexa is listening "forever", but when I say nothing for a while, my program say's: "Finished write on down stream..." in the console. I tried to make the google speech to text as a thread, and i restart the theard every 20 seconds, but it doesn't work. But this time with the theard, it writes "Finished write on down stream..." 10 times at the same time in the chat.
I hope you can fix it, thanks
// https://pastebin.com/WY5izrkb <-- my code // https://pastebin.com/QABMizRy <-- my console output