MycroftAI
Mycroft is a open source voice assistant. It can run anywhere โ on a desktop computer, single board computers like the Raspberry Pi. It is open so it can be remixed, extended, improved. It can be used in anything from a science project to an enterprise software application.
Overview
Documentation
ADMIN EDIT: Vote for it on FeatHub: https://feathub.com/MichaIng/DietPi/+5
@LexiconCode This sound really nice, but as i rode about it, i'm not really aware, that it will run on every SBC as of now. They mention it only as a "ready to install" for RPi 3 and upper.
If you want it to run on other devices you've get to go the other way.... -> https://github.com/MycroftAI/mycroft-core/blob/dev/README.md
If it is supposed to run on every ever released device, the question should be than, why it isn't tested for more than RPi3 upper..... yeah, all may support "Debian Stretch", but which kernel at least and which modules does error if installed?
Did you installed 'MycroftAI' on other devices than Raspberry?
Not to be toxic but, if you want this, you may install it first and than open an issue which we all could get an efford at least, depending on its "errors"....
I'm sure lot of ppl will be impressed if 'DietPi' could solve the problem and implement it somehow, aren't they?
@SuBLiNeR looks like you may be new to Github. Welcome! I appreciate your feedback but there is no need to take that kind of tone with people in the community. I'm sure everyone would be impressed to recognize that no one has said 'DietPi' has to solve the problems and implement everything.
Opening a ticket can be used to gauge interest and therefore the amount of effort that the community not just OP wants to invest in exploring and adding an addition to the DietPi platform. There are many examples within Dietpi that required testing and slight modification to work on the platform. DietPi currently has software that only works on certain SBCs.
This is a place to gauge community interest and document testing. If you would like to be a part of that you're welcome to contribute.
Install
Ubuntu 16.04. Odroid C2, C1, XU4
Pi 2 or Pi 3 but not Pi 1
Mycroft is available for Linux by several methods.
Added to FeatHub, feel free to vote for it: https://feathub.com/MichaIng/DietPi/+5
Who the hell pushed this FeatHub request so hard the last days/week ๐? Although cheating should be prevented via GitHub account login, nearly 20 votes in this short time makes me think ๐ค ๐.
However, maybe Mycroft devs or community found it and voted all together. I already had a look into it:
python-virtualenv
, isolated/secured but slow... See our HA install which does the same. Every reinstall takes up to 40 minutes just to (re)install python into the virtualenv. However testing, before rating and isolation/security/compatibility vs performance trade./opt/mycroft
, log to /var/log/mycroft/
etc. If we want, we could move it via symlinks into dietpi_userdata to reduce SDcard I/O.Someone may have advertise the dietpi platform and Mycroft FeatHub request :wink: on their forums.
@LexiconCode
You mean someone particular? ๐
Jep interesting project indeed, and spreading better earlier than later gives it better chance to stay against the commercial alternatives in voice assistant market.
I couldn't help myself but post on mycroft forums. So that's where some of the votes come from at least.
Mycroft has been running it on my raspberry pi for some time and has integrations for Home Assistant. It's great to see a voice assistant assistant that's built for privacy by design.
It's great to see voice assistant assistant that's built for privacy by design.
Jep, I totally agree, way better than having one of these commercial devices, where suddenly users find their private conversations stored on an external server, and then reading reports about data abuse, security breaches and such.
EDIT: I assigned v6.21 milestone. v6.20 is already in Beta, so no new features/software will be implemented.
Just checking in @MichaIng as I know you're busy with other issues. Let me know when this is testable. I will gather support from the community abroad and myself to work out the bugs
@LexiconCode
Thanks for your offer and sorry for the delay. External causes forced us to concentrate on especially two other large topics. With v6.24 this will be implemented definitely ๐ค.
Test install passed:
root@VM-Stretch:/mnt/dietpi_userdata# G_TREESIZE mycroft-core/
2.5 GB mycroft-core/
2.2 GB mycroft-core/mimic
183.5 MB mycroft-core/.venv
128.2 MB mycroft-core/.git
15.7 MB mycroft-core/mycroft
1.4 MB mycroft-core/test
72.0 KB mycroft-core/doc
48.0 KB mycroft-core/scripts
48.0 KB mycroft-core/bin
24.0 KB mycroft-core/.github
By default Mycroft asks you to register at home.mycroft.ai
to pair your device. It can be skipped but for several skills (weather info, Speach-to-Text, Wolfram-Alpha, ...) API keys are required. So you would need to register manually on each provider to get those keys. Mycroft Home manages this internally. However many things can be done OOTB as well:
tell me a joke
>> All arrays Chuck Norris declares are of infinite size, because Chuck Norris knows no bounds.
Search for noodles
>> Let me look up noodles
>> Noodles are made from unleavened dough which is rolled flat and cut, or extruded, into one of a variety of
shapes. Noodle shapes include long, thin strips , helices, tubes, strings, shells, or other shapes.
Set an alarm for today 18:00
>> For what time?
18:00
>> For what time?
>> You can register me by going to Devices, selecting Add Device then use the code the number Four. 'X' as in X-Ray.
'K' as in Kilogram. 'A' as in Apple. 'W' as in Whiskey. 'V' as in Victor
6 pm
>> Alarm set for tomorrow at six p.m., in 22 hours
md5-551e1f773a7d937fbade593b2e8d4844
source /mnt/dietpi_userdata/mycroft-core/.venv/bin/activate
msm list
msm remove mycroft-pairing
msm install ...
Next would be a systemd unit to start the background services and an additional dietpi-autostart
option to start into Mycroft CLI?
Another thing:
Note to self:
python3-setuptools
and python3-gi
instead of their Python2 counterparts as deps in installer, since Mycroft runs with Python3 and this would allow to skip Python2 install completely.Procedure:
G_AGI git
cd /mnt/dietpi_userdata
git clone -b master --depth 1 https://github.com/MycroftAI/mycroft-core.git
cd mycroft-core
./dev_setup.sh -r -sm # -r=allow to run as root; -sm=skip building Mimic
./start-mycroft.sh debug
Using the above python3-setuptools
+ python3-gi
instead of python-setuptools
+ python-gobject-2-dev
works well, ~although I skipped Mimic build this time.~ (โฌ: Repeated successfully with Mimic as well.) So no Python 2 installed now, Python 3 only.
To start Mycroft in background, without CLI prompt:
/mnt/dietpi_userdata/mycroft-core/start-mycroft.sh all
PR about removing Python 2 install: https://github.com/MycroftAI/mycroft-core/pull/2167
Couldn't hold myself to add some slight bash coding enhancements ๐: https://github.com/MycroftAI/mycroft-core/pull/2166
If you have a repo I can provide a mimic deb for you so you don't need to build it.
@forslund
Many thanks for the offer. This is where I don't know enough about Python builds: Would that work on all architectures or would a separate package be required for each architecture? DietPi currently supports ARMv6 (armv6hf as with RPi1/Zero), ARMv7, ARMv8 and x86_64.
We do not have an own APT repo but could host the packages on our server for dpkg -i
install.
However nothing urgent, since the potential of an AI assistant is limited anyway without network access ๐. And everyone is free to build Mimic afterwards, when memory (+swap) size and time is there. I would add some instructions to our online docs then.
Btw another question about this: I built Mimic on top of a non-Mimic install by simply re-running the dev_setup.sh
with -fm
. While settings, skills etc are preserved, it doubles the other install steps (some like APT installs of course are skipped/finish directly as long as no updates are available). Is there a way to build Mimic only on top of an existing install?
Well mimic is written in C. I didn't wrongly assumed the Pi in the name meant Raspberry Pi hardware. Sorry for the confuzzlement :)
There is an install-mimic.sh
script in the scripts
folder which should be usable
@forslund
Ah, indeed DietPi started as Raspberry Pi OS at first, but quickly was extended to Odroids, Sparky, NanoPi, Pine64 and x86_64, limited explicit support for Orange Pi, BananaPi and some others SBCs. Basically it can be installed on any Debian based base image with the above architectures. So yeah, then I think the effort is too high for now with Mimic, found install-mimic.sh
, which makes a manual build easy, if required.
Did test install on real machine with microphone, found few things we need to take care:
/etc/asound.conf
does not seem to include proper microphone config. I am not too experienced with this, but it works when simply moving the conf out which makes ALSA revert to system defaults and the microphone magically works. But of course with multiple sound devices (onboard + USB DAC typically) the config is required, so we need a microphone configuration. arecord -l/-L
to scan for devices to select and add correctly to asound.conf
as default recording device. I just need to check out the correct syntax/directives for this ๐.paplay
to play wav files by default, but this can be changed to ALSA by setting "play_wav_cmdline": "aplay %1",
in either /etc/mycroft/mycroft.conf
(is not created by default) or /root/.mycroft/mycroft.conf
..ogg
files, we need to manually install vorbis-tools for ogg123
playback binary.We could further make the systemd unit run as an own user mycroft
. It might require to be added to the audio
group, but other skills I tested so far do not require any special permissions.
Security-wise it's a good idea to run mycroft as a non-root user since skills are python modules allowed to do anything python is allowed to do... It expects that it'll have a $HOME directory available for the user it's running as.
We recommend using the /etc/mycroft/mycroft.conf
location to setup "platform" or os related settings. like using aplay instead of paplay see picroft for example. mycroft doesn't write to this config at all, only reads it while the config under $HOME/.mycroft may be updated from the software.
Would be easiest to set the users home dir simply to the mycroft-core dir, as this makes as well backup etc. easier, same for skills dir. Also since DietPi allows to easily move the special /mnt/dietpi_userdata/
(where mycroft-core will be created) to an external drive, this would be preferrable to reduce disk I/O on SDcard, which are in use on most SBCs.
Skills dir is already in .gitignore
(aimed for symlink but includes a dir in case as well), the above would require to add .mycroft
, no big deal.
@forslund
Does Mycroft expect the skills to be in /opt or does it look inside the core dir and just follows the symlink in case? In case, we can simply switch symlink and main dir, no big deal.
You can relocate the main mycroft data dir using the config parameter "data_dir"
The skills dir will then be {data_dir}/skills
...That said the setup scripts (prepare_msm.sh
for example) may need hand editing to make sure it looks at the correct folder.
Okay I think, since the datadir contains further dirs+files by time, we should:
mycroft
user with /mnt/dietpi_userdata/mycroft-data
being home dir.ln -s /mnt/dietpi_userdata/mycroft-data /opt/mycroft
to make installer write skills directly to the right location."data_dir
" to /mnt/dietpi_userdata/mycroft-data
as well, after install, via /etc/mycroft/mycroft.conf
(besides other mention DietPi specific needs).This way variable data and the core install are in separete directories to avoid inteferences, but both easily moveable to external drive via DietPi tools.
Needed to install py_mplayer module manually, somehow Mycroft failed to do this automatically:
sudo -u mycroft /mnt/dietpi_userdata/mycroft-core/bin/mycroft-pip install py_mplayer
mplayer
as well. Okay I believe it is optional? Also does not seem to cause any further issues if both not installed. However might be worth to handle missing mplayer gracefully?00:26:45.181 - mycroft.audio.audioservice:load_services:110 - ERROR - Failed to import module mplayer
SyntaxError('invalid syntax', ('/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.5/site-packages/py_mplayer/__init__.py', 799, 29, ' except Exception, e:\n'))
root@Marlin-Laptop:~# sudo -u mycroft /mnt/dietpi_userdata/mycroft-core/bin/mycroft-pip install --force-reinstall py_mplayer
Collecting py_mplayer
Collecting pyee (from py_mplayer)
Downloading https://files.pythonhosted.org/packages/ad/d8/5608d571ffad3d7de0192b0b3099fe3f38d87c0817ebff3cee19264f0bc2/pyee-6.0.0-py2.py3-none-any.whl
adapt-parser 0.3.3 has requirement pyee==5.0.0, but you'll have pyee 6.0.0 which is incompatible.
Installing collected packages: pyee, py-mplayer
Found existing installation: pyee 5.0.0
Uninstalling pyee-5.0.0:
Successfully uninstalled pyee-5.0.0
Found existing installation: py-mplayer 0.1
Uninstalling py-mplayer-0.1:
Successfully uninstalled py-mplayer-0.1
Successfully installed py-mplayer-0.1 pyee-6.0.0
sudo -u mycroft /mnt/dietpi_userdata/mycroft-core/bin/mycroft-pip install --force-reinstall pyee==5.0.0
00:33:37.741 - mycroft.audio.audioservice:load_services:125 - ERROR - Failed to load service. NameError("no function 'libvlc_new'",)
@LexiconCode
How did you configure the microphone (/etc/asound.conf
)? Or did you install PulseAudio?
I found the default sample rate (16000) does not work with DietPi default asound.conf, that is set when choosing a sound card with equaliser disabled. What worked was adding the following to mycroft.conf:
"listener": {
"sample_rate": 48000
}
I am thinking to add this to our /etc/mycroft/mycroft.conf
which can then be overridden by user in /mnt/dietpi_userdata/mycroft-data/.mycroft/mycroft.conf
if wanted/required.
Enabling equaliser broke it again with an error in Mycroft audio service.
But all this might depend on the hardware, although I tested on all VMs with different emulated sound cards as well as another notebook (no VM). All required 48000 as sample rate when using default hw:n,m
PCM.
@LexiconCode
How did you configure the microphone (/etc/asound.conf
)? Or did you install PulseAudio?I found the default sample rate (16000) does not work with DietPi default asound.conf, that is set when choosing a sound card with equaliser disabled. What worked was adding the following to mycroft.conf:
"listener": { "sample_rate": 48000 }
I am thinking to add this to our
/etc/mycroft/mycroft.conf
which can then be overridden by user in/mnt/dietpi_userdata/mycroft-data/.mycroft/mycroft.conf
if wanted/required.Enabling equaliser broke it again with an error in Mycroft audio service.
But all this might depend on the hardware, although I tested on all VMs with different emulated sound cards as well as another notebook (no VM). All required 48000 as sample rate when using default
hw:n,m
PCM.
I'd look at my current that up and I'll get back to you tomorrow. If memory serves me correct I believe I used PulseAudio.
My current hardware is a bit unusual for the microphone which means a strange config. I need to use something fully supported like PlayStation Eye via USB versus the add-on board I have now for the Raspberry pi.
Most helpful comment
Jep, I totally agree, way better than having one of these commercial devices, where suddenly users find their private conversations stored on an external server, and then reading reports about data abuse, security breaches and such.
EDIT: I assigned v6.21 milestone. v6.20 is already in Beta, so no new features/software will be implemented.