The Vivoka SDK is meant to greatly facilitate the creation of voice-enabled applications, regardless of who's providing the underlying technologies!

Installation

Simply import the .aar file into your project with Android Studio and add a gradle dependency to use it.

Forexample,for the vsdk-csdk library:

implementation project(path: 'vsdk')
implementation project(path: ':vsdk-csdk')
JAVA

Configuration

All VSDK engines are to be initialized with a JSON configuration file. This file contains a version, then each engine will declare its own configuration block:

{
    "version": "2.0",
    "csdk": {
        ...
    },
    ...
}
JSON

We strongly recommend you put this file under a config directory because most engines will generate additional configuration files or use a cache (configurable).

Library versions

You can access the version of VSDK like so:

String vsdk_version = Vsdk.getVersion();
JAVA

Error Handling

The SDK will throw exceptions on each function call. A custom exception class has been created to help track the origin of the error.

try
{
    Vsdk.init(context, "configPath", callback);
}
catch (com.vivoka.vsdk.Exception e)
{
    // print the stacktrace (recommanded)
    e.printFormattedMessage();

    // get the stacktrace in a string
    String error = e.getFormattedMessage();

    // as com.vivoka.vsdk.Exception inherits from the java.lang.Exception class, you can also do this
    e.printStackTrace();
}
JAVA

Audio Management

VSDK being a SDK around voice technologies, audio is a central component. Starting from version 4, audio pipelining has been added for greater power and simplicity.

Pipeline

An audio pipeline is composed of 3 types of audio modules: one Producer, zero or more Modifiers and zero or more Consumers. Simply put: a producer sends audio (either synchronously or asynchronously) into modifiers (if any), and the resulting audio is finally given to consumers (if any).

// Create a pipeline
Pipeline pipeline = new Pipeline();

// Create an audio recorder which inherit from the ProducerModule
AudioRecorder audioRecorder = new AudioRecorder();
try
{
    pipeline.setProducer(audioRecorder);
}
catch (Exception e)
{
    e.printFormattedMessage();
}

// Create a recognizer which is inherited from the ConsumerModule
Recognizer recognizer;
try
{
    pipeline.pushBackConsumer(recognizer);
}
catch (Exception e)
{
    e.printFormattedMessage();
}
JAVA

If you would like to create your own Audio Module, inherit from ProducerModule, ModifierModule or ConsumerModule.