Some time ago I published a plugin that allows to communicate with a Dialogflow V2 chatbot from a Unity project. The plugin has been generally well received, but there was a missing feature that I wanted to implement but never had actual time to do it. Luckily for me, the magic of open source software found a volenterous programmer that implemented it.
Now, thanks to the github user hoatong-cse, I am happy to inform you that intent detection through voice messages is now supported by the plugin. You can download the latest version of the plugin from here.
The update also comes with an utility script set that allows recording and encoding of audio files. Use the AudioRecorder component to record audio from your microphone and automatically save it to an AudioClip in a AudioSource component attached to the same gameobject. After that, you can invoke the new DetectIntentFromAudio method after having properly converted the audio clip to a string.
string talker = "MyID";
byte[] audioBytes =
WavUtility.FromAudioClip(audioRecorder.recordedAudioClip);
string audioString = Convert.ToBase64String (audioBytes);
DetectIntentFromAudio(audioString, talker);