This commit is contained in:
2026-03-02 12:31:07 -05:00
parent 3f72e52595
commit 25b3feda41
6 changed files with 883 additions and 0 deletions

687
Cargo.lock generated Normal file
View File

@@ -0,0 +1,687 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "anyhow"
version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "anymap3"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "170433209e817da6aae2c51aa0dd443009a613425dd041ebfb2492d1c4c11a25"
[[package]]
name = "array-init"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
[[package]]
name = "cfg-if"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "clap"
version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [
"atty",
"bitflags 1.3.2",
"clap_lex",
"indexmap",
"once_cell",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "dasp"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7381b67da416b639690ac77c73b86a7b5e64a29e31d1f75fb3b1102301ef355a"
dependencies = [
"dasp_envelope",
"dasp_frame",
"dasp_interpolate",
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
"dasp_signal",
"dasp_slice",
"dasp_window",
]
[[package]]
name = "dasp_envelope"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ec617ce7016f101a87fe85ed44180839744265fae73bb4aa43e7ece1b7668b6"
dependencies = [
"dasp_frame",
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
]
[[package]]
name = "dasp_frame"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a3937f5fe2135702897535c8d4a5553f8b116f76c1529088797f2eee7c5cd6"
dependencies = [
"dasp_sample",
]
[[package]]
name = "dasp_interpolate"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc975a6563bb7ca7ec0a6c784ead49983a21c24835b0bc96eea11ee407c7486"
dependencies = [
"dasp_frame",
"dasp_ring_buffer",
"dasp_sample",
]
[[package]]
name = "dasp_peak"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cf88559d79c21f3d8523d91250c397f9a15b5fc72fbb3f87fdb0a37b79915bf"
dependencies = [
"dasp_frame",
"dasp_sample",
]
[[package]]
name = "dasp_ring_buffer"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07d79e19b89618a543c4adec9c5a347fe378a19041699b3278e616e387511ea1"
[[package]]
name = "dasp_rms"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6c5dcb30b7e5014486e2822537ea2beae50b19722ffe2ed7549ab03774575aa"
dependencies = [
"dasp_frame",
"dasp_ring_buffer",
"dasp_sample",
]
[[package]]
name = "dasp_sample"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
[[package]]
name = "dasp_signal"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa1ab7d01689c6ed4eae3d38fe1cea08cba761573fbd2d592528d55b421077e7"
dependencies = [
"dasp_envelope",
"dasp_frame",
"dasp_interpolate",
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
"dasp_window",
]
[[package]]
name = "dasp_slice"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e1c7335d58e7baedafa516cb361360ff38d6f4d3f9d9d5ee2a2fc8e27178fa1"
dependencies = [
"dasp_frame",
"dasp_sample",
]
[[package]]
name = "dasp_window"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99ded7b88821d2ce4e8b842c9f1c86ac911891ab89443cc1de750cae764c5076"
dependencies = [
"dasp_sample",
]
[[package]]
name = "easyfft"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "767e39eef2ad8a3b6f1d733be3ec70364d21d437d06d4f18ea76ce08df20b75f"
dependencies = [
"array-init",
"generic_singleton",
"num-complex",
"realfft",
"rustfft",
]
[[package]]
name = "generic_singleton"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2d5de0fc83987dac514f3b910c5d08392b220efe8cf72086c660029a197bf73"
dependencies = [
"anymap3",
"lazy_static",
"parking_lot",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hound"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.182"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
[[package]]
name = "lock_api"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
"scopeguard",
]
[[package]]
name = "lv2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81300c8058a7747013c8f3e27e76eeceb8226621283d30d787b970019d8404f6"
dependencies = [
"lv2-atom",
"lv2-core",
"lv2-midi",
"lv2-units",
"lv2-urid",
"urid",
]
[[package]]
name = "lv2-atom"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "951b4e7b10349d32b7b7a26c15bd0f9cf42790b59531093d474f6964f5cba971"
dependencies = [
"lv2-core",
"lv2-sys",
"lv2-units",
"urid",
]
[[package]]
name = "lv2-core"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50100435f793b25e9fcfe89c227dc1b1ca93bbfae0f3710149263fe4ba049de"
dependencies = [
"lv2-core-derive",
"lv2-sys",
"urid",
]
[[package]]
name = "lv2-core-derive"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bf98f786ecb49030330834aaa458f84bbaf545d7084cf3dcb2fab2f03a1838b"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "lv2-midi"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad23e6bcd0036b1859992b92bbf1855f99ed648886ed9ad9a32fc4ecf2a20f74"
dependencies = [
"lv2-atom",
"lv2-sys",
"urid",
"wmidi",
]
[[package]]
name = "lv2-sys"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dd0f9e7de3649dcec348de51cbf611ab88688b97c0ce038f8c07b996b2a8e30"
[[package]]
name = "lv2-units"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b9470e6f71a96c49ce27ff15838b27f4f07300dec810313423b70ec7adaa39"
dependencies = [
"lv2-sys",
"urid",
]
[[package]]
name = "lv2-urid"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c0803444d1e66fbdbc345ef8243470979f8bab570cdaf0cada4586fc1624e68"
dependencies = [
"lv2-core",
"lv2-sys",
"urid",
]
[[package]]
name = "nnnoiseless"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "805d5964d1e7a0006a7fdced7dae75084d66d18b35f1dfe81bd76929b1f8da0c"
dependencies = [
"anyhow",
"clap",
"dasp",
"dasp_interpolate",
"dasp_ring_buffer",
"easyfft",
"hound",
"once_cell",
]
[[package]]
name = "noiseless-lv2"
version = "0.1.0"
dependencies = [
"lv2",
"nnnoiseless",
]
[[package]]
name = "num-complex"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
dependencies = [
"num-traits",
"serde",
]
[[package]]
name = "num-integer"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "os_str_bytes"
version = "6.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
[[package]]
name = "parking_lot"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-link",
]
[[package]]
name = "primal-check"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08"
dependencies = [
"num-integer",
]
[[package]]
name = "proc-macro2"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
dependencies = [
"proc-macro2",
]
[[package]]
name = "realfft"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f821338fddb99d089116342c46e9f1fbf3828dba077674613e734e01d6ea8677"
dependencies = [
"rustfft",
]
[[package]]
name = "redox_syscall"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
"bitflags 2.11.0",
]
[[package]]
name = "rustfft"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89"
dependencies = [
"num-complex",
"num-integer",
"num-traits",
"primal-check",
"strength_reduce",
"transpose",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
[[package]]
name = "smallvec"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "strength_reduce"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057"
[[package]]
name = "transpose"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e"
dependencies = [
"num-integer",
"strength_reduce",
]
[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "urid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6828b5d766e783093935fb2f23f26ffb28b7cb9313921cec67db8ca09f38a6a4"
dependencies = [
"urid-derive",
]
[[package]]
name = "urid-derive"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819eee2ef008e55b0a415ed356db7772d0ad94ae499f0043015111fc34703644"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-sys"
version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
"windows-link",
]
[[package]]
name = "wmidi"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca299959bb6d529c2bee3feb517899959da3052c4a29eea0a8ff568b825eb6cf"

12
Cargo.toml Normal file
View File

@@ -0,0 +1,12 @@
[package]
name = "noiseless-lv2"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
lv2 = "0.6"
nnnoiseless = "0.5"

43
README.md Normal file
View File

@@ -0,0 +1,43 @@
```markdown
## noiseless-lv2 - LV2 wrapper for https://github.com/jneem/nnnoiseless (VRChat's neural noise canceller)
This plugin lets you run VRChat's neural noise canceller as an LV2 plugin in Carla or any other host.
### Features:
* Real-time denoising of your mic input (or any audio stream).
* Uses the same model as VRChat's built in voice denoiser.
* Works on Linux (x86_64), Windows and MacOS.
### Installation:
**Requirements:**
Rust + cargo
LV2 headers (on Debian-based distros: sudo apt install lv2-dev)
```
git clone https://github.com/YOURNAME/noiseless-lv2.git && cd noiseless-lv2/
cargo build --release
mkdir -pv ~/.lv2/noiseless-lv2.lv2/
cp target/release/libnoiseless_lv2.so ~/.lv2/noiseless-lv2.lv2/
cp manifest.ttl denoise.ttl ~/.lv2/noiseless-lv2.lv2/
```
### Usage:
Open up Carla or another LV2 host and add the "nnnoiseless Denoise" plugin from the LV2 list.
Route your mic or noisy signal through it!
**NOTE:** The plugin expects a sample rate of **48kHz**.
If your system uses a different sample rate you'll need to resample before passing audio to the plugin.
#### Example Carla Patchbay Setup:
```
Mic -> [Noiseless-LV2] -> Output / Discord / OBS etc...
```
Enjoy!
```
Let me know if you want a logo or screenshots etc...

47
denoise.ttl Normal file
View File

@@ -0,0 +1,47 @@
# denoise.ttl
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> .
<urn:noiseless-lv2:denoise>
a lv2:Plugin, lv2:UtilityPlugin ;
doap:name "nnnoiseless Denoise" ;
doap:license <http://opensource.org/licenses/MIT> ;
lv2:port [
a lv2:InputPort, lv2:AudioPort ;
lv2:index 0 ;
lv2:symbol "input" ;
lv2:name "Input"
] , [
a lv2:OutputPort, lv2:AudioPort ;
lv2:index 1 ;
lv2:symbol "output" ;
lv2:name "Output"
] , [
a lv2:InputPort, lv2:ControlPort ;
lv2:index 2 ;
lv2:symbol "attenuation" ;
lv2:name "Denoise Strength" ;
lv2:default 100.0 ;
lv2:minimum 0.0 ;
lv2:maximum 100.0 ;
lv2:portProperty pprops:hasStrictBounds
] , [
a lv2:InputPort, lv2:ControlPort ;
lv2:index 3 ;
lv2:symbol "vad_threshold" ;
lv2:name "VAD Threshold" ;
lv2:default 0.0 ;
lv2:minimum 0.0 ;
lv2:maximum 100.0 ;
lv2:portProperty pprops:hasStrictBounds
] , [
a lv2:InputPort, lv2:ControlPort ;
lv2:index 4 ;
lv2:symbol "mix" ;
lv2:name "Dry/Wet Mix" ;
lv2:default 100.0 ;
lv2:minimum 0.0 ;
lv2:maximum 100.0 ;
lv2:portProperty pprops:hasStrictBounds
] .

7
manifest.ttl Normal file
View File

@@ -0,0 +1,7 @@
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<urn:noiseless-lv2:denoise>
a lv2:Plugin ;
lv2:binary <libnoiseless_lv2.so> ;
rdfs:seeAlso <denoise.ttl> .

87
src/lib.rs Normal file
View File

@@ -0,0 +1,87 @@
// src/lib.rs
use lv2::prelude::*;
use nnnoiseless::DenoiseState;
#[derive(PortCollection)]
struct Ports {
input: InputPort<Audio>,
output: OutputPort<Audio>,
attenuation: InputPort<Control>,
vad_threshold: InputPort<Control>,
mix: InputPort<Control>,
}
#[uri("urn:noiseless-lv2:denoise")]
struct NoiselessPlugin {
state: Box<DenoiseState<'static>>,
in_buf: Vec<f32>,
out_buf: Vec<f32>,
dry_buf: Vec<f32>,
scaled_in: Vec<f32>,
pos: usize,
last_vad: f32,
}
impl Plugin for NoiselessPlugin {
type Ports = Ports;
type InitFeatures = ();
type AudioFeatures = ();
fn new(_plugin_info: &PluginInfo, _features: &mut ()) -> Option<Self> {
Some(Self {
state: DenoiseState::new(),
in_buf: vec![0.0; DenoiseState::FRAME_SIZE],
out_buf: vec![0.0; DenoiseState::FRAME_SIZE],
dry_buf: vec![0.0; DenoiseState::FRAME_SIZE],
scaled_in: vec![0.0; DenoiseState::FRAME_SIZE],
pos: 0,
last_vad: 0.0,
})
}
fn run(&mut self, ports: &mut Ports, _features: &mut (), _sample_count: u32) {
let attenuation = (*ports.attenuation).clamp(0.0, 100.0) / 100.0;
let vad_thresh = ((*ports.vad_threshold).clamp(0.0, 100.0) / 100.0).powi(3);
let mix = (*ports.mix).clamp(0.0, 100.0) / 100.0;
let input = ports.input.iter();
let output = ports.output.iter_mut();
for (inp, out) in input.zip(output) {
self.in_buf[self.pos] = *inp;
self.dry_buf[self.pos] = *inp;
self.pos += 1;
if self.pos >= DenoiseState::FRAME_SIZE {
self.pos = 0;
for i in 0..DenoiseState::FRAME_SIZE {
self.scaled_in[i] = self.in_buf[i] * 32767.0;
}
self.last_vad = self.state.process_frame(
&mut self.out_buf,
&self.scaled_in,
);
for s in self.out_buf.iter_mut() {
*s /= 32767.0;
}
}
let denoised = self.out_buf[self.pos];
let dry = self.dry_buf[self.pos];
let gated = if self.last_vad < vad_thresh {
0.0
} else {
denoised
};
let attenuated = gated * attenuation;
*out = dry * (1.0 - mix) + attenuated * mix;
}
}
}
lv2_descriptors!(NoiselessPlugin);