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.

📺Headless全自动B站直播录播、切片、上传一体工具

DDRecorder Headless全自动B站直播录播、切片、上传一体工具 感谢 FortuneDayssss/BilibiliUploader 安装指南(Windows) 在Release下载zip包解压。 修改配置文件config.json 双击运行DDRecorder.exe (这将使用co

322 Dec 27, 2022
A collection of python scripts for extracting and analyzing acoustics from audio files.

pyAcoustics A collection of python scripts for extracting and analyzing acoustics from audio files. Contents 1 Common Use Cases 2 Major revisions 3 Fe

Tim 74 Dec 26, 2022
GiantMIDI-Piano is a classical piano MIDI dataset contains 10,854 MIDI files of 2,786 composers

GiantMIDI-Piano is a classical piano MIDI dataset contains 10,854 MIDI files of 2,786 composers

Bytedance Inc. 1.3k Jan 04, 2023
Official implementation of A cappella: Audio-visual Singing VoiceSeparation, from BMVC21

Y-Net Official implementation of A cappella: Audio-visual Singing VoiceSeparation, British Machine Vision Conference 2021 Project page: ipcv.github.io

Juan F. Montesinos 12 Oct 22, 2022
Graphical interface to control granular sound synthesis.

Granular sound synthesis interface SoundGrain is a graphical interface where users can draw and edit trajectories to control granular sound synthesis

Olivier Bélanger 122 Dec 10, 2022
A telegram bot for which is help to play songs in vc 🥰 give 🌟 and fork this repo before use 😏

TamilVcMusic 🌟 TamilVCMusicBot 🌟 Give your 💙 Before clicking on deploy to heroku just click on fork and star just below How to deploy Click the bel

TamilBots 150 Dec 13, 2022
❤️ This Is The EzilaXMusicPlayer Advaced Repo 🎵

Telegram EzilaXMusicPlayer Bot 🎵 A bot that can play music on telegram group's voice Chat ❤️ Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7+

Sadew Jayasekara 11 Nov 12, 2022
SolidMusic rewrite version, need help

Telegram Streamer Bot This is rewrite version of solidmusic, but it can't be deployed now, help me to make this bot running fast and good. If anyone w

Shohih Abdul 63 Jan 06, 2022
Muzic: Music Understanding and Generation with Artificial Intelligence

Muzic is a research project on AI music that empowers music understanding and generation with deep learning and artificial intelligence.

Microsoft 2.6k Dec 30, 2022
❤️ Hi There Im Cozmo Music Bot A next gen powerful telegram group Music bot for get your Songs and music @Venuja_Sadew

🎵 Cozmo MUSIC 🎵 Cozmo Music is a Music powerfull bot for playing music on telegram voice chat groups. Requirements FFmpeg NodeJS nodesource.com Pyth

Venuja Sadew 3 Jan 08, 2022
Open-Source bot to play songs in your Telegram's Group Voice Chat. Powered by @Akki_ThePro

VcPlayer Telegram Voice-Chat Bot [PyTGCalls] ⇝ Requirements ⇜ Account requirements A Telegram account to use as the music bot, You cannot use regular

Akki ThePro 2 Dec 25, 2021
A voice assistant which can be used to interact with your computer and controls your pc operations

Introduction 👨‍💻 It is a voice assistant which can be used to interact with your computer and also you have been seeing it in Iron man movies, but t

Sujith 84 Dec 22, 2022
a library for audio and music analysis

aubio aubio is a library to label music and sounds. It listens to audio signals and attempts to detect events. For instance, when a drum is hit, at wh

aubio 2.9k Dec 30, 2022
A library for augmenting annotated audio data

muda A library for Musical Data Augmentation. muda package implements annotation-aware musical data augmentation, as described in the muda paper. The

Brian McFee 214 Nov 22, 2022
Royal Music You can play music and video at a time in vc

Royals-Music Royal Music You can play music and video at a time in vc Commands SOON String STRING_SESSION Deployment 🎖 Credits • 🇸ᴏᴍʏᴀ⃝🇯ᴇᴇᴛ • 🇴ғғɪ

2 Nov 23, 2021
Python audio and music signal processing library

madmom Madmom is an audio signal processing library written in Python with a strong focus on music information retrieval (MIR) tasks. The library is i

Institute of Computational Perception 1k Dec 26, 2022
:speech_balloon: SpeechPy - A Library for Speech Processing and Recognition: http://speechpy.readthedocs.io/en/latest/

SpeechPy Official Project Documentation Table of Contents Documentation Which Python versions are supported Citation How to Install? Local Installatio

Amirsina Torfi 870 Dec 27, 2022
A Youtube audio player for your terminal

AudioLine A lightweight Youtube audio player for your terminal Explore the docs » View Demo · Report Bug · Request Feature · Send a Pull Request About

Haseeb Khalid 26 Jan 04, 2023
XA Music Player - Telegram Music Bot

XA Music Player Requirements 📝 FFmpeg (Latest) NodeJS nodesource.com (NodeJS 17+) Python (3.10+) PyTgCalls (Lastest) MongoDB (3.12.1) 2nd Telegram Ac

RexAshh 3 Jun 30, 2022
A GUI-based audio player with support for a large variety of formats

Miza-Player A GUI-based audio player with support for a large variety of formats, able to play from web-hosted media platforms such as YouTube, includ

Thomas Xin 3 Dec 14, 2022