diff --git a/packages/default.nix b/packages/default.nix index 48d8d61..0c3d3ec 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -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 {}; } diff --git a/packages/tools/audio/ebu-norm/0000-remove-dep-check.patch b/packages/tools/audio/ebu-norm/0000-remove-dep-check.patch new file mode 100644 index 0000000..5c9ae4f --- /dev/null +++ b/packages/tools/audio/ebu-norm/0000-remove-dep-check.patch @@ -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 . + +-# 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 diff --git a/packages/tools/audio/ebu-norm/default.nix b/packages/tools/audio/ebu-norm/default.nix new file mode 100644 index 0000000..2e5f49a --- /dev/null +++ b/packages/tools/audio/ebu-norm/default.nix @@ -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 = [ ]; + }; +} diff --git a/packages/tools/audio/sound-gambit/default.nix b/packages/tools/audio/sound-gambit/default.nix new file mode 100644 index 0000000..4424167 --- /dev/null +++ b/packages/tools/audio/sound-gambit/default.nix @@ -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 = [ ]; + }; +}