Mycroft Mimic: Difference between revisions

From Voice Technology Wiki
Jump to navigation Jump to search
(Installing mimic v1)
Line 13: Line 13:
While setting up a Mycroft device installer will ask to build Mimic 1 locally. If you initially skipped this you can also re-run dev_setup.sh with a -fm flag for "force mimic".<blockquote>./dev_setup.sh -fm</blockquote>You can do the opposite, by running flag to "skip mimic":<blockquote>./dev_setup.sh -sm</blockquote>
While setting up a Mycroft device installer will ask to build Mimic 1 locally. If you initially skipped this you can also re-run dev_setup.sh with a -fm flag for "force mimic".<blockquote>./dev_setup.sh -fm</blockquote>You can do the opposite, by running flag to "skip mimic":<blockquote>./dev_setup.sh -sm</blockquote>


== '''KDE & gnome integration (mimic v1)''' ==
== Installation (mimic v1) ==
 
===== Arch based distros =====
Install form the AUR: https://aur.archlinux.org/packages/mimic
 
===== On Debian/Ubuntu =====
<code>$ sudo apt-get install gcc make pkg-config automake libtool libasound2-dev</code>
 
===== On Fedora =====
<code>$ sudo dnf install gcc make pkgconfig automake libtool alsa-lib-devel</code>
Mimic v1 source: https://github.com/MycroftAI/mimic1
 
== KDE & gnome integration (mimic v1) ==


This setup will let you read text with mimic tts from '''any application''' on your system simply by pressing a keyboard command.
This setup will let you read text with mimic tts from '''any application''' on your system simply by pressing a keyboard command.

Revision as of 07:55, 15 January 2022


What's Mycroft Mimic

It is a TTS system delivered with Mycroft (by Nov 2021 it's english only). It's available in two installation types:

  • Mimic (version 1) runs locally on device and has an understable but not great quality. But runs on small computer devices like a Raspberry Pi. It's by default the "fallback" if other voices are not available.
  • Mimic (version 2) is provided by Mycroft AI server/cloud backend infrastructure and offers a better voice quality (english only).

Tips & Tricks

Build Mimic 1 on device

While setting up a Mycroft device installer will ask to build Mimic 1 locally. If you initially skipped this you can also re-run dev_setup.sh with a -fm flag for "force mimic".

./dev_setup.sh -fm

You can do the opposite, by running flag to "skip mimic":

./dev_setup.sh -sm

Installation (mimic v1)

Arch based distros

Install form the AUR: https://aur.archlinux.org/packages/mimic

On Debian/Ubuntu
$ sudo apt-get install gcc make pkg-config automake libtool libasound2-dev
On Fedora
$ sudo dnf install gcc make pkgconfig automake libtool alsa-lib-devel

Mimic v1 source: https://github.com/MycroftAI/mimic1

KDE & gnome integration (mimic v1)

This setup will let you read text with mimic tts from any application on your system simply by pressing a keyboard command.


After installing mimic on your system adding this line to a custom keyboard shortcut in KDE or Gnome.

xsel > /tmp/speak.txt | sleep 0.3 | mimic -f /tmp/speak.txt | pkill xsel

I further optimised this by adding some configuration options that change the pitch and speed of the voice:

xsel > /tmp/speak.txt | mimic -voice slt --setf duration_stretch=0.85 --setf int_f0_target_mean=165 -f /tmp/speak.txt | pkill xsel

Stop mimic with:

pkill mimic


In gnome open system settings then go to: Keyboard » Customise Shortcuts » Custom Shortcuts » + and make two new shortcuts, one to start reading using the line above and another shortcut to stop reading with the pkill mimic command.

In KDE open system settings then go to: Shortcuts » Custom Shortcuts and make to new shortcuts one to start reading using the line above and another shortcut to stop reading with the pkill mimic command.

Create a file for xsel to store the text you want to read. In this example this file is in the /tmp directory and is called speak.txt (but you can use a different file name and directory if you like).


What do these commands and switch’s do:

xsel > my_file_name.txt (over rights the text in the file with highlighted text)

sleep 0.3 (tells the next command to wait for 0.3 seconds)

mimic (calls the mimic tts engine to start speaking)

-voice slt (sets the voice to the slt voice)

--setf duration_stretch=0.85 (makes it speak 25% faster (1 = normal speed and 1.5 in slower 50%)).

--setf int_f0_target_mean=165 (makes the pitch higher and =1 would make the pitch very low).

-f (means read text from file)

pkill xsel (stops the computer starting a new process for xsel every time this command is run).

There are quite a few voices installed with Mimic, the voice slt was my favourite. Type: mimic -lv in terminal to see a list of installed voices. Type: man mimic to see all the options and switches.

Mimic is built on flite-tts and the commands are the same as far as I can see.

Source: https://ebenfarnworth.substack.com/p/text-to-speech-tts-on-linux