Skip to content

Commit

Permalink
Unlock WavPack codec for recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 21, 2021
1 parent 9376f19 commit 4ec67f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit 4ec67f3

Please sign in to comment.