Get Started

This short tutorial will teach you the basics of using the Rev AI Java SDK. It demonstrates how to produce a transcript of an audio file submitted by you using the SDK.

Assumptions

This tutorial assumes that:

Step 1: Import the SDK

Begin by importing the SDK into your project using Maven:

Copy
Copied
<dependency>
  <groupId>ai.rev</groupId>
  <artifactId>revai-java-sdk</artifactId>
</dependency>

Step 2: Submit a file for transcription and retrieve the result

The following example demonstrates how to submit a local audio file for transcription.

To use this example, replace the <FILEPATH> placeholder with the path to the file you wish to transcribe and the <REVAI_ACCESS_TOKEN> placeholder with your Rev AI account's access token.

Copy
Copied
String accessToken = "<REVAI_ACCESS_TOKEN>";
String localPathToFile = "<FILEPATH>";

// initialize the client with your access token
ApiClient apiClient = new ApiClient(accessToken);

// submit a local file
RevAiJob revAiJob = apiClient.submitJobLocalFile(localPathToFile);

// check job status
RevAiJob newlyRefreshedRevAiJob = apiClient.getJobDetails(revAiJob.getJobId());

// retrieve transcript
// as plain text
String transcriptText = apiClient.getTranscriptText(revAiJob.getJobId());

// or as an object
RevAiTranscript revAiTranscript = apiClient.getTranscriptObject(revAiJob.getJobId());

You can also submit a remote file or an audio stream.

The text output is a string containing just the text of your transcript. The object form of the transcript contains all the information outlined in the response of the transcript retrieval endpoint of the Asynchronous Speech-to-Text API when using the JSON response schema.

Next steps

You should now have a basic understanding of how to use the Node SDK. To learn more, refer to the SDK documentation and code samples.