Fast, accurate, on-device AI library for building interactive voice applications
Project description
Moonshine Voice Python Package
Python bindings for the Moonshine Voice library - a fast, accurate, on-device AI library for building interactive voice applications.
Installation
pip install moonshine-voice
Requirements
- Python 3.8 or higher
- The Moonshine C library (libmoonshine.so on Linux, libmoonshine.dylib on macOS, moonshine.dll on Windows)
Quick Start
from moonshine_voice import Transcriber, ModelArch
# Initialize transcriber with model files
transcriber = Transcriber(
model_path="/path/to/models",
model_arch=ModelArch.BASE
)
# Transcribe audio data
audio_data = [...] # List of float samples (-1.0 to 1.0) at 16kHz
transcript = transcriber.transcribe(audio_data, sample_rate=16000)
# Print results
for line in transcript.lines:
print(f"[{line.start_time:.2f}s] {line.text}")
# Clean up
transcriber.close()
Streaming Transcription
For real-time transcription from a microphone or live audio source:
from moonshine_voice import Transcriber, ModelArch
transcriber = Transcriber(
model_path="/path/to/models",
model_arch=ModelArch.BASE_STREAMING
)
# Create a stream
stream = transcriber.create_stream()
stream.start()
# Add audio chunks as they arrive
while True:
audio_chunk = get_audio_chunk() # Your audio capture function
stream.add_audio(audio_chunk, sample_rate=16000)
# Get updated transcript
transcript = stream.transcribe()
for line in transcript.lines:
if line.is_updated:
print(f"Updated: {line.text}")
stream.stop()
stream.close()
transcriber.close()
Model Architectures
ModelArch.TINY: Smallest model, fastest inferenceModelArch.BASE: Balanced model with better accuracyModelArch.TINY_STREAMING: Tiny model optimized for streamingModelArch.BASE_STREAMING: Base model optimized for streaming
Error Handling
from moonshine_voice import (
Transcriber,
MoonshineError,
MoonshineInvalidHandleError,
)
try:
transcriber = Transcriber("/path/to/models")
except MoonshineError as e:
print(f"Error: {e}")
License
MIT License - see the main project repository for details.
Documentation
For more information, see the main Moonshine Voice documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moonshine_voice-0.0.3-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: moonshine_voice-0.0.3-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 65.9 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a4c5b5a3fac22298def267bb4767b70376a812ab96b7cfa597d347e4c1c05c0
|
|
| MD5 |
05db43e5e4827751aa107dbd5080ccdc
|
|
| BLAKE2b-256 |
91063c8acb790a8a613df8458976e204051ae6b9a2a6384dd8fb9cb0695f0689
|