This documentation was last modified: Friday, January 4th, 2019 at 12:45 am
- Troubleshooting Audio
- Pulseaudio settings
- Other useful commands
- Will my device work
Mycroft utilizes pulseaudio for sound input and output. Mark 1 and Picroft devices have pulseaudio set up correctly for the mycroft user. On picroft, any mic or speakers you add to it may need to be configured as Mycroft uses the default input and output from pulse. Systems without pulseaudio installed will likely also not function as expected. Systems with both jack and pulseaudio may need additional configuration to work correctly.
If you see an issue in the logs with
OSError: [Errno 2] No such file or directory this usually indicates that mycroft can’t find pulseaudio. Make sure it’s installed and mycroft is able to access it.
If no audio is picked up by mycroft, check the mic to verify it’s working. If the mictest is successful, verify that pulse has your device as the default source.
start-mycroft.sh audiotest will attempt to record, then play back a short audio clip using the default source and sink.
To test a WAV file, you can use:
For an MP3/OGG format:
The following command will start recording for ten seconds on the default input device when run:
arecord -d 10 -o test.wav
You can play it back to hear what is recorded with
For mycroft, the lines most relevant are the Default Source: and Default Sink:.
picroft:~$ pactl info Server String: unix:/run/user/1000/pulse/native Library Protocol Version: 30 Server Protocol Version: 30 Is Local: yes Client Index: 813 Tile Size: 65472 User Name: pi Host Name: picroft Server Name: pulseaudio Server Version: 8.0 Default Sample Specification: s16le 2ch 44100Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo Cookie: ab8a:0b4d
pactl list sinks short to list devices available to the current user:
picroft:~$ pactl list sinks short 1 alsa_output.pci-0000_00_1b.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
pactl list sources short will list outputs, or sinks, available to the current user:
picroft:~$ pactl list sources short 1 alsa_output.pci-0000_00_1b.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED 2 alsa_input.pci-0000_00_1b.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
If you need to adjust the device you’re using for input or output, first determine the number of the source or sink you wish to set it to. Then use
pactl set-default-source (for input) or
pactl set-default-sink (for output) to update:
$ pactl set-default-source 3 $ pactl set-default-sink 1
This would set the default input to be device 3 and the default output device to be 1. Your numbers will vary. A succsessful change will not have any additional output listed. Verify with
Pulseaudio has an echo cancellation module that can be loaded.
$ pactl load-module echo-cancellation
This is system wide. If not previously enabled, you will need to restart any applications using pulse.
For documentation, see https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index45h3
Additional usage and tips can be found https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting
Find out what modules are installed:
$ pactl list modules short
For more information like usage counts and properties, remove the
lsusb can be used to see what USB devices are connected to the system.
lsusb -v can be also used, but produces significantly more output.
groups will list all the system groups the current user is a part of. In dev instances of mycroft, can be used to see if the mycroft user is part of the audio group. If running list sinks or list sources you see null or no devices for the user, use this command to verify if you’re part of the
alsamixer is a command-line utility to adjust volume and muting of both inputs and outputs.
pulseaudio -k kills the current instance of pulseaudio.
pulseaudio --start will start pulseaudio.
pavucontrol is a GUI mixer client for X.
pacmd is an interactive shell version of
help to see more once in the shell.
Most USB mics and speakers are usable with pulseaudio. In general, if your OS can recognize the device as an audio endpoint pulse will be able to connect it. A variety of mics including the PS3 Eye, Blue snowballs, Jabra 410, various web cams, the movo mc1000, gaming headsets, and even the AIY hat have been used successfully. If you have the device on hand, try it out and see. If the information above isn’t able to get it going, try asking on the chat server or the forum. Always check the volume levels if everything else seems to be set correctly.