Sonica is a collection of software, that shares many similarities with the wonderful mpd and mopidy. Sonica is also built up around a central daemon, but unlike the mpd architecture, does not assume that music is only located in one place or available through many platforms.
The goal of the Sonica project is to implement a music system that is collaborative-first, meaning party-play is assumed to be the primary means of use, but that also allows a single user to take advantage of the functionality without being burdened.
The core of Sonica is the daemon that implements a server following the Sonica interface as defined by the gRPC spec.
Client software then communicates with the daemon via gRPC (or in the case of the web-client, the generated HTTP REST interface). This allows easy creation of something like chat-bots in any language supported by gRPC, without writing a lot of boilerplate to interface with Sonica.
Each client and the daemon has their own README with build information and the like.
Currently Sonica is only pre-packaged for use with nix. To install it via nix, the repo has a root map of tools:
sonica = import (fetchTarball "https://github.com/SEbbaDK/sonica/archive/v0.2.tar.gz) { };
# Then sonica.cli, sonica.daemon, etc. is packages that can be imported into a shell
This also means you can try different features out with:
nix run -f "https://github.com/sebbadk/sonica/archive/master.tar.gz" cli
Directly installing with nixos it could be done as:
let
sonica = import (fetchTarball "https://github.com/SEbbaDK/sonica/archive/v0.2.tar.gz) { };
in
{
environment.systemPackages [ sonica.daemon sonica.cli ];
}
To work on any part of Sonica, the prepare.py
script is needed to generate gRPC code for the language. To get started with the discord
client, just run ./prepare/prepare.py discord
.
This requires the python packages from the prepare/requirements.txt
, as well as protoc
needing to be in the path. (Check the gRPC web page for info on how to install it on your platform)
The easiest way to work on Sonica is to use the nix
package manager, as all parts of Sonica has shells set up, so only nix-shell
is needed for development. For preparation, use nix-shell
in the root and then sonica-prepare
will be in your path.
To get everything working on Arch and Arch-derived distributions, follow the following steps:
- Install the
crystal
andshards
packages from the Arch repositories - In a terminal, navigate to the root directory of the Sonica repo
- Run
shards init
- Run
echo -e "dependencies:\n\tlogger:\n\t\tgithub: crystal-lang/logger.cr\n\tgrpc:\n\t\tgithub: jgaskins/grpc" >> shard.yml
- Run
shards install
and then restart your shell
From here, you can start install requirements and preparing specific installation modules. For python-based modules (such as discord
and daemon
):
- Run
python -m venv venv
, and then active the virtual environment, if you want to use a virtual environment. - Run
python -m pip install --upgrade pip
followed bypip install -r prepare/requirements.txt
- For each
[MODULE]
you wish to work on, runpip install -r [MODULE]/requirements.txt
, thenpython prepare/prepare.py --protoc-gen-crystal ./bin/protoc-gen-crystal --protoc-gen-grpc ./bin/grpc_crystal [MODULE]