GithubHelp home page GithubHelp logo

hiveeyes / saraswati Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 2.0 4.18 MB

Saraswati is a robust, multi-channel audio recording, transmission and storage system

Home Page: https://community.hiveeyes.org/t/developing-saraswati-a-robust-multi-channel-audio-recording-transmission-and-storage-system/924

License: GNU Affero General Public License v3.0

Python 91.25% Makefile 5.46% Dockerfile 3.28%
audio audio-recorder audio-recording audio-mux multi-channel multi-channel-audio field-recording environmental-monitoring earth-observations

saraswati's Introduction

License https://img.shields.io/pypi/dm/saraswati.svg?label=PyPI%20downloads

Saraswati

About

Saraswati is a robust, multi-channel audio recording, transmission and storage system. The system is designed for flexible field recording of audio signals in environmental monitoring systems.

Saraswati is developed by an independent community of scientists from different domains working collaboratively on this project. You are welcome to join our efforts.

Etymology

Saraswati is the Hindu goddess of knowledge, music, art, wisdom and learning.

Technologies

The software is based on GStreamer and the GStreamer Python Bindings, in turn using the fine PyGObject under the hood. It is designed to run on Single-board computer (SBC) systems as well as larger machines.

Status

The software was tested successfully with Python 3.7-3.9, GStreamer 1.10.4, 1.14.4, 1.16.2 and 1.18.4, on both Linux (Debian 10 buster, Debian 11 bullseye, Linux Mint 20.2) and macOS (Catalina 10.15.7).

Setup

This part of the documentation covers the basic installation of Saraswati. The first step to using any software package is getting it properly installed. Please read this section carefully.

When aiming to run Saraswati autonomously in a production setup, please also consider reading the documentation about running Saraswati in production.

Install prerequisites

As Saraswati is based on GStreamer and, optionally, ALSA, let's install the relevant packages.

Debian-based systems
sudo apt-get update
sudo apt-get install --yes libgstreamer1.0 gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good
sudo apt-get install --yes python3 python3-pip python3-gst-1.0 python3-gi python3-tz
sudo apt-get install --yes alsa-utils mkvtoolnix flac
macOS systems
brew install gstreamer gst-python gst-libav gst-plugins-base gst-plugins-good
brew install mkvtoolnix flac

Configure system

Synchronize system time with NTP, this is important for appropriate timestamping:

sudo timedatectl set-ntp true

Install Saraswati

Install saraswati package from PyPI:

pip install saraswati

To quickly verify the installation, invoke:

saraswati record --channel="testdrive source=autoaudiosrc"

Usage

This part of the documentation covers how to run Saraswati interactively. Please read this section carefully.

When aiming to run Saraswati autonomously in a production setup, please also consider reading the documentation about running Saraswati in production.

Recording audio

saraswati record is an implementation to

  • ingest audio from a GStreamer audio source element,
  • run it through flacenc to encode audio with the FLAC lossless audio encoder, and
  • finally store it using splitmuxsink, a GStreamer component which multiplexes incoming streams into multiple time- or size-limited files

Each audio fragment will be timestamped with the current date/time information in an ISO8601-like format, using a qualified UTC offset of +0000.

In order to learn about the command line syntax, please invoke saraswati --help or saraswati record --help.

Uploading audio

When the --upload= option is given, Saraswati will attempt to upload its spool directory to an rsync target. By default, it will do this each 5 minutes.

Please note rsync will be invoked using the --remove-source-files option. So, after successful upload, the spooled files on the local machine will get purged.

Example

Invoke:

saraswati record --channel="testdrive source=autoaudiosrc"

This will yield audio fragments in chunks worth of 5 minutes each:

recording_testdrive_20210621T155817+0000_0000.mka
recording_testdrive_20210621T160317+0000_0001.mka
recording_testdrive_20210621T160817+0000_0002.mka
recording_testdrive_20210621T161317+0000_0003.mka
recording_testdrive_20210621T161817+0000_0004.mka

Display segment metadata information embedded into the Matroska container file:

mkvinfo recording_testdrive_20210620T122642+0000_0065.mka | grep -E 'Codec|Date|duration'
| + Date: Sun Jun 20 12:26:42 2021 UTC
|  + Default duration: 00:00:00.104489796 (9.570 frames/fields per second for a video track)
|  + Codec ID: A_FLAC

Extract audio track:

mkvextract recording_testdrive_20210621T155817+0000_0000.mka tracks 0:audio_20210621T155817.flac
flac --decode audio_20210621T155817.flac

file recording_testdrive_20210621T155817+0000_0000.mka
Matroska data

file audio_20210621T155817.flac
FLAC audio bitstream data, 16 bit, mono, 48 kHz, length unknown

file audio_20210621T155817.wav
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz

Project information

Background

This software gets developed for the "Bee Observer" (BOB) project, a joint endeavour initiated by the Cognitive neuroinformatics group at the University of Bremen and the people of the independent research and development project Hiveeyes. See also:

Details

The "Saraswati" program is released under the GNU AGPL license. Its source code lives on GitHub and the Python package is published to PyPI. You might also want to have a look at the documentation.

If you'd like to contribute you're most welcome! Spend some time taking a look around, locate a bug, design issue or spelling mistake and then send us a pull request or create an issue.

Thanks in advance for your efforts, we really appreciate any help or feedback.

Code license

The code is licensed under the GNU AGPL license. See LICENSE file for details.


Have fun!

saraswati's People

Contributors

amotl avatar diediren avatar mko1640 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

diediren mko1640

saraswati's Issues

Start Saraswati service after USB sound devices have been registered

Hi there,

when invoking sudo saraswati setup --systemd, Saraswati installs itself as a systemd unit. For that, it uses the saraswati.service systemd unit definition file.

@MKO1640 reported a problem with that at https://community.hiveeyes.org/t/installation-von-saraswati-auf-einem-industrie-pc-mit-upload-auf-synology-nas/4048/39:

There is also a small problem with the USB microphones. They are not always recognized by the GStreamer after a reboot. They have to be unplugged once and plugged in again.

With lsusb, the microphones are also always recognized. But it also recognizes 2 internal Linux USB hubs.
With my test computer I could not reproduce the problem so far.

He already offers a probable suggestion for the root cause:

I guess that the service starts before the USB is initialized and therefore it doesn't work. So it might be enough to restart ALSA and GStreamer before Saraswati.

With kind regards,
Andreas.

/cc @ClemensGruber

Tapping into an audio channel

Hi there,

extending the scope of Saraswati, we discussed a feature to make it possible to tap into a recording channel (i.e. GStreamer pipeline) in playing state. For this to happen, we need two mechanisms:

  • A signalling pathway to tell a running Saraswati instance about an interest on one or more specific audio channels.
  • A subsystem to attach another sink element to an existing GStreamer pipeline in order to output/send the selected audio channels to another system which, in turn, will be able to broadcast the audio stream to any number of "live" listeners.

With kind regards,
Andreas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.