# Aura Engine

<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-engine.png" width="250" align="right" />

Aura Engine is a play-out engine as part of [Aura Radio Software Suite](#About),
specifically build for the requirements of community radios.

<!-- TOC -->

- [Aura Engine](#aura-engine)
    - [Features](#features)
    - [Architecture](#architecture)
    - [Requirements](#requirements)
    - [Installation](#installation)
    - [Start the Engine](#start-the-engine)
    - [Logging](#logging)
    - [About](#about)
    - [Resources](#resources)

<!-- /TOC -->

## Features

- Play audio from multiple sources
- Dynamic switching of sources
- Record output to filesystem
- Stream output to an Icecast Server
- Multichannel Line-out
- Blank Detenction / Silence Detecter
- Auto Pilot a.k.a. Fallback Handling
- API to query Track-Service
- API to query programme

Read more on the [Engine Features](docs/engine-features.md) page.

## Architecture

AURA Engine as part of the AURA Radio Suite uses an modulear architecture
based on a REST API. All external information is retrieved using JSON data-structures.

To learn more, checkout the [Engine Developer Guide](docs/developer-guide.md) or visit
 the [Aura Meta](https://gitlab.servus.at/autoradio/meta) repository.

## Requirements

**Hardware Requirements:** This depends on how many audio sources and targets you are
 going to use, but for the most common scenarios any current hardware should be sufficient.
 For the audio devices it is required to use an interface which has supported ALSA drivers.

**Operating System:** Any linux system with ALSA, PulseAudio or Jack2 support should work. 
It is tested and coded on Debian Stretch and Ubuntu 18.0 with Python 3.6+.


## Installation

```bash
git clone https://gitlab.servus.at/autoradio/engine
```

**Install System Packages:**

```bash
sudo apt install \
    git \
    python3.7 python3.7-pip python3.7-dev \
    redis-server \
    libsndfile1 ffmpeg \
    liquidsoap liquidsoap-plugin-icecast \
    mariadb-server libmariadbclient-dev \
    quelcom \
    liquidsoap-plugin-alsa liquidsoap-plugin-pulseaudio \
    liquidsoap-plugin-all
```

**Install Python Packages:**

```bash
./install.sh
```

**Setup Database:**

```bash
mysql -u root -p

CREATE DATABASE aura_engine CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  
CREATE USER 'aura'@'localhost' IDENTIFIED BY 'secure-password';  
GRANT ALL PRIVILEGES ON aura_engine.* TO 'aura'@'localhost';  
```

**Configuration:**

Run

```bash
  sh init.sh
```

This creates the folder */var/audio* and copies some default configuration
to */etc/aura/engine.ini*

After that, you have to edit the settings in */etc/aura/engine.ini*. Ensure to take
your time to carefully review those settings!

Read more about detailed settings in the [Configuration Guide](docs/configuration-guide.md).

## Start the Engine

To start the AuRa Engine execute:

```bash
  systemctl start aura-lqs
  systemctl start aura-engine  
```

and on system boot run following:

```bash
  systemctl enable aura-lqs
  systemctl enable aura-engine
```

The first service starts the LiquidSoap Engine, while the latter boots the actual AuRa Engine.

## Logging

You can access the service logs using one of:

```
    journalctl -u aura-lqs
    journalctl -u aura-engine
```

## About

<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-logo.png" width="150" />

Aura Engine is the play-out engine of the Aura Radio Software Suite. Aura stands for Automated Radio and is a swiss army knife for community radios. Beside the Engine it provides Steering (Admin Interface for the radio station), Dashboard (Collaborative scheduling and programme coordination), Tank (Audio uploading, pre-processing and delivery). Read more in the [Aura Meta](https://gitlab.servus.at/autoradio/meta) repository or on the specific project pages.

| [<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-steering.png" width="150" align="left" />](https://gitlab.servus.at/autoradio/pv)  |  [<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-dashboard.png" width="150" align="left" />](https://gitlab.servus.at/autoradio/dashboard)  |  [<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-tank.png" width="150" align="left" />](https://gitlab.servus.at/autoradio/tank) | [<img src="https://gitlab.servus.at/autoradio/meta/-/raw/master/images/aura-engine.png" width="150" align="left" />](https://gitlab.servus.at/autoradio/engine)  |
|---|---|---|---|
| [Steering](https://gitlab.servus.at/autoradio/pv)  | [Dashboard](https://gitlab.servus.at/autoradio/dashboard)  | [Tank](https://gitlab.servus.at/autoradio/tank)  | [Engine](https://gitlab.servus.at/autoradio/engine)  |


## Resources ##

* **Python**: https://docs.python.org/
* **Redis**: https://redis.io/
* **Liquidsoap**: https://www.liquidsoap.info/doc-1.4.0/
* **Jack Audio**: https://jackaudio.org/