*Experimental* Mycroft on WSL with Pulseaudio

Experimental Mycroft on WSL (Windows) with Pulseaudio

Please Note:

  • This is really experimental stuff and don’t plan to provide any support for this. Use at your own risk
  • All the skills that require some OS level dependencies will/might not work “Audio-control… desktop-control” etc
  • Audio delay should be expected as WSL doesn’t officially support audio and audio is routed through a pulseaudio server running on Windows

Demo:

Installation:

  • Enable WSL feature on Windows

  • Install “Ubuntu 18.04” from Windows Store

  • Download and Install Mycroft-Core
    sudo apt install git
    git clone https://github.com/MycroftAI/mycroft-core
    cd mycroft-core
    ./dev_setup.sh

  • Installing and enabling audio pass through with pulseaudio on WSL
    In ubuntu terminal: sudo apt-get install pulseaudio
    In ubuntu terminal: export PULSE_SERVER=tcp:127.0.0.1

  • Installing and configuring pulseaudio server on Windows
    – Download Pulseaudio 1.1 windows binary from http://bosmans.ch/pulseaudio/pulseaudio-1.1.zip
    – Unzip pulseaudio to any location
    – Locate pulseaudio \etc\pulse\ folder in your extracted files
    – Open default.pa in \etc\pulse\ with wordpad and locate line
    #load-module module-native-protocol-tcp
    replace the above line with:
    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
    – Open daemon.conf in \etc\pulse\ with wordpad and locate line
    ; exit-idle-time = 20
    replace the above line with:
    exit-idle-time = -1

  • Starting Pulseaudio Server on Windows
    – Open Windows Powershell
    – cd into your pulseaudio/bin extracted folder
    – run command .\pulseaudio.exe
    Windows should now ask you for firewall permissions for pulseaudio, make sure to grant "public" and "private" both network perms
    – Running:

  • Start mycroft:
    – In ubuntu terminal ./start-mycroft.sh debug

7 Likes

what do I do

If you have followed the steps above, you can try starting mycroft-core from WSL and should have working audio

hej, thanks for the nice instructions.
I followed it up until one detail, since I was also having the instructions of the normal ubuntu opened on another tab, I send " bash dev_setup.sh " instead of ./dev_setup.sh. it executed anyway, and I realized too late. so I continued. but when I want to start mycroft for the first time with the debug included, it enter a loop:
“please update depndencies by running ./dev_setup_sh again”
if i do that it wants to install some packages, i press yes. then it doenst find them:
Unable to locate package: swig/portaudio19-dev/mpg123/flac/lifdann-dev/jq.
If I try the debug command it starts again, obviously.
sorry that I cannot post screenshots, I have some trouble with that at the moment.
How do I uninstall it best du remove everything and redo it? Or is another problem the reason?
thanks in advance
/R

@edit: removed the folder and did it again, now while running the "./dev_setup.sh. "the error already occured. The message befor read: "We detected that your computer has the libjack-jack2-0 package installed. "

It could be the ./dev_setup.sh script couldn’t figure out the distribution correctly, you can try the following:

sudo apt install git python3 python3-dev python3-setuptools libtool libffi-dev libssl-dev autoconf automake bison swig libglib2.0-dev portaudio19-dev mpg123 screen flac curl libicu-dev pkg-config libjpeg-dev libfann-dev build-essential jq
`

Followed up by running ./dev_setup.sh after the above and then try running mycroft.

Thanks for the fast respond, would you recommend to delete the mycroft-core before that?
and is it possible to paste in the “windows ubuntu”? :smiley: that is a long line

You don’t need to delete mycroft-core just “cd mycroft-core” then paste the above line in the Ubuntu terminal shown in Ubuntu on windows.

1 Like

just tried, sadly same erroer happend:

Building dependency tree Reading state information… Done
E: Unable to locate package swig
E: Unable to locate package portaudio19-dev
E: Unable to locate package mpg123
E: Unable to locate package flac
E: Unable to locate package libfann-dev E: Unable to locate package jq

found out how to enable the copy/paste commands, so now here also with some propper output.
guess I will try the virtual machine option next week, unless someone has an idea what it might mean. I found an old version of python installed on my windows os. might that be in the way?

Does your ubuntu install have apt sources enabled ? can you try “sudo apt update” followed by “sudo apt dist-upgrade” to just make sure you have everything updated, before running the above “sudo apt install command”

Also windows version of python doesn’t have anything to do with the version running inside the Ubuntu terminal as that’s a separate base os install.

thanks for this input, I am currentyl not at my home desktop, but I tried it at my wifes PC and I ran the apt update (which was a lot) before and I am running mycroft now sucessfully. however without sound or mic support. I followed the instructions regarding pulseaudio. is it important that the powershell is running? I also got the error message, I think this is normal?
"PS C:\Program Files\pulseaudio\bin> .\pulseaudio.exe W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32. "
what i did not get is the request of the firewall. maybe thats the problem. i whitelisted it and got these errors:

PS C:\Program Files\pulseaudio\bin> .\pulseaudio.exe W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core.c: failed to allocate shared memory pool. Falling back to a normal memory pool.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32. W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
W: [(null)] pulsecore/core-util.c: Secure directory creation not supported on Win32.
E: [(null)] daemon/main.c: Failed to load directory.
<

which is better I assume, but still neither sound output nor mic reaction, direct input via keyboard works fine though

hey mycroft whats the time

Currently thirteen zero eight<

any suggestion?
@edit:while booting the secont time (this time I connected a USB headset to check if it is a hardware prob) I saw an error message:
| ERROR | 935 | VolumeSkill | Couldn’t allocate mixer, ALSAAudioError(‘No such file or directory [default]’,)
maybe that hels as well…
@edit:
I tried some things from this document: audi-troubleshooting but the commands have no effect. Iswicht to command ( : ) enter the command, hit enter, and nothing happends at all.

I’m back home, and tried all the above on my desktop. The exact same problems appeared. So mycroft is paired and running, but neither voice nor sound, and the commands from the audio troublshoot are not having any effect. Other commands do, though. So I can see the installed skills for examples with : skills or simply see the help page.
any input is much appretiated! :slight_smile: