Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock WavPack codec for recorder #8

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ in progress
===========

- Add guidelines for running Saraswati on Docker
- Unlock WavPack codec for recorder


2021-06-21 0.3.0
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ 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
sudo apt-get install --yes alsa-utils mkvtoolnix flac wavpack
sudo pip3 install saraswati --upgrade

macOS systems
-------------
::

brew install gstreamer gst-python gst-libav gst-plugins-base gst-plugins-good
brew install mkvtoolnix flac
brew install mkvtoolnix flac wavpack


Configure system
Expand Down
8 changes: 7 additions & 1 deletion saraswati/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ def add_channel(self, name: str, source: str):
# TODO: Add WavPack (wavpackenc)
# https://gstreamer.freedesktop.org/documentation/wavpack/wavpackenc.html
pipeline_expression = (
f"{source} ! audioconvert ! queue ! flacenc ! flactag ! flacparse ! "
# TODO: Make "codec" configurable.
#f"{source} ! audioconvert ! queue ! flacenc ! flactag ! flacparse ! "
f"{source} ! audioconvert ! queue ! wavpackenc ! " # ! wavpackparse
f"muxer.audio_0 splitmuxsink name=muxer muxer=matroskamux "
f"max-size-time={chunk_duration_ns:.0f} max-files={self.settings.chunk_max_files}"
)
Expand Down Expand Up @@ -217,6 +219,10 @@ def on_message(self, pipeline: Pipeline, bus, message):
logger.info("End of stream: {}".format(message))
pipeline.gst.set_state(Gst.State.NULL)

elif message.type == Gst.MessageType.WARNING:
err, debug = message.parse_warning()
logger.warning("Pipeline warning: {} ({})".format(err, debug))

elif message.type == Gst.MessageType.ERROR:
err, debug = message.parse_error()
logger.error("Pipeline error: {} ({})".format(err, debug))
Expand Down