packages: Add ebu-norm

This commit is contained in:
PapaTutuWawa 2021-12-18 18:58:57 +01:00
parent 0bef626837
commit cbc9975aa8
4 changed files with 181 additions and 0 deletions

View File

@ -145,4 +145,7 @@ key-mapper = prev.callPackage ./tools/games/key-mapper {};
buildInputs = old.buildInputs ++ [ prev.taglib prev.libsForQt5.qtkeychain ];
});
sound-gambit = prev.callPackage tools/audio/sound-gambit {};
ebu-norm = prev.callPackage tools/audio/ebu-norm {};
}

View File

@ -0,0 +1,111 @@
diff --git a/ebu-norm b/ebu-norm
index ab5fdfe..57d4ca8 100755
--- a/ebu-norm
+++ b/ebu-norm
@@ -12,21 +12,6 @@ THR=-1
# sound-gambit release time (default 10, range 1 to 1000)
REL=10
-# Check availability of dependencies
-function checkAvail()
-{
- which "$1" >/dev/null 2>&1
- ret=$?
- if [ $ret -ne 0 ]
- then
- echo "tool \"$1\" not found." >&2
- exit 1
- fi
-}
-
-for tool in {ffmpeg,bc,sound-gambit}; \
- do checkAvail "$tool"; done
-
#Check for audio files
NUMARG=0
for file in "$@"; do
diff --git a/ebu-plot b/ebu-plot
index 5fb7438..4612fff 100755
--- a/ebu-plot
+++ b/ebu-plot
@@ -23,21 +23,6 @@ then
fi
done
-# Check availability of dependencies
-function checkAvail()
-{
- which "$1" >/dev/null 2>&1
- ret=$?
- if [ $ret -ne 0 ]
- then
- echo "tool \"$1\" not found." >&2
- exit 1
- fi
-}
-
-for tool in {pwsh,ffmpeg,gnuplot}; \
- do checkAvail "$tool"; done
-
# Command usage check
if [ $# -eq 0 ]
then
@@ -82,4 +67,4 @@ echo "Done!"
echo
echo "Skipped items: $SKIPPED"
cat $SKIPFILE
-rm $SKIPFILE
\ No newline at end of file
+rm $SKIPFILE
diff --git a/ebu-scan b/ebu-scan
index 11736d6..8190223 100755
--- a/ebu-scan
+++ b/ebu-scan
@@ -4,21 +4,6 @@
# Usage: ebu-scan <input files>.
-# Check availability of dependencies
-function checkAvail()
-{
- which "$1" >/dev/null 2>&1
- ret=$?
- if [ $ret -ne 0 ]
- then
- echo "tool \"$1\" not found." >&2
- exit 1
- fi
-}
-
-for tool in ffmpeg ; \
- do checkAvail "$tool"; done
-
#Check for audio files and enumerate
NUMARG=0
for file in "$@"; do
diff --git a/tp-norm b/tp-norm
index b8e4997..894f440 100755
--- a/tp-norm
+++ b/tp-norm
@@ -6,21 +6,6 @@
# Option:
# -t Specify true peak target, e.g. -t -2
-# Check availability of dependencies
-function checkAvail()
-{
- which "$1" >/dev/null 2>&1
- ret=$?
- if [ $ret -ne 0 ]
- then
- echo "tool \"$1\" not found." >&2
- exit 1
- fi
-}
-
-for tool in {ffmpeg,bc}; \
- do checkAvail "$tool"; done
-
#Check for audio files
NUMARG=0
for file in "$@"; do

View File

@ -0,0 +1,41 @@
{ stdenv, ffmpeg, sound-gambit, gawk, bc, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "ebu-norm";
version = "2.2";
src = fetchFromGitHub {
owner = "chrismhampson";
repo = "ebu-norm";
rev = "v${version}";
sha256 = "120rpi0k3rq0v50ia9cyailgnx5wvpgkzbp8vi74xmr3c0lf26r4";
};
patches = [ ./0000-remove-dep-check.patch ];
buildInputs = [
ffmpeg sound-gambit gawk bc
];
postPatch = ''
for file in ebu-scan ebu-plot ebu-norm tp-norm; do
sed --in-place \
-e "s|ffmpeg|${ffmpeg}/bin/ffmpeg|g" \
-e "s|bc|${bc}/bin/bc|g" \
-e "s|sound-gambit|${sound-gambit}/bin/sound-gambit|g" \
$file
done
'';
installPhase = ''
mkdir -p $out/bin
cp {ebu-scan,ebu-plot,ebu-norm,tp-norm} $out/bin/
'';
meta = with lib; {
description = "An advanced, professional batch normalizer and scanner for EBU R 128 and other target levels.";
homepage = "https://github.com/chrismhampson/ebu-norm";
license = licenses.gpl3;
maintainers = [ ];
};
}

View File

@ -0,0 +1,26 @@
{ stdenv, lib, libsndfile, gnumake, pkg-config, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "sound-gambit";
version = "0.6";
src = fetchFromGitHub {
owner = "x42";
repo = "sound-gambit";
rev = "v${version}";
sha256 = "18yf7sp6r8gqlifs9zq23ddsi5d46i6sadnh6jnvll3mhgm0h8bv";
};
buildInputs = [ libsndfile pkg-config ];
makeFlags = [
"PREFIX=${placeholder "out"}"
];
meta = with lib; {
description = "Audio File Peak Limiter";
homepage = "https://github.com/x42/sound-gambit";
license = licenses.gpl3;
maintainers = [ ];
};
}