Skip to content

Kalliope requirements for Raspbian

Kalliope can be installed:

Install via the pre-compiled disk image

Download the last image from the release page of Kalliope and load it as usual onto an SD card.

  • Login: pi
  • Password: raspberry

Once installed, use the raspi-config command to expand the file system and fill the available space on the SD card. The SSH server is enable by default. Get the IP of your Rpi via the command ip a and then connect via your favourite SSH client.

You'll find a couple folders named "starter_kit_" located in /home/pi. Those folders are basic configuration that will help you to start with Kalliope.

Install via script

Just run the following bash command to install Kalliope on a freshly installed Raspberry Pi:

bash -c "$(curl -sL https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh)"

Manual installation

Note: It is recommended to use a lite installation of Raspbian without any graphical interface for a better experience.

Note: The first Raspberry Pi is not officially supported. The installation will works but a single core with only 700Mhz may produce latency.

Debian packages requirements

Install the required system libraries and software:

sudo apt-get update
sudo apt-get install git python-dev libsmpeg0 libttspico-utils libsmpeg0 flac libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential libssl-dev libffi-dev sox libatlas3-base mplayer libyaml-dev libpython2.7-dev libav-tools libjpeg-dev

Install the last release of python-pip:

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

Method 1 - User install using the PIP package

You can install kalliope on your system by using Pypi:

sudo pip install kalliope

Method 2 - Manual setup using sources

Clone the project:

git clone https://github.com/kalliope-project/kalliope.git
cd kalliope

Install the project:

sudo python setup.py install

Method 3 - Developer install using Virtualenv

Install the python-virtualenv package:

sudo apt-get install python-virtualenv

Clone the project:

git clone https://github.com/kalliope-project/kalliope.git
cd kalliope

Generate a local python environment:

virtualenv venv

Install the project using the local environment:

venv/bin/pip install --editable .

Activate the local environment:

source venv/bin/activate

Method 4 - Developer, dependencies install only

Clone the project:

git clone https://github.com/kalliope-project/kalliope.git
cd kalliope

Install the python dependencies directly:

sudo pip install -r install/files/python_requirements.txt

Raspberry Pi configuration

This section deals with the special configuration needed to get kalliope working on a RPi.

Microphone configuration

Get the output card:

aplay -l

Output example with a USB headset connected:

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Here we see that:

  • the analog audio (where the jack is connected) on card 0 and device 1
  • usb audio on card 1 and device 1

Get the input (microphone card):

arecord -l

Output example with a USB headset connected:

**** List of CAPTURE Hardware Devices ****
card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Here one shall see one peripheral on card 1 and device 0

Create a configuration file that applies the following configuration:

  • output audio (what Kalliope says) on the analog audio (via speakers connected to the jack)
  • input audio (what is said to Kalliope) on the USB microphone

Create a file in /home/pi/.asoundrc with the content below

pcm.!default {
   type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   }
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
}

Where playback.pcm is the output audio and the capture.pcm is the input audio.

Restart alsa to apply changes:

sudo /etc/init.d/alsa-utils restart

Adjust the microphone sensibility by running alsamixer:

alsamixer

Select the microphone device by pressing F6 and move up the mic sensibility level: logo

HDMI / Analog audio

By default, the audio stream will use HDMI if something is plugged into this port. Check the official documentation to switch from HDMI to analog.

sudo raspi-config

Configure your locales

Locales defines language and country specific setting for your programs and shell session. To set system’s locale you need use shell variable. For example, LANG variable can be used to set en_US (English US) language.

Check current locales:

locale

To update your locale, type the command bellow:

sudo dpkg-reconfigure locales

Select in the list the locales of your country, by selecting the code with UTF8, example:

  • de_DE.utf8
  • en_GB.utf8
  • fr_FR.utf8
  • es_ES.utf8

Then, update your /home/pi/.bashrc file by exporting the language. Example:

export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"

Source the file to handle changes

source /home/pi/.bashrc

Test your env

Check your microphone and speaker config

To ensure that you can record your voice, run the following command to capture audio input from your microphone:

rec test.wav

Press CTRL-C after capturing a sample of your voice.

Then play the recorded audio file

mplayer test.wav

Your installation is now complete, let's take a look now to the getting started documentation to learn how to use Kalliope.

(Optional) Start Kalliope automatically after a reboot

If you want to start Kalliope automatically Place the script bellow in /etc/systemd/system/kalliope.service.

Update the path <my_config_path> with the path where you've placed your brain.yml and settings.yml.

Update the <username> with a non root user. For example, on Raspbian you can set pi.

[Unit]
Description=Kalliope

[Service]
WorkingDirectory=<my_config_path>

Environment='STDOUT=/var/log/kalliope.log'
Environment='STDERR=/var/log/kalliope.err.log'
ExecStart=/bin/bash -c "/usr/local/bin/kalliope start > ${STDOUT} 2> ${STDERR}"
User=<username>

[Install]
WantedBy=multi-user.target

E.g

[Unit]
Description=Kalliope

[Service]
WorkingDirectory=/home/pi/my_kalliope_config

Environment='STDOUT=/var/log/kalliope.log'
Environment='STDERR=/var/log/kalliope.err.log'
ExecStart=/bin/bash -c "/usr/local/bin/kalliope start > ${STDOUT} 2> ${STDERR}"
User=pi

[Install]
WantedBy=multi-user.target

Then, reload systemctl, start the service and enable it at startup

sudo systemctl daemon-reload
sudo systemctl start kalliope
sudo systemctl enable kalliope