diff options
author | haarp <main.haarp@gmail.com> | 2024-08-13 22:30:36 +0200 |
---|---|---|
committer | haarp <main.haarp@gmail.com> | 2024-08-13 22:30:36 +0200 |
commit | 2b8afb2f09b34834b0f35cc1ff81bf2776cdf410 (patch) | |
tree | 91c46bd5edd93eaac37633ea1bbfb1f0fe6913c4 | |
parent | Reference upstream pull request (diff) | |
download | haarp-2b8afb2f09b34834b0f35cc1ff81bf2776cdf410.tar.gz haarp-2b8afb2f09b34834b0f35cc1ff81bf2776cdf410.tar.bz2 haarp-2b8afb2f09b34834b0f35cc1ff81bf2776cdf410.zip |
Add Lyrebird
Signed-off-by: haarp <main.haarp@gmail.com>
-rw-r--r-- | media-sound/lyrebird/Manifest | 1 | ||||
-rw-r--r-- | media-sound/lyrebird/files/fix-sox.patch | 59 | ||||
-rw-r--r-- | media-sound/lyrebird/files/lyrebird-toml.patch | 60 | ||||
-rw-r--r-- | media-sound/lyrebird/lyrebird-1.2.0.ebuild | 50 |
4 files changed, 170 insertions, 0 deletions
diff --git a/media-sound/lyrebird/Manifest b/media-sound/lyrebird/Manifest new file mode 100644 index 0000000..f88d769 --- /dev/null +++ b/media-sound/lyrebird/Manifest @@ -0,0 +1 @@ +DIST lyrebird-1.2.0.tar.gz 382312 BLAKE2B 780273efacc7e5165015d79170002837fd7691bad61898e8e8c32b17aa4d9fdd979c9f7f8078dd7eef2776cc2a67168c7633ebb4bb920e3355614f438ecc990f SHA512 b9c49d14ddae1287a8002273ba69a4baea7f3ae9fdbd5d35181848eb30f92bef44823a4f8037345137db8631b00252652bc7b9badc8a6ce5c1e5298136e94407 diff --git a/media-sound/lyrebird/files/fix-sox.patch b/media-sound/lyrebird/files/fix-sox.patch new file mode 100644 index 0000000..69f0d9e --- /dev/null +++ b/media-sound/lyrebird/files/fix-sox.patch @@ -0,0 +1,59 @@ +https://github.com/lyrebird-voice-changer/lyrebird/issues/140 + +From 031f2b6b5688875b23dd62398ad4175c455fedb7 Mon Sep 17 00:00:00 2001 +From: Daniel Arena <ddan39@gmail.com> +Date: Wed, 1 Nov 2023 20:51:36 -0400 +Subject: [PATCH 1/2] fix issue with pactl command being split into arguments + incorrectly because of spaces in what should be single arguments + +--- + app/core/audio.py | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/app/core/audio.py b/app/core/audio.py +index 7b2c591..c8f6951 100644 +--- a/app/core/audio.py ++++ b/app/core/audio.py +@@ -52,13 +52,8 @@ def get_sink_name(self, tuple): + return None + + def load_pa_modules(self): +- self.null_sink = subprocess.check_call( +- 'pactl load-module module-null-sink sink_name=Lyrebird-Output node.description="Lyrebird Output"'.split(' ') +- ) +- self.remap_sink = subprocess.check_call( +- 'pactl load-module module-remap-source source_name=Lyrebird-Input master=Lyrebird-Output.monitor node.description="Lyrebird Virtual Input"'\ +- .split(' ') +- ) ++ self.null_sink = subprocess.check_call(['pactl', 'load-module', 'module-null-sink', 'sink_name=Lyrebird-Output', 'sink_properties=device.description=Lyrebird_Output']) ++ self.remap_sink = subprocess.check_call(['pactl', 'load-module', 'module-remap-source', 'source_name=Lyrebird-Input', 'master=Lyrebird-Output.monitor', 'source_properties=device.description=Lyrebird_Virtual_Input']) + + def get_pactl_modules(self): + ''' + +From 062cf68b92ca52b892c9dfaa2dd2e960f5131323 Mon Sep 17 00:00:00 2001 +From: Daniel Arena <ddan39@gmail.com> +Date: Wed, 1 Nov 2023 21:00:44 -0400 +Subject: [PATCH 2/2] Fix sox command when volume is not adjusted. When no + "type" is provided for the vol argument it defaults to amplitude. 0 amplitude + is absolute silence. To leave the volume unchanged we change it to amplitude + 1, but to keep consistent with the code above that uses dB, I am going to set + it to "0dB". + +--- + app/core/audio.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/app/core/audio.py b/app/core/audio.py +index c8f6951..4097439 100644 +--- a/app/core/audio.py ++++ b/app/core/audio.py +@@ -30,7 +30,7 @@ def run_sox(self, scale, preset, buffer=20): + command_effects += ["vol", str(preset.volume_boost) + "dB"] + else: + # Fix a bug where SoX uses last given volumne +- command_effects += ["vol", "0"] ++ command_effects += ["vol", "0dB"] + + # Downsampling + if preset.downsample_amount != None: diff --git a/media-sound/lyrebird/files/lyrebird-toml.patch b/media-sound/lyrebird/files/lyrebird-toml.patch new file mode 100644 index 0000000..108e652 --- /dev/null +++ b/media-sound/lyrebird/files/lyrebird-toml.patch @@ -0,0 +1,60 @@ +diff --git a/app/core/config.py b/app/core/config.py +index c6e0ff8..7d638dc 100644 +--- a/app/core/config.py ++++ b/app/core/config.py +@@ -1,4 +1,4 @@ +-import toml ++import tomllib + + from dataclasses import dataclass + from pathlib import Path +@@ -22,7 +22,7 @@ def load_config(): + config = {} + path = config_path + with open(path, 'r') as f: +- config = toml.loads(f.read())['config'][0] ++ config = tomllib.loads(f.read())['config'][0] + + return Configuration(buffer_size=int(config['buffer_size'])) + +diff --git a/app/core/launch.py b/app/core/launch.py +index e5ae4e2..bb84e4c 100644 +--- a/app/core/launch.py ++++ b/app/core/launch.py +@@ -21,7 +21,8 @@ class Launch: + @staticmethod + def check_py_toml(): + try: +- import toml ++ import tomllib ++ import tomli_w + return True + except ModuleNotFoundError: + return False +diff --git a/app/core/presets.py b/app/core/presets.py +index 2dfe871..f0c189f 100644 +--- a/app/core/presets.py ++++ b/app/core/presets.py +@@ -1,4 +1,5 @@ +-import toml ++import tomli_w ++import tomllib + import pathlib + from pathlib import Path + +@@ -95,7 +96,7 @@ def load_presets(): + return { "presets": [], "failed": [] } + + with open(path, 'r') as f: +- presets_data = toml.loads(f.read())['presets'] ++ presets_data = tomllib.loads(f.read())['presets'] + for item in presets_data: + # name + if "name" not in item: +@@ -171,5 +172,5 @@ def create_presets(presets=[]): + + presets = map(lambda x: x.dictionary(), presets) + presets = list(presets) +- toml_data = toml.dumps({ "presets": presets }) ++ toml_data = tomli_w.dumps({ "presets": presets }) + f.write(toml_data) diff --git a/media-sound/lyrebird/lyrebird-1.2.0.ebuild b/media-sound/lyrebird/lyrebird-1.2.0.ebuild new file mode 100644 index 0000000..95eaf07 --- /dev/null +++ b/media-sound/lyrebird/lyrebird-1.2.0.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop xdg + +DESCRIPTION="Simple and powerful voice changer for Linux" +HOMEPAGE="https://github.com/constcharptr/lyrebird" + +LICENSE="MIT" +SLOT="0" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="${HOMEPAGE}.git" +else + SRC_URI="${HOMEPAGE}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86" +fi + +RDEPEND=">=dev-lang/python-3 + dev-python/pygobject + dev-python/tomli-w + media-sound/pavucontrol + media-sound/pulseaudio + media-sound/sox[pulseaudio] + x11-libs/gtk+" + +PATCHES=( + "${FILESDIR}/${PN}-toml.patch" + "${FILESDIR}/fix-sox.patch" +) + +src_compile() { + : +} + +src_install() { + insinto "/usr/share/${PN}" + doins -r "app" || die + doins "icon.png" "app.py" + + exeinto "/usr/bin" + doexe "lyrebird" + + newicon "icon.png" "lyrebird.png" + + make_desktop_entry "${PN}" "Lyrebird" "${PN}" "AudioVideo;Audio" +} |