Add native libs (Edge TPU, flatbuffers) and install script
lib/aarch64/: - libedgetpu.so.1.0 — custom build for Debian Trixie/Python 3.13 (built from source with flatbuffers v23 headers, gold linker) - libflatbuffers.so.24.3.25 — required by libedgetpu install.sh: one-command setup on fresh Pi - System packages, native libs, udev rules, venv, systemd service - Installs setuptools<70 for webrtcvad pkg_resources compat - Installs ai-edge-litert + resemblyzer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
75
install.sh
Executable file
75
install.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "[install] HeadMic — Vixy's Ears"
|
||||
echo "[install] Setting up on $(hostname)"
|
||||
|
||||
# System packages
|
||||
echo "[install] Installing system packages..."
|
||||
sudo apt install -y -qq python3-pip python3-venv python3-dev sox alsa-utils \
|
||||
libportaudio2 portaudio19-dev libgl1 2>/dev/null
|
||||
|
||||
# Native libs (Edge TPU + flatbuffers)
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
LIB_DIR="$(dirname "$0")/lib/$ARCH"
|
||||
if [ -d "$LIB_DIR" ]; then
|
||||
echo "[install] Installing native libs from $LIB_DIR"
|
||||
sudo cp "$LIB_DIR"/libedgetpu.so.* /usr/lib/aarch64-linux-gnu/ 2>/dev/null || true
|
||||
sudo cp "$LIB_DIR"/libflatbuffers.so.* /usr/lib/aarch64-linux-gnu/ 2>/dev/null || true
|
||||
sudo ln -sf libedgetpu.so.1.0 /usr/lib/aarch64-linux-gnu/libedgetpu.so.1 2>/dev/null || true
|
||||
sudo ln -sf libflatbuffers.so.24.3.25 /usr/lib/aarch64-linux-gnu/libflatbuffers.so 2>/dev/null || true
|
||||
sudo ldconfig
|
||||
fi
|
||||
|
||||
# udev rules
|
||||
echo "[install] Setting up udev rules..."
|
||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2886", ATTR{idProduct}=="001a", MODE="0666"' | sudo tee /etc/udev/rules.d/99-xvf3800.rules > /dev/null
|
||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1a6e", MODE="0666"' | sudo tee /etc/udev/rules.d/99-coral.rules > /dev/null
|
||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"' | sudo tee -a /etc/udev/rules.d/99-coral.rules > /dev/null
|
||||
sudo udevadm control --reload-rules && sudo udevadm trigger
|
||||
|
||||
# User groups
|
||||
sudo usermod -a -G dialout,audio "$(whoami)" 2>/dev/null || true
|
||||
|
||||
# Python venv
|
||||
echo "[install] Creating venv and installing dependencies..."
|
||||
cd "$(dirname "$0")"
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -q 'setuptools<70'
|
||||
.venv/bin/pip install -q -r requirements.txt
|
||||
.venv/bin/pip install -q ai-edge-litert resemblyzer
|
||||
|
||||
# Systemd service
|
||||
echo "[install] Installing systemd service..."
|
||||
cat > /tmp/headmic.service << 'EOF'
|
||||
[Unit]
|
||||
Description=HeadMic - Vixy's Ears
|
||||
After=network.target sound.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=alex
|
||||
WorkingDirectory=/home/alex/Projects/headmic
|
||||
ExecStart=/home/alex/Projects/headmic/.venv/bin/python -m uvicorn headmic:app --host 0.0.0.0 --port 8446
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment=ALSA_SPEAKER=plughw:Array,0
|
||||
Environment=ALSA_SPEAKER_AEC=plughw:Array_1,0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
sudo mv /tmp/headmic.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable headmic
|
||||
|
||||
# Config directory
|
||||
mkdir -p ~/.vixy
|
||||
|
||||
echo "[install] Done!"
|
||||
echo ""
|
||||
echo " Learn ears: .venv/bin/python xvf3800.py --learn"
|
||||
echo " Test LEDs: .venv/bin/python xvf3800.py --test-leds"
|
||||
echo " Start: sudo systemctl start headmic"
|
||||
echo " Logs: journalctl -u headmic -f"
|
||||
BIN
lib/aarch64/libedgetpu.so.1.0
Executable file
BIN
lib/aarch64/libedgetpu.so.1.0
Executable file
Binary file not shown.
BIN
lib/aarch64/libflatbuffers.so.24.3.25
Normal file
BIN
lib/aarch64/libflatbuffers.so.24.3.25
Normal file
Binary file not shown.
Reference in New Issue
Block a user