flite
| Kind | ffi-c |
|---|---|
| Categories | audio ffi |
| Keywords | flite tts text-to-speech speech synthesis audio ffi |
Flite text-to-speech synthesis bindings for Kit
Files
| File | Description |
|---|---|
kit.toml | Package manifest with metadata and dependencies |
src/flite.kit | Voice selection, synthesis, wave saving, and pitch control |
tests/flite.test.kit | Tests for error types and API function existence |
examples/hello.kit | Synthesize text to WAV and play with afplay |
LICENSE | MIT license file |
Dependencies
No Kit package dependencies.
Installation
kit add gitlab.com/kit-lang/packages/kit-flite.gitUsage
import Kit.FliteLicense
MIT License - see LICENSE for details.
Exported Functions & Types
FliteError
Errors that can occur during Flite operations.
Variants
FliteInitError {message}FliteVoiceError {message}FliteSynthesisError {message}FliteWaveError {message}init
Initialize Flite (idempotent, automatically called by other functions)
Result () FliteError
select-voice
Select a voice by name Common voices: "kal", "kal16", "awb", "rms", "slt"
String -> Result Ptr FliteError
load-voice
Load a voice from a .flitevox file
String -> Result Ptr FliteError
voice-name
Get the name of a voice
Ptr -> String
synthesize
Synthesize text to a wave
String -> Ptr -> Result Ptr FliteError
synthesize-to-file
Synthesize text directly to a file Returns duration in seconds
String -> Ptr -> String -> Result Float FliteError
sample-rate
Get wave sample rate in Hz
Ptr -> Int
num-samples
Get number of samples in wave
Ptr -> Int
num-channels
Get number of channels in wave
Ptr -> Int
wave-duration
Get wave duration in seconds
Ptr -> Float
save-wave
Save wave to a WAV file
Ptr -> String -> Result () FliteError
save-wave-as
Save wave to file with specified type ("riff", "raw", "snd")
Ptr -> String -> String -> Result () FliteError
resample
Resample wave to a new sample rate
Ptr -> Int -> Unit
rescale
Rescale wave amplitude (factor is percentage, e.g., 50 for half volume)
Ptr -> Int -> Unit
free-wave
Free wave memory (must be called when done with wave)
Ptr -> Unit
set-pitch
Set voice pitch (F0 target mean, default around 110-180 Hz depending on voice)
Ptr -> Float -> Unit
set-speed
Set voice speed (duration stretch, 1.0 is normal, higher is slower)
Ptr -> Float -> Unit
set-feature-float
Set a float feature on a voice
Ptr -> String -> Float -> Unit
set-feature-int
Set an int feature on a voice
Ptr -> String -> Int -> Unit
set-feature-string
Set a string feature on a voice
Ptr -> String -> String -> Unit
get-feature-float
Get a float feature from a voice
Ptr -> String -> Float -> Float
get-feature-int
Get an int feature from a voice
Ptr -> String -> Int -> Int
get-feature-string
Get a string feature from a voice
Ptr -> String -> String -> String
speak-to-file
Synthesize text and save directly to a WAV file Combines select-voice, synthesize, save-wave, and free-wave
String -> String -> String -> Result () FliteError
quick-speak
Quick synthesis using default voice (kal)
String -> String -> Result () FliteError