Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting audio with java #1040

Open
ghost opened this issue Jun 26, 2022 · 8 comments
Open

Converting audio with java #1040

ghost opened this issue Jun 26, 2022 · 8 comments

Comments

@ghost
Copy link

ghost commented Jun 26, 2022

Good day,
I've been trying all day to convert audio so that Vosk can work with it. The default audio format I get (from Discord) is the following:

I want to convert this to Vosk format, but unfortunately I don't know exactly how. Can anyone help me? Best would be a code snippet, I have to admit that audio processing is not my thing :/
AudioFormat OUTPUT_FORMAT = new AudioFormat(48000.0F, 16, 2, true, true);

Here is also my code:
https://just-paste.it/FB0TyErtQP

Kind regards
Nicklas

@nshmyrev
Copy link
Collaborator

It has to be 1 instead of 2 (mono, not stereo).

@ghost
Copy link
Author

ghost commented Jun 26, 2022

It has to be 1 instead of 2 (mono, not stereo).

Hey, this is the audio fomat of discord, do you know how I can covert it?

@nshmyrev
Copy link
Collaborator

Something like

https://stackoverflow.com/a/50657152

@ghost
Copy link
Author

ghost commented Jun 26, 2022

I modified my source code, but it still not works:
https://just-paste.it/0O65WQXkAB

@nshmyrev
Copy link
Collaborator

AudioFormat OUTPUT_FORMAT = new AudioFormat(48000.0F, 16, 2, true, true);
should be probably true, false since the data is usually little endian.

@ghost
Copy link
Author

ghost commented Jun 27, 2022

AudioFormat OUTPUT_FORMAT = new AudioFormat(48000.0F, 16, 2, true, true); is the audio format from discord, this is not my audio format. I get the data in this format.

@ghost
Copy link
Author

ghost commented Jun 27, 2022

AudioFormat OUTPUT_FORMAT = new AudioFormat(48000.0F, 16, 2, true, true); should be probably true, false since the data is usually little endian.

Hello, I guess I have to apologize, I did not read correctly. I have now adjusted the value, the speech recognition now works without problems. Nevertheless, a new problem occurs, namely, it does not recognize getResult, but getPartialResult does. Normally it should end after a sentence, no matter how long I wait, it does not output a getResult and hangs everything on each other. Maybe you can help me further.

Here is also my curent source code:
https://just-paste.it/R0VJTcJlcO

@nshmyrev
Copy link
Collaborator

You need to dump bytes you feed to recognizer and share the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant