'Java Request Wit.AI
I am creating a discord bot for me and my friends and I want the bot to recognize our language and then take actions. For that I wanted to use Wit.AI because it's quite a good API to convert speech to text.However, I don't know how to make the correct request in Java. I get the discord audio in a byte array:
@Override
public void handleCombinedAudio(@NotNull CombinedAudio combinedAudio) {
kiAudioBytes.add(combinedAudio.getAudioData(1));
AudioReceiveHandler.super.handleCombinedAudio(combinedAudio);
}
I then store these byte arrays in the ArrayList. Now how can I send a request to api.wit.ai/speech with these bytes to convert the bytes to text? My access token must be in the header of the request, as well as the content type ("Content type: audio/wav"). In addition, the byte arrays must somehow still be in the request... How?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
