Project Environments

Once you have a CUE Audio API key, you can integrate the libraries into your own project.

NOTE: This is not necessary to use the demo application. The demo application already includes the CUE libraries. This guide is to show how to integrate the CUE libraries into your own project.

With your credentials in hand, this guide will show you how to set up your new project utilizing CUE's engine on Android and iOS using Android Studio and XCode respectively. If you haven't already, check out the Prerequisites page to make sure you have everything you need to procced with this guide.

Android

Maven Setup

First, start by adding your credentials and ULR to Maven bucket to local.properties at root of project:

com.cueaudio.maven.bucket=https://cueaudio.jfrog.io/cueaudio/libs-release-local
com.cueaudio.maven.username=<myusername>
com.cueaudio.maven.password=<mypassword>

Secondly, add CUE Audio Maven repository to build.gradle at root of project:

// Reading Maven credentials
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

allprojects {
    repositories {
        ...
        google()
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {
            url = properties.getProperty("com.cueaudio.maven.bucket")
            credentials {
                username = properties.getProperty("com.cueaudio.maven.username")
                password = properties.getProperty("com.cueaudio.maven.password")
            }
        }
    }
}

Finally, import the CUE Engine into your project by adding the following to your app's build.gradle file:

implementation "com.cueaudio:engine:1.+"

Authentication

Before any CUE Engine features can be used, you will need to ensure that the microphone permission has been granted to your app, and that your API key has been authenticated.

It's recommended that you setup the CUE Engine within the onRequestPermissionsResult callback to make sure that the correct permissions are set before proceeding, and that the engine is instantiated only after the user confirms the microphone permission.

@Override
    public void onRequestPermissionsResult(
   		int requestCode, 
   		@NonNull String[] permissions, 
   		@NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   
   		...
        
        // Check for microphone permissions here
        
		...

        CUEEngine.getInstance().setupWithAPIKey(this, <your_API_key>);
        CUEEngine.getInstance().setDefaultGeneration(2);
   
   		...
          
    }
override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<String?>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)

        ...
          
        // Check for microphone permissions here
          
        ...

        CUEEngine.getInstance().setupWithAPIKey(this, <your_API_key>);
        CUEEngine.getInstance().setDefaultGeneration(2);

        
		...
    }

iOS

The following steps will show you how to set up CocoaPod, and get the engine dependency connected to your XCode project.

  1. Make sure you have CocoaPods and the CocoaPods Artifactory plugin installed. You can do so with the following commands using Homebrew:
brew install cocoapods
gem install cocoapods-art
  1. Add credentials to allow you to use the CUEEngine CocoaPod. In ~/.netrc (create this file if necessary) insert your credentials:
machine cueaudio.jfrog.io
login <username>
password <pass>
  1. To use this CocoaPod, execute the command pod repo-art add cocoapods-local "https://cueaudio.jfrog.io/cueaudio/api/pods/cocoapods-local" in your project's root directory via the command line.

  2. Finally, run pod install

  3. To update the engine version in the future, run:

pod repo-art update cocoapods-local 
pod install

The engine version can then be updated in your Podfile. An example of such a podfile is:

-- Uncomment the next line to define a global platform for your project
platform :ios, '10.3'

plugin 'cocoapods-art', :sources => [
  'cocoapods-local'
]

source 'https://github.com/CocoaPods/Specs.git'

target 'MyProj' do
  -- Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  use_frameworks!

  project 'MyProj.xcodeproj'
  pod "engine"

end

Authentication

  1. In your Info.plist file, make sure you set Privacy - Microphone Usage Description.

  2. Make sure to enable microphone access in your app.

  3. Setup the engine using your API key:

[CUEEngine.sharedInstance setupWithAPIKey:<your_API_key>];
[CUEEngine.sharedInstance setDefaultGeneration:2];

Debian

engine GitHub repository now contains publish_debs.sh script which builds Debian packages (which can be used by Raspbian OS), optionally publishing them to CUEAudio's Artifactory.

It uses Docker to create a Debian VM from which builds the Debian packages. This cross-compiling means that building and publishing can be done from (e.g.) macOS host.

How to generate (and publish) CUEEngine Debian packages (from macOS or Linux)

  • Install Docker:
  • ./publish_debs.sh -d buster -p
    NOTE: If you omit -p it will ONLY generate (i.e. not publish).

How to use CUEEngine Package on RaspberryPi host

To install Debian packages inside Raspbian (we consider buster) do the following:

  • Add this string to your /etc/apt/sources.list using you Artifactory credentials:
deb [trusted=yes] https://<USERNAME>:<PASSWORD>@cueaudio.jfrog.io/cueaudio/engine-debian-local buster main 
  • Then run:
apt-get update
apt-get upgrade
  • Now you can install Debian packages of CUEEngine: libcueengine1, libcueengine1-dev or python3-libcueengine1. For example, to use CUEEngine python3 bindings you can run:
apt-get install python3-libcueengine1

What’s Next