Other

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

技术分析:nerdaxic/glados-voice-assistant

项目背景与痛点

在现代家居智能化的大趋势下,智能语音助手成为连接家庭自动化设施数字化中枢的重要一环。nerdaxic/glados-voice-assistant 是一个基于 Valve 公司经典游戏《传送门》中的 GLaDOS(Genetic Lifeform and Disk Operating System)角色打造的 DIY 语音助手项目,适用于兼容 Home Assistant 的家庭自动化环境。这一项目通过整合 GLaDOS 令人难忘的声线和个性对话,解决了常规语音助手在人机交互中可能体验欠佳的问题,使得家庭自动化系统更加具有互动性和趣味性。

核心技术揭秘

glados-voice-assistant 的设计是围绕语音处理和智能家居集成展开的。它巧妙地利用了 GLaDOS 的语音样本,通过对 Home Assistant 的接口实现智能控制和语音命令处理。值得注意的是,该项目采用了模块化设计,可以轻松定制和集成到各种智能家居系统中,更好地适应不同的家庭自动化场景和技术生态。

该语音助手通过以下关键技术栈实现:

  1. 语音识别与合成(TTS & STT):使用开源STT及TTS引擎,处理和模拟GLaDOS的声音。
  2. API接口集成:无缝对接Home Assistant,从而允许通过语音自动化管理家用设备。
  3. 数据流与交互逻辑:设计了稳健的数据流和交互系统,确保流畅而富有个性的用户体验。
graph TD A[用户语音命令] --> B[录音捕捉] B --> C{"语音识别"} C -->|"识别完成"| D[意图解析] C -->|"识别失败"| E[再次尝试] D --> F{"智能家居指令"} F -->|"指令匹配"| G[执行动作] F -->|"指令不匹配"| H[返回错误]

该架构设计显示了系统如何处理用户语音命令,并通过解析生成相应的智能家居操作指令。整个流程中,每一环节都设计有备份和错误处理机制,确保高效可靠地执行动作。

功能亮点与差异

项目的一大亮点在于它对 GLaDOS 角色独特声音和对话风格的忠实再现,这与市面上许多主流语音助手有明显的个性差异,并能为用户提供更加丰富和多样化的用户体验。此外,提供可灵活定制的模块化架构,使得用户能够根据自己的需求选择集成的设备和功能。

在可扩展性和安全性方面,该项目同样提供了坚实的保障。用户可以很容易地在不违反前提设计的条件下,将新的功能或设备添加到系统中,且强大的社区支持和活跃的开发周期意味着持续的技术迭代和支持。

应用场景与落地建议

在实际部署中,需要特别注意到用户隐私保护和数据安全的问题,确保系统中任何语音输入都遵守严格的隐私规定和数据脱敏机制。此外,为获得最佳效果,应结合家庭的现有智能家居设备和网络环境进行优化配置。

该项目特别适用于那些寻求提高家庭自动化体验的智能家居爱好者,尤其是对游戏文化有深度共鸣的用户。此外,亦适用于各类感兴趣的开源社区成员,他们可以利用此框架进行二次开发,实现定制化的交互功能。

综合评价

nerdaxic/glados-voice-assistant 项目无疑展示了一个现代智能语音助手该如何巧妙融合技术与艺术,同时也体现出开源社区的力量。它优点众多,不仅能很好提升家庭自动化的趣味性,还具备强大的可定制性和灵活性。当然,需要注意的是,在定制化的过程中,开发者需具备一定的技术背景以确保项目的稳健运行。

关于

GitHub 原始描述(英文)

DIY Voice Assistant based on the GLaDOS character from Portal video game series. Works with home assistant!

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
407
价值分
215
活跃状态
活跃

语言占比

C
C++
Python
Shell

README

GLaDOS Voice Assistant

DIY Voice Assistant based on the GLaDOS character from Portal video game series.

🛠 Hackday - Tech blog

🛠 Tom’s Hardware - Technology news

🎮 PCGamer - Online magazine

🇫🇮 Ilta-Sanomat - The second largest newspaper in Finland

🇫🇮 Muropaketti - Finnish computing website

📺 YouTube - GLaDOS Voice Assistant playlist

Read project article first!

📄 GLaDOS Voice Assistant - henrirantanen.fi

Description

  • Written mostly in Python
  • Work in progress

❗ New versions of the voice assistant will not work on Raspberry Pi due to missing CPU instruction sets needed by some AI scripts. If you are looking to play along with the old version on your Raspberry Pi, check the raspberry branch.

Main features

  1. Local Trigger word detection using PocketSphinx
  2. Local GLaDOS Text-to-Speech engine using glados-tts model by R2D2FISH
  3. Speech-to-text processing using Google’s API (for now)
  4. Local TTS cache of generated common audio samples locally for instant answers in the future
  5. Animatronic eye control using servos
  6. Round LCD for an eye to display display textures

Tight integration with Home Assistant’s local API:

  • Send commands to Home Assistant
  • Read and speak sensor data
  • Notification API, so Home Assistant can speak out notifications through GLaDOS

What it can do:

  • Clock
  • Control lights and devices
  • Weather and forecast
  • Add things to shopping list
  • Read sensor information
  • Random magic 8-ball answers
  • Tell jokes
  • Judge you and be mean
  • Advanced fat-shaming
  • Log stuff and gather training data locally

Note: The code is provided as reference only.

Voice Assistant pipeline overview

General AI Voice Assistant Pipeline

Requirements for Ubuntu

Install tools

sudo apt-get update
sudo apt-get upgrade
sudo apt install python3-pip

Install PyAudio

PyAudio is needed to play audio files.

sudo apt-get install portaudio19-dev 

Install PocketSphinx

Used for trigger word detection for now.

sudo apt-get install -y build-essential swig libpulse-dev libasound2-dev

Install SpeechRecognition

Used to turn audio into text for now.

sudo apt-get install flac

Install other libraries

Install python modules from requirements.txt file

cd ~/glados-voice-assistant
sudo pip3 install -r requirements.txt

Install pytorch

See here: https://pytorch.org/get-started/locally/#start-locally

Install GLaDOS Voice Assistant

1. Go to home folder
cd ~
2. Download the source from GitHub

This will download GLaDOS Voice Assistant and the TTS submodule.

git clone --recurse-submodules https://github.com/nerdaxic/glados-voice-assistant/

After this you can play around with the TTS, this works as stand-alone.

cd ~/glados-voice-assistant/glados_tts/
python3 glados.py
3. Edit the settings file

Find the sound card ID:

python3 -m sounddevice

Generate and edit the settings.env file:

cp ~/glados-voice-assistant/settings.env.sample ~/glados-voice-assistant/settings.env && nano ~/glados-voice-assistant/settings.env
4. To run:

Launch the voice assistant:

python3 ~/glados-voice-assistant/glados.py

You can add glados.py to your crontab file or run it manually.

crontab -e
@reboot python3 /home/username/glados-voice-assistant/glados.py

Integrate to Home Assistant

To make Home Assistant integration work, you need to enable the API in the home assistant configuration file and generate a long-lived access token. Add access token and IP-address of the home assistant server into the settings.env file.

configuration.yaml

# This will enable rest api
api:

# This will add GLaDOS as a notification provider. Replace with correct IP of GLaDOS.
notify:
  - name: glados
    platform: rest
    resource: http://192.168.1.XXX:5000/notify

Hardware

List of reference hardware what nerdaxic is developing on, models might not need to be exact. Not a full bill of materials.

Item Description
Main board Basic i7 laptop with 16 gigs of RAM
Operating system ubuntu-20.04.3-desktop-amd64
Microcontroller Teensy 4, to control the eye LCD and NeoPixels
Eye lights Adafruit NeoPixel Diffused 5mm Through-Hole for the “REC” light
Eye lights Adafruit 16 x 5050 NeoPixel Ring
Eye LCD 1.28 Inch TFT LCD Display Module Round, GC9A01 Driver SPI Interface 240 x 240

Audio

Audio amp is powered from Raspberry GPIO 5V line and ReSpeaker board from USB to avoid ground loops and noise issues.

Item Description
Audio amplifier Adafruit Stereo 3.7W Class D Audio Amplifier
Speakers Visaton FRS 7
Microphone & Audio interface ReSpeaker Mic Array V2.0

Mechanics

Mechanics are powered from their own power supply to allow more power for the servos and prevent brown-outs.

Item Description
Power supply MeanWell LRS-50-5 5V
Servo controller Pololu Micro Maestro
Servo: Eye movement 35 kg DS3235 (Control Angle 180)
Servo: Eyelids 25 kg DS3225 (Control Angle 180)
Screws Various M3 and M4 screws
Jumper wires 0.32 mm²/22 AWG assortment

评论

暂无评论