Package: hermes-audio-server
Hermes Audio ServerHermes Audio server implements the audio server part of theHermes protocoldefined bySnips.It's meant to be used withRhasspy, an offline, multilingual voice assistant toolkit that works withHome Assistantand is completely open source.With Hermes Audio Server, you can use the microphone and speaker of your computer (such as a Raspberry Pi) as remote audio input and output for a Rhasspy system.System requirementsHermes Audio Server requires Python 3. It has been tested on a Raspberry Pi running Raspbian 9.8 and an x86_64 laptop with Ubuntu 19.04, but in principle it should be cross-platform. Pleaseopen an issueon GitHub when you encounter problems or when the software exits with the message that your platform is not supported.InstallationYou can install Hermes Audio Server and its dependencies like this:sudoaptinstallportaudio19-dev
sudopip3installhermes-audio-serverNote: this installs Hermes Audio Server globally. If you want to install Hermes Audio Server in a Python virtual environment, drop thesudo.Running as a serviceYou can run Hermes Audio Server as a service.It's recommended to run it as a system user. Create this user without a login shell and without creating a home directory for the user:sudouseradd-r-s/bin/falsehermes-audio-serverThis user also needs access to your audio devices:sudousermod-a-Gaudiohermes-audio-serverConfigurationHermes Audio Server is configured in the JSON file/etc/hermes-audio-server.json, which has the following format:{"site":"default","mqtt":{"host":"localhost","port":1883,"authentication":{"username":"foobar","password":"secretpassword"},"tls":{"ca_certificates":"","client_certificate":"","client_key":""}},"vad":{"mode":0,"silence":2,"status_messages":true}}Note that this supposes that you're using authentication and TLS for the connection to your MQTT broker and that this enables the experimental Voice Activity Detection (see below).All keys in the configuration file are optional. The default behaviour is to connect withlocalhost:1883without authentication and TLS and to usedefaultas the site ID and disable Voice Activity Detection. A configuration file for this situation would like like this:{"site":"default","mqtt":{"host":"localhost","port":1883}}Currently Hermes Audio Server uses the system's default microphone and speaker. In a future version this will be configurable.Voice Activity DetectionVoice Activity Detection is an experimental feature in Hermes Audio Server, which is disabled by default. It is based onpy-webrtcvadand tries to suppress sending audio frames when there's no speech. Note that the success of this attempt highly depends on your microphone, your environment and your configuration of the VAD feature. Voice Activity Detection in Hermes Audio Server should not be considered a privacy feature, but a feature to save network bandwidth. If you really don't want to send audio frames on your network except when giving voice commands, you should run a wake word service on your device and only then start streaming audio to your Rhasspy server until the end of the command.If thevadkey is not specified in the configuration file, Voice Activity Detection is not enabled and all recorded audio frames are streamed continuously on the network. If you don't want this, specify thevadkey to only stream audio when voice activity is detected. You can configure the VAD feature with the following subkeys:mode: This should be an integer between 0 and 3. 0 is the least aggressive about filtering out non-speech, 3 is the most aggressive. Defaults to 0.silence: This defines how much silence (no speech detected) in seconds has to go by before Hermes Audio Recorder considers it the end of a voice message. Defaults to 2. Make sure that this value is higher than or equal tomin_secin the configuration of WebRTCVADfor the command listener of Rhasspy, otherwise the audio stream for the command listener could be aborted too soon.status_messages: This is a boolean:trueorfalse. Specifies whether or not Hermes Audio Recorder sends messages on MQTT when it detects the start or end of a voice message. Defaults tofalse. This is useful for debugging, when you want to find the right values formodeandsilence.Running Hermes Audio ServerHermes Audio Server consists of two commands: Hermes Audio Player that receives WAV files on MQTT and plays them on the speaker, and Hermes Audio Recorder that records WAV files from the microphone and sends them as audio frames on MQTT.You can run the Hermes Audio Player like this:hermes-audio-playerYou can run the Hermes Audio Recorder like this:hermes-audio-recorderYou can run both, or only one of them if you only want to use the speaker or microphone.UsageBoth commands know the--helpoption that gives you more information about the recognized options. For instance:usage:hermes-audio-player[-h][-v][-V][-cCONFIG]hermes-audio-playerisanaudioserverimplementingtheplaybackpartoftheHermesprotocol.

optionalarguments:-h,--helpshowthishelpmessageandexit-v,--verboseuseverboseoutput-V,--versionprintversioninformationandexit-cCONFIG,--configCONFIGconfigurationfile[default:/etc/hermes-audio-server.json]-d,--daemonrunasdaemonKnown issues / TODO listYou can't choose the audio devices yet: the commands use the system's default microphone and speaker.This project is really a minimal implementation of the audio server part of the Hermes protocol, meant to be used with Rhasspy. It's not a drop-in replacement for snips-audio-server, as it lacksadditional metadatain the WAV frames.Changelog0.2.0 (2019-06-04): Added logging and a daemon mode.0.1.1 (2019-05-30): Made the audio player more robust when receiving an incorrect WAV file.0.1.0 (2019-05-16): Added Voice Activity Detection option.0.0.2 (2019-05-11): First public version.Other interesting projectsIf you find Hermes Audio Server interesting, have a look at the following projects too:Rhasspy: An offline, multilingual voice assistant toolkit that works withHome Assistantand is completely open source.Snips Led Control: An easy way to control the leds of your Snips-compatible device, with led patterns when the hotword is detected, the device is listening, speaking, idle, ...Matrix-Voice-ESP32-MQTT-Audio-Streamer: The equivalent of Hermes Audio Server for a Matrix Voice ESP32 board, including LED control and OTA updates.OpenSnips: A collection of open source projects related to the Snips voice platform.LicenseThis project is provided byKoen Vervloesemas open source software with the MIT license. See the LICENSE file for more information.