Quickstart
Install the HUMAIN Voice SDK and transcribe your first recording in about five minutes.
You install the SDK, transcribe a WAV recording, and get the transcript plus WebVTT captions.
Before you start
- An API key from the HUMAIN Voice console (Authentication).
- A WAV recording saved as
recording.wav. - Node.js 24 or newer (runs
.tsfiles directly) or Python 3.10 or newer.
1. Install the SDK
npm install @humain-voice/[email protected]2. Set your environment
export API_URL="https://api.voice.humain.com"
export API_KEY="YOUR_API_KEY"Socket.IO examples also read the optional API_PATH
(Connection settings).
3. Run a batch transcription
import { readFile, writeFile } from 'node:fs/promises';
import {
BatchDiarization,
BatchTranscribeClient,
BatchTranscriptionModel,
Language,
Subtitles,
} from '@humain-voice/sdk';
function requiredEnv(name: 'API_KEY' | 'API_URL'): string {
const value = process.env[name];
if (!value) throw new Error(`${name} is required`);
return value;
}
async function main(): Promise<void> {
const inputPath = process.argv[2] ?? 'recording.wav';
const outputPath = process.argv[3] ?? 'recording.vtt';
const client = new BatchTranscribeClient({
api_url: requiredEnv('API_URL'),
api_key: requiredEnv('API_KEY'),
api_version: process.env.API_VERSION ?? 'v1',
});
try {
const result = await client.transcribe(
await readFile(inputPath),
Language.ArEn,
{
asr: BatchTranscriptionModel.BayanArEn,
diarization: BatchDiarization.On,
saveResult: true,
pollInterval: 2,
timeout: 300,
onProgress: ({ status }) => console.info('status:', status),
},
);
console.info(result.results?.transcript ?? '');
await writeFile(outputPath, Subtitles.fromResponse(result).toVtt(), 'utf8');
} finally {
await client.close();
}
}
void main().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});
Save the example under its displayed filename and run it:
- JavaScript / TypeScript:
node batch-transcription.ts recording.wav - Python:
python batch_transcription.py recording.wav
What you get back
Expected output (illustrative):
status: queued
status: processing
status: processing
status: done
Hello and welcome to the meeting.Captions are written to recording.vtt. The upload runs as a job with its own statuses
(Batch is a job).