initial commit

On-device voice cloning CLI using VoxCPM2 via MLX on macOS.
Swift 6, macOS 15+, depends on speech-swift (local path dep).
This commit is contained in:
marauder-actual
2026-05-31 14:34:59 +02:00
commit 67be877f7f
5 changed files with 497 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# madcat-say — VoxCPM2 voice-cloning CLI (on-device, MLX/Metal)
#
# MLX needs a compiled Metal shader library (mlx.metallib) sitting next to the
# binary, or inference crashes with "Failed to load the default metallib".
# We reuse the one speech-swift already builds.
SPEECH_SWIFT ?= ../speech-swift
CONFIG ?= release
METALLIB = $(SPEECH_SWIFT)/.build/$(CONFIG)/mlx.metallib
.PHONY: build run clean metallib install
build:
swift build -c $(CONFIG)
@$(MAKE) --no-print-directory metallib
# Copy the prebuilt metallib next to our binary. If speech-swift hasn't built
# it yet, fall back to its build script.
metallib:
@if [ ! -f "$(METALLIB)" ]; then \
echo "metallib missing in speech-swift — building it there..."; \
( cd "$(SPEECH_SWIFT)" && swift build -c $(CONFIG) && ./scripts/build_mlx_metallib.sh $(CONFIG) ); \
fi
@cp "$(METALLIB)" ".build/$(CONFIG)/mlx.metallib"
@echo "metallib in place: .build/$(CONFIG)/mlx.metallib"
# Quick smoke test (default voice).
run: build
.build/$(CONFIG)/madcat-say "Hello. This is madcat say, running on device."
# Install to ~/.local/bin (binary + metallib alongside it).
install: build
@mkdir -p $(HOME)/.local/bin
cp ".build/$(CONFIG)/madcat-say" "$(HOME)/.local/bin/madcat-say"
cp ".build/$(CONFIG)/mlx.metallib" "$(HOME)/.local/bin/mlx.metallib"
@echo "installed to ~/.local/bin/madcat-say (with mlx.metallib)"
clean:
swift package clean
rm -rf .build