Skip to main content

Voice CLI Commands

The praisonai-ts CLI provides the voice command for text-to-speech and speech-to-text operations using OpenAI.

Commands Overview

CommandDescription
voice speak <text>Convert text to speech
voice transcribe <file>Transcribe audio file to text
voice voicesList available voices
voice providersList voice providers
voice helpShow help

Text-to-Speech

Convert text to audio:
# Basic speech generation
praisonai-ts voice speak "Hello, how are you today?"

# Specify a voice
praisonai-ts voice speak "Welcome to PraisonAI" --voice nova

# Specify output file
praisonai-ts voice speak "Hello world" --file greeting.mp3

# JSON output
praisonai-ts voice speak "Test message" --json
Example Output:
✓ Speech saved to: speech_1705123456789.mp3
  Size: 45632 bytes
JSON Output:
{
  "success": true,
  "data": {
    "text": "Hello world",
    "voice": "alloy",
    "file": "greeting.mp3",
    "size": 45632
  }
}

Speech-to-Text

Transcribe audio files:
# Transcribe an audio file
praisonai-ts voice transcribe recording.mp3

# JSON output
praisonai-ts voice transcribe meeting.wav --json
Example Output:
Transcription

Hello, this is a test recording for the voice transcription feature.
JSON Output:
{
  "success": true,
  "data": {
    "file": "recording.mp3",
    "text": "Hello, this is a test recording..."
  }
}

List Voices

View available voice options:
praisonai-ts voice voices
praisonai-ts voice voices --json
Available Voices:
VoiceStyleBest For
alloyNeutral, balancedGeneral purpose
echoWarm, engagingConversational
fableExpressive, dynamicStorytelling
onyxDeep, authoritativeProfessional
novaFriendly, brightCustomer service
shimmerClear, optimisticTutorials

Options

OptionDescriptionDefault
--voice <name>Voice to usealloy
--file <path>Output file pathAuto-generated
--jsonJSON outputfalse

Environment Variables

# Required for voice features
export OPENAI_API_KEY=sk-...

SDK Usage

For programmatic voice usage:
import { createOpenAIVoice } from 'praisonai';

const voice = createOpenAIVoice();

// Text to speech
const audio = await voice.speak("Hello world", { voice: 'nova' });

// Speech to text
const text = await voice.listen(audioBuffer);
For more details, see the Voice SDK documentation.