Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assist Microphone does not allow user to check audio quality and samples (gain, microphone multiplier) to get optimal results from Wakeword or Whisper TTS #3830

Open
richardsj opened this issue Nov 19, 2024 · 2 comments
Labels

Comments

@richardsj
Copy link

Describe the issue you are experiencing

Whilst there are clear options for gain and microphone multiplier - there seems to be no easy way to capture some of the audio AFTER these parameters are applied to see how well the microphone is performing and whether it is distorting, too quiet or other problems may be occurring.

So getting good quality seem to be a case of juggling gain and microphone volume multiplier, turning on logging in Whisper to see what transcribed text comes through and guessing whether it's too soft, too muffled, or distorted etc.

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

Whisper

What is the version of the add-on?

1.2.0

Steps to reproduce the issue

  1. Plug a microphone into a desktop device and check its sound volume, mine was quite soft/quiet
  2. Create an Assistant Pipeline with Microphone Assist and nominate the (in my case USB) device for producing and consuming audio
  3. Set Whisper to medium in order to give yourself the best chance to interpret sound quality
  4. Fiddle with gain and microphone volume multiplier for hours
  5. Wonder if there is any way to capture the sound even temporarily to hear what it sounds like after the gain/multipliers have been applied
  6. Experiment for hours with the docker containers, realise they must be using pipes
  7. Wish for someone with magic powers to allow the last X requests or the past Y hours to be stored in a directory that is accessible to check what Wakeword and Whisper are actually hearing
    ...

System Health information

System Information

version core-2024.11.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.54-haos
arch x86_64
timezone Australia/Sydney
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 5000
Installed Version 2.0.1
Stage running
Available Repositories 1462
Downloaded Repositories 53
Home Assistant Cloud
logged_in true
subscription_expiration October 11, 2025 at 11:00 AM
relayer_connected true
relayer_region ap-southeast-1
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled false
cloud_ice_servers_enabled true
remote_server ap-southeast-1-1.ui.nabu.casa
certificate_status ready
instance_id bad363d5e97f4262b5216a3735262390
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 13.2
update_channel stable
supervisor_version supervisor-2024.11.2
agent_version 1.6.0
docker_version 27.2.0
disk_total 62.3 GB
disk_used 27.9 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization kvm
board ova
supervisor_api ok
version_api ok
installed_addons Matter Server (6.6.0), Advanced SSH & Web Terminal (19.0.0), File editor (5.8.0), Studio Code Server (5.17.3), Whisper (2.2.0), Piper (1.5.2), openWakeWord (1.10.0), Get HACS (1.3.1), ZeroTier One (0.18.0), Assist Microphone (1.2.0)
Dashboards
dashboards 6
resources 27
views 8
mode storage
Recorder
oldest_recorder_run November 9, 2024 at 1:06 AM
current_recorder_run November 19, 2024 at 2:09 PM
estimated_db_size 687.42 MiB
database_engine sqlite
database_version 3.45.3

Anything in the Supervisor logs that might be useful for us?

2024-11-19 14:43:58.533 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on homeassistant/amd64-addon-assist_microphone with version 1.2.0
2024-11-19 14:49:09.369 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
2024-11-19 15:11:14.842 INFO (MainThread) [supervisor.api.middleware.security] /addons/core_assist_microphone/stop access from a0d7b954_ssh
2024-11-19 15:11:14.845 INFO (SyncWorker_2) [supervisor.docker.manager] Stopping addon_core_assist_microphone application
2024-11-19 15:11:18.596 INFO (SyncWorker_2) [supervisor.docker.manager] Cleaning addon_core_assist_microphone application
2024-11-19 15:11:18.705 INFO (MainThread) [supervisor.api.middleware.security] /addons/core_assist_microphone/start access from a0d7b954_ssh
2024-11-19 15:11:19.234 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on homeassistant/amd64-addon-assist_microphone with version 1.2.0
2024-11-19 15:11:42.821 INFO (MainThread) [supervisor.api.middleware.security] /addons/core_assist_microphone/stop access from a0d7b954_ssh
2024-11-19 15:11:42.824 INFO (SyncWorker_13) [supervisor.docker.manager] Stopping addon_core_assist_microphone application
2024-11-19 15:11:47.229 INFO (SyncWorker_13) [supervisor.docker.manager] Cleaning addon_core_assist_microphone application
2024-11-19 15:11:47.417 INFO (MainThread) [supervisor.api.middleware.security] /addons/core_assist_microphone/start access from a0d7b954_ssh
2024-11-19 15:11:48.590 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on homeassistant/amd64-addon-assist_microphone with version 1.2.0
2024-11-19 15:18:12.095 INFO (MainThread) [supervisor.resolution.check] Starting system checks with state running
2024-11-19 15:18:12.095 INFO (MainThread) [supervisor.resolution.checks.base] Run check for trust/supervisor
2024-11-19 15:18:12.101 INFO (MainThread) [supervisor.resolution.checks.base] Run check for dns_server_failed/dns_server
2024-11-19 15:18:12.165 INFO (MainThread) [supervisor.resolution.checks.base] Run check for multiple_data_disks/system
2024-11-19 15:18:12.165 INFO (MainThread) [supervisor.resolution.checks.base] Run check for ipv4_connection_problem/system
2024-11-19 15:18:12.165 INFO (MainThread) [supervisor.resolution.checks.base] Run check for no_current_backup/system
2024-11-19 15:18:12.166 INFO (MainThread) [supervisor.resolution.checks.base] Run check for free_space/system
2024-11-19 15:18:12.166 INFO (MainThread) [supervisor.resolution.checks.base] Run check for security/core
2024-11-19 15:18:12.166 INFO (MainThread) [supervisor.resolution.checks.base] Run check for disabled_data_disk/system
2024-11-19 15:18:12.167 INFO (MainThread) [supervisor.resolution.checks.base] Run check for dns_server_ipv6_error/dns_server
2024-11-19 15:18:12.167 INFO (MainThread) [supervisor.resolution.checks.base] Run check for docker_config/system
2024-11-19 15:18:12.167 INFO (MainThread) [supervisor.resolution.checks.base] Run check for pwned/addon
2024-11-19 15:18:12.167 INFO (MainThread) [supervisor.resolution.check] System checks complete
2024-11-19 15:18:12.168 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state running
2024-11-19 15:18:12.222 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
2024-11-19 15:18:12.222 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state running
2024-11-19 15:18:12.222 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
2024-11-19 15:19:13.522 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
2024-11-19 15:19:49.421 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hacs/addons repository
2024-11-19 15:19:49.422 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/pssc/ha-addon-squeezelite/ repository
2024-11-19 15:19:49.426 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/music-assistant/home-assistant-addon repository
2024-11-19 15:19:49.430 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository
2024-11-19 15:19:49.431 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
2024-11-19 15:19:49.437 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository
2024-11-19 15:19:50.443 INFO (MainThread) [supervisor.store] Loading add-ons from store: 85 all - 0 new - 0 remove
2024-11-19 15:19:50.444 INFO (MainThread) [supervisor.store] Loading add-ons from store: 85 all - 0 new - 0 remove
2024-11-19 15:22:56.803 INFO (MainThread) [supervisor.api.middleware.security] /addons/core_assist_microphone/stop access from a0d7b954_ssh
2024-11-19 15:22:56.807 INFO (SyncWorker_5) [supervisor.docker.manager] Stopping addon_core_assist_microphone application
2024-11-19 15:23:00.448 INFO (SyncWorker_5) [supervisor.docker.manager] Cleaning addon_core_assist_microphone application
2024-11-19 15:45:25.902 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on homeassistant/amd64-addon-assist_microphone with version 1.2.0
2024-11-19 15:49:17.591 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token

Anything in the add-on logs that might be useful for us?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service assist_microphone: starting
s6-rc: info: service assist_microphone successfully started
s6-rc: info: service discovery: starting
DEBUG:root:Namespace(mic_uri=None, mic_command='arecord -r 16000 -c 1 -f S16_LE -t raw', mic_command_rate=16000, mic_command_width=2, mic_command_channels=1, mic_command_samples_per_chunk=1024, mic_volume_multiplier=32.0, mic_noise_suppression=0, mic_auto_gain=12, mic_seconds_to_mute_after_awake_wav=0.5, mic_no_mute_during_awake_wav=False, mic_channel_index=None, snd_uri=None, snd_command='aplay -r 16000 -c 1 -f S16_LE -t raw', snd_command_rate=16000, snd_command_width=2, snd_command_channels=1, snd_volume_multiplier=2.0, wake_uri=None, wake_word_name=[], wake_command=None, wake_command_rate=16000, wake_command_width=2, wake_command_channels=1, wake_refractory_seconds=5.0, vad=False, vad_threshold=0.5, vad_trigger_level=1, vad_buffer_seconds=2, vad_wake_word_timeout=5.0, event_uri=None, startup_command=None, detect_command=None, detection_command=None, transcript_command=None, stt_start_command=None, stt_stop_command=None, synthesize_command=None, tts_start_command=None, tts_stop_command=None, tts_played_command=None, streaming_start_command=None, streaming_stop_command=None, error_command=None, connected_command=None, disconnected_command=None, awake_wav='/usr/src/sounds/awake.wav', done_wav='/usr/src/sounds/done.wav', uri='tcp://0.0.0.0:10700', name='assist microphone', area=None, no_zeroconf=True, zeroconf_name=None, zeroconf_host=None, debug_recording_dir=None, debug=True, log_format='%(levelname)s:%(name)s:%(message)s')
INFO:root:Ready
DEBUG:root:Connecting to mic service: ['arecord', '-r', '16000', '-c', '1', '-f', 'S16_LE', '-t', 'raw']
DEBUG:root:Connecting to snd service: ['aplay', '-r', '16000', '-c', '1', '-f', 'S16_LE', '-t', 'raw']
INFO:root:Connected to services
DEBUG:root:Using webrtc audio enhancements
DEBUG:root:Connected to mic service
Recording raw data 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
[15:45:26] INFO: Successfully sent discovery information to Home Assistant.
s6-rc: info: service discovery successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
DEBUG:root:Server set: 12457378106121
INFO:root:Connected to server
INFO:root:Streaming audio
DEBUG:root:Event(type='run-pipeline', data={'start_stage': 'wake', 'end_stage': 'tts', 'restart_on_end': True, 'snd_format': {'rate': 16000, 'width': 2, 'channels': 1}}, payload=None)
DEBUG:root:Ping enabled

Additional information

After many hours, I chose:
Noise suppression: 0
Audio gain: 12
Microphone volume multipler: 32 (yes this high!)

@RoelVideler
Copy link

I second this, even if storing the requests is possible a privacy concern, it should be possible to get some stats like true peak dB, loudness and apparent noise floor. Also, it's tough to determine if the config is being written to or read at all, so knowing if any audio is making it's way through is a requirement to debugging.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants