GWAK
April 29, 2021, 1:16am
1
please format code with </> button * homework policy * asking questions
How can I implement voice recognition in JAVA mode?
import com.getflourish.stt.*;
import ddf.minim.*;
import javax.sound.sampled.*;
STT stt;
String result;
String key = "key";
void setup ()
{
size(600, 200);
// Init STT automatically starts listening
stt = new STT(this, key);
stt.enableDebug();
stt.setLanguage("en");
// Display available Inputs with id and name
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
for(int i = 0; i < mixerInfo.length; i++)
{
println("### " + i + ": " + mixerInfo[i].getName());
}
// Set input (e.g. 0)
Mixer mixer = AudioSystem.getMixer(mixerInfo[6]);
// Update the Minim instance that STT is using
Minim minim = stt.getMinimInstance();
minim.setInputMixer(mixer);
println("### Source set to: " + mixerInfo[6]);
}
// Method is called if transcription was successfull
void transcribe (String utterance, float confidence)
{
println(utterance);
result = utterance;
}
public void keyPressed () {
stt.begin();
}
public void keyReleased () {
stt.end();
}
void draw ()
{
background(0);
}
You have been given an API key. (From Google)
But, it doesn’t work.
I think that’s because the SST library is old.
Is there any solution?
micuat
April 29, 2021, 8:33am
2
please format your code with </>
button not ”
You mean you replaced the key variable with an actual API key, right? As you pointed out it seems like an old library and most likely the protocol has changed.
1 Like
GWAK
April 29, 2021, 3:54pm
3
It seems that the library is out of date and cannot be started.
I am curious to see if anyone has solved it, so I post it.
micuat
April 29, 2021, 6:20pm
4
1 Like
glv
April 29, 2021, 7:15pm
5
I am curious why you are not properly formatting your code; this was requested in other topics as well.
As a courtesy to everyone in this community please format your code:
https://discourse.processing.org/faq#format-your-code
You can use the edit button (looks like a pencil):
:)
2 Likes
GWAK
May 1, 2021, 9:30am
7
@micuat
@glv
thank you for your answer.
However, I would like you to be interested in solving my solution.
but we want you to be interested in the fact that this is a community and we are not here to serve you And I already wrote that maybe you should look into libraries for other languages like python to do it and connect the programs somehow because I cannot help you further. I hope someone else would jump in and answer, but for that, formatting the code definitely helps “someone” look into the problem - they might turn away if they look at an unformatted code like you posted at first.
glv
May 1, 2021, 4:27pm
9
I found a workaround by the author.
However, I will leave this as an exercise for you to find.
:)
1 Like
GWAK
May 2, 2021, 11:24pm
10
@micuat
You are saying that Java alone cannot solve it.
Thank you for your answer. Let’s find a solution.
Is it correct that I understand?
GWAK
May 2, 2021, 11:26pm
11
@glv
I solved it through Android.
However, I’m not sure how to implement it via Java.
If you know the reference link,
I would appreciate it if you share it.
Thank you for your interest.
glv
May 2, 2021, 11:40pm
12
1 Like
GWAK
May 2, 2021, 11:53pm
13
@glv
Thank you for good information.
Thank you.
1 Like
No. I meant even if the library doesn’t work, it’s not the dead end but you can be “creative” to find other solutions
glv
May 3, 2021, 5:43pm
15
@GWAK ,
Can you please elaborate on what the solution is?
:)
GWAK
May 4, 2021, 4:01am
16
@glv
It was not resolved through the JAVA program.
I used it through Google STT in Android.
android can be easily implemented. However, it seems difficult with JAVA.
I’m currently looking for a solution.
glv
May 4, 2021, 3:11pm
17
You tagged a post in this topic as a solution; this post is advice but not a solution.
Perhaps you should “like” posts and tag a solution when it is found.
:)
1 Like
GWAK
May 5, 2021, 12:01am
18
We have confirmed that there is a solution through’websocket’.
thanks to you…
However, in order to be the system I want, JAVA must be run internally.
So, I need to do more research.
glv
May 5, 2021, 12:33am
19
Please share when you find something that works.
:)
1 Like
GWAK
May 5, 2021, 9:43am
20
@glv
I’m not looking for something else right now.
We are trying to solve it by looking for a number of ways.
If it is resolved, we will post it in a later notice.
Thank you.