Picroft experience

Firstly I think this project is great but just a few things from a newbie trying to get picroft working, maybe others will find it useful.

  1. starting up for the first time you get a bunch of errors and missing dependencies. Had to pip install something to get things working
  2. lots of the guides talk about pulseaudio but yet it seems picroft images doesn’t have it.
  3. initially I was trying to get things to work with a Bluetooth speaker following the guide on the site. This kind of worked (not mic) but I feel like my failure to get pulseaudio working properly made it break. Prob need a disclaimer on that guide about it
  4. it’s still not really clear to me when or how to restart the mycroft service. I thought initially the mycroft cli was it but seemingly not and ended up restarting the box quite a lot
  5. am I doing something wrong by using the pi user to login to the box?
  6. as I had no pulseaudio I ended up following a guide to get Google assistant working on raspberry pi which sorted it out (usb soundcard with mic and separate USB dac)
  7. is there any reason not to use pulseaudio echo cancellation? I’m a bit scared about installing it now everything is working without pulse

Overall I now have a mycroft in my ceiling with a 80watt speaker and car mic and it works pretty well. Pretty cool!

1 Like

great to hear you got him up and working.
You are right - it is confusing if pulse is requered or not…but if you got it working without then you dont need it :wink:
the picroft image could defently use a refresh, as it is a bit outdated and it needs updating right after install. but once that is done he should run smoothly. I use it on a few devices daily.

On picroft mycroft is running as user pi, and has sudo rights. ssh to the device as user pi is the way to go.

Restarting mycroft serviceses is done by /home/pi/mycroft-core/start_mycroft.sh (or stop_mycroft)

If servises is running and you start_mycroft.sh they will restart. You can restart only some serviceses by eg. start_mycroft_sh skills to restart skills service.
run start_mycroft.sh --help to se what you can do.

1 Like

Hi there @Nick_Holden, firstly welcome, it’s great to have you here, and thanks for writing up such constructive feedback for us.

errors and missing dependencies

Do you have your bash_history at all so we can take a look and see if we need to include more dependencies in auto_run.sh? That file is supposed to pip install a bunch of deps, so if there are things missing it’s fairly trivial for us to add them in.

If Git’s your thing, you can also raise PRs on the Picroft software at;

pulseaudio

Good pickup. The Picroft documentation at the moment is pretty outdated; it’s next on my list for a major rewrite of the documentation. We recently pulled in a commit which adds pulseaudio back into Picroft; we found that installing pulseaudio was solving a lot of problems so have added it back in.

bluetooth

Bluetooth historically has been difficult to get working with Picroft, although the more recent Raspbian Stretch Lite-based image makes a bit easier. Do you have some more information on the specific issues you were getting, or the Bluetooth device you were using?

mycroft services

Sure, I can provide a bit more information on that.

Mycroft runs several services:

pi@picroft:~ $ ps -ef | grep mycroft
pi         680     1 10 11:48 tty1     00:00:16 python3 -m mycroft.messagebus.service
pi         683     1 13 11:48 tty1     00:00:21 python3 -m mycroft.skills
pi         686     1  9 11:48 tty1     00:00:14 python3 -m mycroft.audio
pi         689     1 99 11:48 tty1     00:02:35 python3 -m mycroft.client.speech
pi         708   503 31 11:48 tty1     00:00:47 python3 -m mycroft.client.text
pi        1513   683 13 11:50 tty1     00:00:05 /home/pi/mycroft-core/.venv/bin/python3 -m pip install -r /opt/mycroft/skills/mycroft-npr-news.mycroftai/requirements.txt
pi        1681  1637 54 11:51 pts/0    00:00:14 python3 -m mycroft.client.text
pi        1719   686  0 11:51 tty1     00:00:00 aplay -Dhw:0,0 /tmp/mycroft/cache/tts/01eaa55ed9d97b6a6b60e886c400272f.wav
pi        1739  1700  0 11:51 pts/1    00:00:00 grep --color=auto mycroft

The Message Bus is essentially a message passing service that helps the other services communicate. This is also how external tools can connect and interact with mycroft-core.

The Skills Service helps identify Intents and match Utterances to Skills. The Skills service also monitors /opt/mycroft/skills and reloads a Skill if there has been a change on the filesystem.

The Audio Service does what it says on the in - it helps provide audio output capabilities for mp3 and streaming audio.

The Speech client handles Speech to Text.

The Text client handles Text to Speech.

The mycroft-cli should start some or all of these services when activated. Picroft starts all of these services on boot, so that’s why a reboot is a failsafe way to restart all services.

logging in to Picroft

pi is the interactive user and is how you should be ssh'ing into Picroft

echo cancellation

No reason not to use this other than it may be more CPU-intensive than an RPi 3B+ can handle

Really appreciate your feedback!

Thanks v much for the replies. I had to install fasteners manually (maybe I was impatient and a restart would have sorted it in retrospect). I aim to get involved in the dev side of things not setup yet tho. Would like to get a radio skill going.

1 Like

A good place to start is this Internet Radio Skill - it needs a bit of an update for Python 3.4, it was written for Python 2.7.

So I spent a while getting pulseaudio going, Mainly because raspotify seemingly doesn’t behave well with only alsa.

Running under pi user pulseaudio worked well with echo cancellation, it removed some hum etc which is great. However trying to get it to work system wide (think this is really needed as different users are producing sound) meant that pulse+echo cancellation caused the pulse service to get killed due to being too far behind. I haven’t managed to fix this, not totally convinced it’s really lacking horsepower.

It was also a real pain to set it all up with a lot of googling, especially as I have 3 sinks. Also that feeling that I’m not setting it up quite right.

Thanks

Hi there @Nick_Holden thanks so much for digging into this one and for your efforts in troubleshooting.

Audio on Picroft, and the multitude of microphone and speaker combinations that can be connected to Picroft, is one of the most challenging parts of both using and supporting Picroft. The latest Raspbian Stretch-based Picroft image (the Lightning Release) attempts to circumvent this by using a menu-based system to have the user select from common speaker and microphone options. The script then sets the appropriate configuration for the speaker and microphone.

If other speaker and/or microphone combinations are used, then it can take a little bit of trial and error to get them working.

As for the echo cancellation, firstly thanks for giving that a go and trying to get it working - echo cancellation is something we’ve been wanting for a while now. Are there some specific changes you think we should be making to the Picroft image to make it more robust?

I guess it kind of depends who the target audience for the image is. People who want to fiddle or people installing it as a service. I imagine there are already tickets for some of the stuff, but in the interests of making my life easier :wink:

  1. It works better with echo cancellation so having the option to enable it in the setup util. If performance isn’t up to scratch people will buy better hardware if they are invested in the project anyway.

  2. Having a more comprehensive audio util letting you select source and sink hardware (you gotta specify them manually in pulse config for purposes of echo). Don’t see that having the option to add a mic from. Usb soundcard would be that difficult.

  3. The option to install pulse system wide or some solution to get pulse working for multiple users in a headless env.

Thanks!