From 2ebb31e3a4d371e1a76f8df6bc6ac26ca519ad4e Mon Sep 17 00:00:00 2001 From: EmoonX Date: Tue, 31 Dec 2024 18:03:39 -0300 Subject: [PATCH 1/3] midi: register instruments in increments of 16 libfluidsynth creates 16 banks by default for each soundfont (all repeated). So 0~15 are all copies of the 1st soundfont, 16~31 copies of the 2nd, and so on --- bottles/backend/utils/midi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bottles/backend/utils/midi.py b/bottles/backend/utils/midi.py index 86b9c5a269a..71fef384786 100644 --- a/bottles/backend/utils/midi.py +++ b/bottles/backend/utils/midi.py @@ -36,9 +36,11 @@ def __init__(self, soundfont_path: str): @classmethod def __get_vacant_id(cls) -> int: - """Get smallest 0-indexed ID currently not being used by a SoundFont.""" - n = len(cls.__active_instances) - return next(i for i in range(n + 1) if i not in cls.__active_instances) + """Get smallest 16-step ID (0, 16, 32...) not currently in use by a SoundFont.""" + i = 0 + while i in cls.__active_instances: + i += 16 + return i def __run_server(self): """Create Synth object and start server with loaded SoundFont.""" From b89291083e1dd0b1b9dedf068d78780cb3c82d14 Mon Sep 17 00:00:00 2001 From: EmoonX Date: Tue, 31 Dec 2024 18:07:33 -0300 Subject: [PATCH 2/3] chore: update `pypi-deps.yaml` --- build-aux/pypi-deps.yaml | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/build-aux/pypi-deps.yaml b/build-aux/pypi-deps.yaml index 851de3245ca..055b61a6f2a 100644 --- a/build-aux/pypi-deps.yaml +++ b/build-aux/pypi-deps.yaml @@ -5,7 +5,7 @@ build-commands: - pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} --no-build-isolation wheel PyYAML pycurl chardet requests Markdown icoextract patool pathvalidate FVS orjson pycairo PyGObject charset-normalizer - pyfluidsynth idna urllib3 certifi pefile + numpy pyfluidsynth idna urllib3 certifi pefile sources: - type: file url: https://files.pythonhosted.org/packages/f7/2f/cc09899755f94b36e7f570b9f9ca19a5fdff536e2614fd3ac1c28bb777f6/FVS-0.3.4.tar.gz @@ -22,14 +22,14 @@ sources: only-arches: - x86_64 - type: file - url: https://files.pythonhosted.org/packages/12/90/3c9ff0512038035f59d279fddeb79f5f1eccd8859f06d6163c58798b9487/certifi-2024.8.30-py3-none-any.whl - sha256: 922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8 + url: https://files.pythonhosted.org/packages/a5/32/8f6669fc4798494966bf446c8c4a162e0b5d893dff088afddf76414f70e1/certifi-2024.12.14-py3-none-any.whl + sha256: 1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56 - type: file url: https://files.pythonhosted.org/packages/38/6f/f5fbc992a329ee4e0f288c1fe0e2ad9485ed064cac731ed2fe47dcc38cbf/chardet-5.2.0-py3-none-any.whl sha256: e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970 - type: file - url: https://files.pythonhosted.org/packages/ee/fb/14d30eb4956408ee3ae09ad34299131fb383c47df355ddb428a7331cfa1e/charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl - sha256: 90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b + url: https://files.pythonhosted.org/packages/3e/a2/513f6cbe752421f16d969e32f3583762bfd583848b763913ddab8d9bfd4f/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + sha256: bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d only-arches: - x86_64 - type: file @@ -39,16 +39,21 @@ sources: url: https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl sha256: 946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3 - type: file - url: https://files.pythonhosted.org/packages/a0/6b/34e6904ac99df811a06e42d8461d47b6e0c9b86e2fe7ee84934df6e35f0d/orjson-3.10.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl - sha256: a0c6a008e91d10a2564edbb6ee5069a9e66df3fbe11c9a005cb411f441fd2c09 + url: https://files.pythonhosted.org/packages/7f/a7/c1f1d978166eb6b98ad009503e4d93a8c1962d0eb14a885c352ee0276a54/numpy-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + sha256: 5062dc1a4e32a10dc2b8b13cedd58988261416e811c1dc4dbdea4f57eea61b0d + only-arches: + - x86_64 +- type: file + url: https://files.pythonhosted.org/packages/48/90/e583d6e29937ec30a164f1d86a0439c1a2477b5aae9f55d94b37a4f5b5f0/orjson-3.10.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + sha256: 064b9dbb0217fd64a8d016a8929f2fae6f3312d55ab3036b00b1d17399ab2f3e only-arches: - x86_64 - type: file url: https://files.pythonhosted.org/packages/d3/5e/76a9d08b4b4e4583f269cb9f64de267f9aeae0dacef23307f53a14211716/pathvalidate-3.2.1-py3-none-any.whl sha256: 9a6255eb8f63c9e2135b9be97a5ce08f10230128c4ae7b3e935378b82b22c4c9 - type: file - url: https://files.pythonhosted.org/packages/0e/44/192ede8c7f935643e4c8a56545fcac6ae1b8c50a77f54b2b1c4ab9fcae49/patool-3.0.0-py2.py3-none-any.whl - sha256: 928070d5f82a776534a290a52f4758e2c0dd9cd5a633e3f63f7270c8982833b8 + url: https://files.pythonhosted.org/packages/a3/68/c1a6597c901b1f750d2fcf562181c18c0d6c284908e4df57f1029d8b8887/patool-3.1.0-py2.py3-none-any.whl + sha256: 401a918bdbf65434fd59c038bdb2c15ff7185675aedddb4494330c3e8e4fe80d - type: file url: https://files.pythonhosted.org/packages/54/16/12b82f791c7f50ddec566873d5bdd245baa1491bac11d15ffb98aecc8f8b/pefile-2024.8.26-py3-none-any.whl sha256: 76f8b485dcd3b1bb8166f1128d395fa3d87af26360c2358fb75b80019b957c6f @@ -56,8 +61,8 @@ sources: url: https://files.pythonhosted.org/packages/07/4a/42b26390181a7517718600fa7d98b951da20be982a50cd4afb3d46c2e603/pycairo-1.27.0.tar.gz sha256: 5cb21e7a00a2afcafea7f14390235be33497a2cce53a98a19389492a60628430 - type: file - url: https://files.pythonhosted.org/packages/65/80/8791945007e2295806bfd0e982e00fee023517b17d5b2d845ca64c81878c/pycurl-7.45.3-cp312-cp312-manylinux_2_28_x86_64.whl - sha256: 3d07c5daef2d0d85949e32ec254ee44232bb57febb0634194379dd14d1ff4f87 + url: https://files.pythonhosted.org/packages/2c/4c/07e7192f0d7fc549dab2784c6448ffa98412acb942a365adce4e14d1a143/pycurl-7.45.4-cp312-cp312-manylinux_2_28_x86_64.whl + sha256: 688d09ba2c6a0d4a749d192c43422839d73c40c85143c50cc65c944258fe0ba8 only-arches: - x86_64 - type: file @@ -67,8 +72,8 @@ sources: url: https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl sha256: 70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 - type: file - url: https://files.pythonhosted.org/packages/ce/d9/5f4c13cecde62396b0d3fe530a50ccea91e7dfc1ccf0e09c228841bb5ba8/urllib3-2.2.3-py3-none-any.whl - sha256: ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac + url: https://files.pythonhosted.org/packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl + sha256: 1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df - type: file - url: https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl - sha256: 2376a90c98cc337d18623527a97c31797bd02bad0033d41547043a1cbfbe448f + url: https://files.pythonhosted.org/packages/0b/2c/87f3254fd8ffd29e4c02732eee68a83a1d3c346ae39bc6822dcbcb697f2b/wheel-0.45.1-py3-none-any.whl + sha256: 708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248 From d4421518abe34d198ea64539e55af0c026d79e9c Mon Sep 17 00:00:00 2001 From: EmoonX Date: Tue, 31 Dec 2024 14:08:56 -0300 Subject: [PATCH 3/3] chore: add `ignore` pragma fallback for `import fluidsynth` --- bottles/backend/utils/midi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bottles/backend/utils/midi.py b/bottles/backend/utils/midi.py index 71fef384786..42de3952b44 100644 --- a/bottles/backend/utils/midi.py +++ b/bottles/backend/utils/midi.py @@ -1,4 +1,4 @@ -import fluidsynth +import fluidsynth # type: ignore[import-not-found] from bottles.backend.logger import Logger from bottles.backend.models.config import BottleConfig