Skip to content

marswaveai/coli

Repository files navigation

coli

Core library for Cola. Provides essential capabilities commonly used by agents.

CLI Usage

npm install -g @marswave/coli
Usage
  $ coli <command> [options]

Commands
  asr         Transcribe an audio file using speech recognition
  tts         Speak text using native text-to-speech
  cloud-tts   Generate speech using ListenHub OpenAPI

Examples
  $ coli asr recording.m4a
  $ coli asr -j recording.m4a
  $ coli tts "Hello world"
  $ coli tts -v Samantha -r 200 "Hello world"
  $ coli cloud-tts --language en "Hello world"
  $ coli cloud-tts --voice cozy-man-english "Hello world"

API Usage

npm install @marswave/coli
import {ensureModels, runAsr, streamAsr, runTts} from '@marswave/coli';

// ASR
await ensureModels();
await runAsr('recording.m4a', {json: false, model: 'sensevoice'});

// Streaming ASR (see docs/asr.md for details)
await streamAsr(audioSource, {
	onResult(result) {
		console.log(result.text, result.isFinal ? '(final)' : '(partial)');
	},
});

// TTS
await runTts('Hello world', {voice: 'Samantha', rate: 200});

Documentation

License

MIT

About

[WIP] Core library for Cola. Provides essential capabilities commonly used by agents.

Resources

Stars

Watchers

Forks

Packages