Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Orbita Voice Android SDK will enable the integration of Orbita Voice services across Android apps. Development of services such as audio processing, speech to text conversion from scratch can be time-consuming. For this reason, Orbita has developed the SDK that can integrate all the voice-related services that a business requires, for easy and quick implementation.

Table of Contents

Prerequisites

Get started with Orbita Voice SDK Installation

Unzip the two SDK files named:

...

Contact Orbita Support to access the above-mentioned files.

SDK installation in Android Studio

  1. Open Android Studio.

  2. Create or open a project in which the SDK has to be installed.

  3. To import the unzipped files, select “Import Module” from the Main menu – File – New.

    Image RemovedImage Added

  4. Browse the address where you unzipped the file orbitaspeech.

    Image RemovedImage Added

  5. After selecting the directory, please make sure the module name is “:orbitaspeech”.

    Image RemovedImage Added

  6. Click Finish.

  7. Repeat Step 2 to import the next module.

    Image RemovedImage Added

  8. Browse the address where you unzipped the file sdk.

    Image RemovedImage Added

  9. After selecting the directory, please make sure the module name is “:sdk”.

    Image RemovedImage Added

  10. Click Finish.

  11. You should now see both orbitaspeech and sdk modules in the current project directory.

    Image RemovedImage Added

Error Handling

  1. The Gradle plugin version that is used for Orbita SDK is 0.8.2

  2. If the Gradle version in Android studio is 8.3 or newer, Gradle sync will fail.

    Image RemovedImage Added

  3. We will have to change the latest version of the le plugin. For that, select “build.gradle” from <Project name> directory – orbitaspeech – src.

  4. Select the code ‘google.protobuf:protobuf-gradle-plugin:0.8.2’ (shown in the screenshot below).

  5. Press alt+enter to get a dropdown menu.

  6. Select “Change to <new version number>”.

  7. Click on the “Try Again” link at the top of the tab to run Gradle sync.

    Image RemovedImage Added

Using the SDK

Login to Orbita services

Req payload: {"password": " ","username": ""}

...

Code Block
{
  "_id": "58v72a68434f94a80803f3bc",
  "roles": [
    "admin"
  ],
  "firstName": "John",
  "lastName": "Smith",
  "avatarSrc": "img/avatar0.jpg",
  "attributes": {
    "oauthSettings": {
      "alexa": {
        "userId": "G2M740NPXVIGU5",
        "access": {
          "expiresAt": "2018-05-15T18:36:55+05:30",
          "tokenSecret": "",
          "token": ""
        }
      }
    },
    "email": "johnsmith@example.com",
    "title": "Patient",
    "pinSecurityExpired": "2018-05-03T12:07:46.586Z"
  },
  "token": "",
  "personaType": "655f9e309g0h67381784i15j",
  "personaProfile": {
    "username": "johnsmith@example.com",
    "firstName": "John",
    "lastName": "smith",
    "securityPin": "1234",
    "securityPinInterval": "1",
    "timezone": "America/Chicago"
  },
  "iat": 1526480494,
  "exp": 1526494894
}

Using OrbitaSpeechRecognizer Class for Audio Processing

Post Utterance to Orbita Voice server

  • Instantiate the OrbitaSpeechRecognizer class.

...

Code Block
{
    "orbitaPayload": {
        "payload": {
            "multiagent": {
                "voice": {
                    "sayText": "<p>Hello World! <break strength=\"none\" time=\"5s\"/> How can I help?</p><p> </p> <p>hello how are you</p><p> </p>",
                    "rePrompt": "<p>how can i help?<audio src=\"https://domainname.com/assets/editor/audio/SampleAudio_0.4mbd7504e20-5ec6-11e8-91c4-cf90c900530e.mp3\"/></p>"
                },
                "chat": {
                    "chatText": "<p>Hello World! How can I help?</p>",
                    "rePrompt": "<p>how can I help you?</p>"
                },
                "screen": {
                    "shortTitle": "Hi",
                    "longTitle": "Hi there",
                    "body": "<p>Hello World! How can I help?</p>",
                    "smallImage": "",
                    "largeImage": ""
                },
                "buttons": {
                    "type": "",
                    "name": "buttons",
                    "choices": []
                }
            }
        },
        "type": "4",
        "name": "orbita"
    },
    "text": "Hello World!  How can I help?  hello how are you ",
    "reprompt": "Hello World!  How can I help?  hello how are you ",
    "sessionEnd": false,
    "replaceWord": {
        "two": [
            "to",
            "too"
        ],
        "six": [
            "sex"
        ],
        "ten": [
            "tan",
            "tin"
        ]
    },
“sayTextAudio”:[],
“audioContent”:[],
”repromptAudio”:[]
}

Play Audio Content

To play the audio content from Orbita voice service.

serviceResponse - Response from orbita voice service.

...

Code Block
SpeechAudioProcessor.shared.StopAudio()

To synthesize the text from Orbita voice service to speech (TTS)

Code Block
/**
 * Speaks the given text
 * @param textToSpeak text to speak
 */
 public void startTtsUtterance(String textToSpeak) {
    if (mTts != null) {
        mTts.speak(textToSpeak);
    }
}

...