Klangbecken: The RaBe Endless Music Player

Overview

Klangbecken

Python package Liquidsoap script Codestyle Black

Klangbecken is the minimalistic endless music player for Radio Bern RaBe based on liquidsoap.

It supports configurable and editable playlists, jingle insertion, metadata publishing and more.

It is designed for stand-alone operation, robustness and easy maintainability. All files are stored in a single data directory.

This repository contains three components of the RaBe Klangbecken:

Two additional components are in their own repository:

  • The listener for the current "on air" status, the virtual Sรคmubox.
  • The web-based UI for playlist editing.

How they interact can be seen in the system overview diagram:

System overview diagram

System requirements

  • Unix-like operating system environment
  • Python (>= v3.7)
    • docopt library for parsing command line arguments
    • Werkzeug library (>= v2.0) for WSGI support
    • PyJWT library (>= v2.0) for creating and verifing JWT authentication tokens
    • mutagen library for audio tag editing
  • ffmpeg binary (>= v2.8) for audio analysis
  • Liquidsoap audio player (v1.3 without inotify support)

Local Setup

Clone the repository

git clone https://github.com/radiorabe/klangbecken.git
cd klangbecken

We strongly recommend to create a virtual environment (see additional tools). E.g.

python -m venv .venv
source .venv/bin/activate

Install dependencies

Install Python dependencies

pip install -r requirements.txt

Install ffmpeg with your system's package manager. E.g.

yum install ffmpeg

Install Liquidsoap (on CentOS 7 you can also use our prebuilt package)

yum install opam
opam init
# we need liquidsoap 1.3.7 which does not run after OCaml 4.07.0
opam switch create klangbecken 4.07.0
opam depext alsa mad lame vorbis taglib liquidsoap.1.3.7
opam install alsa mad lame vorbis taglib liquidsoap.1.3.7
eval $(opam env)

Install the client UI:

cd ..
git clone https://github.com/radiorabe/klangbecken-ui
cd klangbecken-ui
npm install

Run the programs

Initialize the data directory:

python -m klangbecken init

Run the development backend server (API and data directory):

python -m klangbecken serve

Run the client development server (user interface):

cd ../klangbecken-ui
npm run serve

Browse to http://localhost:8080 and start uploading audio files.

Run the liquidsoap audio player:

eval $(opam env)
liquidsoap klangbecken.liq

Manually set the onair status of the player using netcat:

echo "klangbecken.on_air True" | nc -U -w 1 klangbecken.sock

Development

For contributing to this project, fork this repository, and clone your local working copy from your personal fork. Push commits to your repository to create a pull request with your changes.

Python Package

The Python code is tested with a test suite and follows the flake8 coding guidelines.

Before submitting your code you might want to make sure that ...

  1. ... you have installed the test dependencies

    pip install -r requirements-test.txt
  2. ... the test suite runs without failure

    python -m unittest discover
  3. ... all your code is covered by (hopefully) meaningful unit tests

    coverage run -m unittest discover
    coverage report
  4. ... your code follows the coding style guidelines

    flake8

Recommended Tools (optional)

We recommend the use of tox, black and isort for development.

pip install tox black isort
tox

Instead of running all the above commands manually, tox lets you run them all at once for all installed Python versions. Make sure to have at least the Python version installed, that is used in production (currently Python 3.9). tox is also what we use in continuos integration, so using it locally helps you to make your code pass it. To call it simply type:

tox
black

Manually fixing coding style mistakes is a pain. black formats your code automatically.

black .
isort

Finally, isort helps to consistently organize package imports.

isort .

All development tools are preconfigured in setup.cfg. For additional tools and tips & tricks and see additional tools.

Liquidsoap Script

Liquidsoap lets you syntax check and type check your script:

liquidsoap --check klangbecken.liq

Simulation

Apart from type checking, the inherent nature of the liquidsoap language generating a live audio stream makes it difficult to test the code with unit tests. Observing the behavior of the player script and the effects of changes in real-time take lot of time, usually weeks or even months. Accellerated simulation runs help to observe the long-time player behavior in a reasonable amount of time.

Deployment

Your code has passed continuous integration, and your pull request has been accepted. Now you want to deploy your (or somebody else's) code to production. First, some preparation is necessary, but then the deployment script deploy.sh automates most of the work deploying the code.

Preparation before deploying for the first time:

  • Make sure that you have access to the production server (e.g. SSH publik key authentication).
  • Configure a remote prod pointing at the repository on the production system.
    git add remote prod [email protected]_PRODUCTION_VM_NAME:klangbecken.git
  • Optional: Install the Apache development libraries locally. E.g.
    yum install httpd-devel
  • Configure a remote repository upstream pointing at this upstream repository:
    git remote add upstream [email protected]:radiorabe/klangbecken-ui.git
  • Configure git to automatically fetch tags from upstream:
    git config remote.upstream.tagOpt --tags

Preparation before deploying:

  • When deploying both, the front-end and the back-end app, deploy the front-end first.
  • Check again that the code you want to deploy passed continuous integration.
  • Make sure that your working directory is clean, and that you are on the master branch:
    git stash
    git checkout master
  • Bring your code in sync with the latest version from upstream:
    git fetch upstream
    git rebase upstream/master
  • Verify that you are indeed in sync with upstream:
    git show --no-patch

Run the script:

./deploy.sh [--no-mod-wsgi]

It perfoms the following steps:

  • Increment and commit a new version number.
  • Download all run-time dependencies.
  • Optionally download mod_wsgi (Requires httpd-devel libraries to be installed locally. Use --no-mod-wsgi to not reinstall mod_wsgi).
  • Copy the dependencies to production.
  • Push your code to production.
  • Install all dependencies in production.
  • Install the Python package (API and CLI) in production.
  • Reload the web server to load the new API code.
  • Copy the liquidsoap script to it's destination.
  • If everything was successful, tag the current commit with the new version number, and push it to the upstream repository.

Finalize deployment:

  • If the liquidsoap script (klangbecken.liq) changed, restart the liquidsoap player during a "off air" moment:
    systemctl restart [email protected]

For detailed information on how to setup a productive server see Deployment.

License

Klangbecken is released under the terms of the GNU Affero General Public License. Copyright 2017-2021 Radio RaBe. See LICENSE for further information.

Python interface to the WebRTC Voice Activity Detector

py-webrtcvad This is a python interface to the WebRTC Voice Activity Detector (VAD). It is compatible with Python 2 and Python 3. A VAD classifies a p

John Wiseman 1.5k Dec 22, 2022
This Is Telegram Music UserBot To Play Music Without Being Admin

This Is Telegram Music UserBot To Play Music Without Being Admin

Krishna Kumar 36 Sep 13, 2022
Bot duniya Music Player

Bot duniya Music Player Requirements ๐Ÿ“ FFmpeg (Latest) NodeJS nodesource.com (NodeJS 17+) Python (3.10+) PyTgCalls (Lastest) 2nd Telegram Account (ne

Aman Vishwakarma 16 Oct 21, 2022
This library provides common speech features for ASR including MFCCs and filterbank energies.

python_speech_features This library provides common speech features for ASR including MFCCs and filterbank energies. If you are not sure what MFCCs ar

James Lyons 2.2k Jan 04, 2023
Neural building blocks for speaker diarization: speech activity detection, speaker change detection, overlapped speech detection, speaker embedding

โš ๏ธ Checkout develop branch to see what is coming in pyannote.audio 2.0: a much smaller and cleaner codebase Python-first API (the good old pyannote-au

pyannote 2.1k Dec 31, 2022
commonfate ๐Ÿ“ฆcommonfate ๐Ÿ“ฆ - Common Fate Model and Transform.

Common Fate Transform and Model for Python This package is a python implementation of the Common Fate Transform and Model to be used for audio source

Fabian-Robert Stรถter 18 Jan 08, 2022
DeepSpeech is an open source embedded (offline, on-device) speech-to-text engine which can run in real time on devices ranging from a Raspberry Pi 4 to high power GPU servers.

Project DeepSpeech DeepSpeech is an open-source Speech-To-Text engine, using a model trained by machine learning techniques based on Baidu's Deep Spee

Mozilla 20.8k Jan 03, 2023
Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Sadew Jayasekara 15 Nov 12, 2022
Synthesia but open source, made in python and free

PyPiano Synthesia but open source, made in python and free Requirements are in requirements.txt If you struggle with installation of pyaudio, run : pi

DaCapo 11 Nov 06, 2022
Audio spatialization over WebRTC and JACK Audio Connection Kit

Audio spatialization over WebRTC Spatify provides a framework for building multichannel installations using WebRTC.

Bruno Gola 34 Jun 29, 2022
Code for csig audio deepfake detection

FMFCC Audio Deepfake Detection Solution This repo provides an solution for the ๅคšๅช’ไฝ“ไผช้€ ๅ–่ฏๅคง่ต›. Our solution achieve the 1st in the Audio Deepfake Detection

BokingChen 9 Jun 04, 2022
PatrikZero's CS:GO Hearing protection

Program that lowers volume when you die and get flashed in CS:GO. It aims to lower the chance of hearing damage by reducing overall sound exposure. Uses game state integration. Anti-cheat safe.

Patrik ลฝรบdel 224 Dec 04, 2022
ianZiPu is a way to write notation for Guqin (ๅค็ด) music.

PyBetween Wrapper for Between - ๋น„ํŠธ์œˆ์„ ์œ„ํ•œ ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ Legal Disclaimer ์˜ค์ง ๊ต์œก์  ๋ชฉ์ ์œผ๋กœ๋งŒ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๋น„ํŠธ์œˆ์€ VCNC์˜ ์ž์‚ฐ์ž…๋‹ˆ๋‹ค. ์•…์˜์  ๊ณต๊ฒฉ์— ์ด์šฉํ• ์‹œ ์ฒ˜๋ฒŒ ๋ฐ›์„์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์— ๋”ฐ๋ฅธ ์ฑ…์ž„์€ ์‚ฌ์šฉ์ž๊ฐ€

Nancy Yi Liang 8 Nov 25, 2022
FPGA based USB 2.0 high speed audio interface featuring multiple optical ADAT inputs and outputs

ADAT USB Audio Interface FPGA based USB 2.0 High Speed audio interface featuring multiple optical ADAT inputs and outputs Status / current limitations

Hans Baier 78 Dec 31, 2022
Mentos Music Bot With Python

Mentos Music Bot For Any Query Join Our Support Group ๐Ÿ‘ฅ Special Thanks - @OfficialYukki Hey Welcome To Here ๐Ÿ’ซ ๐Ÿ’ซ You Can Make Your Own Music Bot Fo

Cyber Toxic 13 Oct 21, 2022
PianoPlayer - Automatic fingering generator for piano scores

PianoPlayer - Automatic fingering generator for piano scores

Marco Musy 571 Jan 02, 2023
๐ŸŽต A music bot for discord servers!

music bot A music bot for Discord Servers Features Play songs in your discord server Get the lyrics without going on a web explorer Commands Command P

1 Jul 25, 2022
Gateware for the Terasic/Arrow DECA board, to become a USB2 high speed audio interface

DECA USB Audio Interface DECA based USB 2.0 High Speed audio interface Status / current limitations enumerates as class compliant audio device on Linu

Hans Baier 16 Mar 21, 2022
This is a python package that turns any images into MIDI files that views the same as them

image_to_midi This is a python package that turns any images into MIDI files that views the same as them. This package firstly convert the image to AS

Rainbow Dreamer 4 Mar 10, 2022
A tool for retrieving audio in the past

Rewinder A tool for retrieving audio in the past. Ever felt like, I need to remember that discussion which happened 10 min back. Now you can! Rewind a

Bharat 1 Jan 24, 2022