How can I implement voice recognition in JAVA mode?

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);
 }

stt

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?

please format your code with </> button not ” :pleading_face:

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

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.

yes otherwise it may be easier to send data to python scripts or something that already has a library.

but first,

:cold_face: :robot: :skull: :alien: please format your code with </> button not ” :japanese_ogre: :smiling_imp: :smiley_cat: :clown_face:

1 Like

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):
image

:)

2 Likes
2 Likes

@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 :slight_smile: 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.

I found a workaround by the author.

However, I will leave this as an exercise for you to find.

:)

1 Like

@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?

@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.

https://florianschulz.info/stt/

And it works!

:)

1 Like

@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 :slight_smile:

@GWAK,

Can you please elaborate on what the solution is?

:)

@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.

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

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.

Please share when you find something that works.

:)

1 Like

@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.