mlx_audio
On-device speech models for Apple Silicon, built on the
mlx package: Parakeet-TDT and Whisper
speech-to-text (STT) and PocketTTS text-to-speech (TTS). A pure-Dart port of
mlx-audio-swift.
Platform: macOS on Apple Silicon only. See the monorepo README for the full model support matrix.
Install
dart pub add mlx_audio
dart run mlx:setup
dart run mlx:setup (provided by the mlx dependency) builds the native
mlx-c libraries once into a user-level cache; the loader finds them
automatically, with no environment variables. It needs git, cmake, and the
Xcode command line tools and takes a couple of minutes the first time. See the
mlx package README for details.
Speech-to-text
import 'package:mlx_audio/mlx_audio.dart';
final model = await STT.loadModel('mlx-community/parakeet-tdt-0.6b-v2');
final audio = await loadAudioMono16k('audio.wav');
print(model.generate(audio).text);
Or from the CLI:
dart run mlx_audio:transcribe --audio audio.wav
Text-to-speech
final tts = await TTS.loadModel('mlx-community/pocket-tts');
final out = tts.generate('Hello world.', voice: 'alba');
writeWavFloat32('hello.wav', out.samples, out.sampleRate);
dart run mlx_audio:say --text "Hello world." --voice alba --output hello.wav
See the monorepo README for CLI options, supported checkpoints, and the quantized-model support matrix.
Libraries
- mlx_audio
- On-device speech models for MLX on Apple Silicon: Parakeet-TDT and Whisper speech-to-text and PocketTTS text-to-speech.