javaLeopard - Java Quick Start

Platforms

  • Linux (x86_64)
  • macOS (x86_64, arm64)
  • Windows (x86_64)
  • NVIDIA Jetson Nano
  • Raspberry Pi (3, 4)

Requirements

Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start

Setup

  1. Install JDK 11+.

  2. Install the Java binding from the Maven Central Repository at:

ai.picovoice:leopard-java:${version}

Usage

Create an instance of the engine with the Leopard Builder class and transcribe an audio file:

import ai.picovoice.leopard.*;
final String accessKey = "${ACCESS_KEY}";
try {
Leopard leopard = new Leopard.Builder().setAccessKey(accessKey).build();
String transcript = leopard.processFile("${AUDIO_PATH}");
leopard.delete();
} catch (LeopardException ex) { }
System.out.println(transcript);

Replace ${ACCESS_KEY} with yours obtained from Picovoice Console and ${AUDIO_PATH} to the path an audio file. Finally, when done be sure to explicitly release the resources using leopard.delete().

leopard.delete()

Demo

For the Leopard Java SDK, we offer demo applications that demonstrate how to use the Speech-to-Text engine on audio files.

Setup

  1. Clone the Leopard repository from GitHub using HTTPS:
git clone --recurse-submodules https://github.com/Picovoice/leopard.git
  1. Build the Leopard Java demo using Gradle:
cd leopard/demo/java
./gradlew build

Usage

To see the usage options for the demos, use the -h flag:

java -jar build/libs/leopard-file-demo.jar -h

Run the following command to transcribe an audio file:

java -jar build/libs/leopard-file-demo.jar -a ${ACCESS_KEY} -i ${AUDIO_PATH}

For more information on our Leopard demos for Java, head over to our GitHub repository.

Resources

Packages

API

GitHub

Benchmark


Issue with this doc? Please let us know.