diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
new file mode 100644
index 0000000..8d4565b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -0,0 +1,52 @@
+name: Bug Report
+description: File a bug report
+title: "[Title here. keep it short]"
+labels: ["bug"]
+assignees:
+ - octocat
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to fill out this bug report!
+ One second before you create, search if it's already created [issues](https://github.com/thewh1teagle/vibe/issues?q=is:issue+label:bug+)
+
+ Also, you can try enable debug mode by set `debug: true` in the creation of the struct and rerun to see more logs.
+
+ - type: textarea
+ id: what-happened
+ attributes:
+ label: What happened?
+ description: Also tell us, what did you expect to happen?
+ placeholder: Tell us what you see!
+ value: "A bug happened!"
+ validations:
+ required: true
+ - type: textarea
+ id: steps-to-reproduce
+ attributes:
+ label: Steps to reproduce
+ description: Also tell us, what did you expect to happen?
+ placeholder: Tell us what you see!
+ value: |
+ 1. Step one...
+ 2. Step two...
+ validations:
+ required: true
+ - type: dropdown
+ id: browsers
+ attributes:
+ label: What OS are you seeing the problem on?
+ multiple: true
+ options:
+ - Window
+ - Linux
+ - MacOS
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: |
+ Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
+
+ render: shell
diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml
new file mode 100644
index 0000000..622eca2
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature.yml
@@ -0,0 +1,22 @@
+name: Feature request
+description: Suggest an idea for this project
+title: '[Title here. keep it short]'
+labels: ['feature']
+assignees:
+ - thewh1teagle
+body:
+ - type: markdown
+ attributes:
+ value: |
+ 💚💜 Thank you for interest. ❤️💛
+ *Please prioritize checking existing issues first*. [bugs](https://github.com/thewh1teagle/sherpa-rs/issues?q=is:issue+label:bug+)
+ I will repay with higher-quality code.
+
+ - type: textarea
+ id: describe-the-feature
+ attributes:
+ label: Describe the feature
+ description: Also tell us why you think it useful
+ placeholder: Description...
+ validations:
+ required: true
\ No newline at end of file
diff --git a/scripts/setup_cuda.ps1 b/.github/scripts/setup_cuda.ps1
similarity index 100%
rename from scripts/setup_cuda.ps1
rename to .github/scripts/setup_cuda.ps1
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 205dae5..bdbd9a2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -39,15 +39,15 @@ jobs:
options: ""
- platform: "windows-latest" # Windows Cuda
- options: '--features "cuda"'
+ options: '--features "cuda" --no-default-features'
cuda-version: "12.5.0"
- platform: "windows-latest" # Windows Cuda
- options: '--features "cuda"'
+ options: '--features "cuda" --no-default-features'
cuda-version: "11.8.0"
- platform: "windows-latest" # Windows DirectML
- options: '--features "directml"'
+ options: '--features "directml" --no-default-features'
- platform: "ubuntu-22.04" # Linux Cuda
options: '--features "cuda"'
cuda-version: "12.4.1"
@@ -58,7 +58,7 @@ jobs:
submodules: "true"
- name: Setup cuda for Windows
- run: scripts/setup_cuda.ps1
+ run: .github/scripts/setup_cuda.ps1
env:
INPUT_CUDA_VERSION: ${{ matrix.cuda-version }}
if: matrix.platform == 'windows-latest' && contains(matrix.options, 'cuda')
@@ -88,11 +88,6 @@ jobs:
run: |
cargo build ${{ matrix.options }} ${{ github.event.inputs.cargo_args }}
- - name: Modify shared libraries path
- if: contains(matrix.platform, 'ubuntu') && contains(matrix.options, 'cuda')
- run: |
- echo "LD_LIBRARY_PATH=$PWD/target/debug:$LD_LIBRARY_PATH" >> $GITHUB_ENV
-
- name: Test Whisper
# Github actions doesn't have Nvidia GPUs
if: contains(matrix.options, 'cuda') != true
diff --git a/.gitignore b/.gitignore
index 05e190a..623f251 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.idea
target/
*.onnx
*.onnx.*
@@ -6,7 +7,24 @@ tokens.txt
venv/
vits-piper*
*.wav
+*.vocab
!samples/*.wav
*.bz2
sherpa-onnx-whisper*
-*.txt
\ No newline at end of file
+sherpa-onnx-pyannote-*
+sherpa-onnx-zipformer-*
+sherpa-onnx-moonshine-*
+*.txt
+!checksum.txt
+sherpa-onnx-v*
+jniLibs
+!sys/dist.txt
+sherpa-onnx-punct*
+vits-*
+sherpa-onnx-kws-*
+.tmp/
+jniLibs/
+build/
+kokoro-en-*/
+matcha-*
+kokoro-multi-lang-v1_0/
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index 8931e17..b834818 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "sys/sherpa-onnx"]
- path = sys/sherpa-onnx
+[submodule "crates/sherpa-rs-sys/sherpa-onnx"]
+ path = crates/sherpa-rs-sys/sherpa-onnx
url = https://github.com/k2-fsa/sherpa-onnx
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100644
index 955c52b..0000000
--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "configurations": [
- {
- "name": "Mac",
- "includePath": [
- "${default}",
- "${workspaceFolder}/sys/sherpa-onnx",
- "${workspaceFolder}/sys/sherpa-onnx/build/_deps/**"
- ],
- "defines": [],
- "macFrameworkPath": [
- "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
- ],
- "compilerPath": "/usr/bin/clang",
- "cStandard": "c17",
- "cppStandard": "c++17",
- "intelliSenseMode": "macos-clang-arm64"
- }
- ],
- "version": 4
-}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 0f3165e..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "editor.formatOnSave": true,
- // "rust-analyzer.check.command": "clippy"
-}
\ No newline at end of file
diff --git a/BUILDING.md b/BUILDING.md
index c524e27..cdda9d3 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -11,10 +11,19 @@ sudo apt-get update
sudo apt-get install -y pkg-config build-essential clang cmake
```
+### Windows
+
+For convenience, I recommend installing these packages.
+Additionally, when using wget to run examples, use `wget.exe` instead.
+
+```console
+winget install llvm
+```
+
### Prepare repository
```console
-git clone https://github.com/thewh1teagle/sherpa-rs --recursive
+git clone --recursive https://github.com/thewh1teagle/sherpa-rs
cd sherpa-rs
```
@@ -32,6 +41,50 @@ cargo build --release
4. Restart your shell!!!
5. Cargo build
+### Compile with prebuild sherpa-onnx manually (For fast compilation)
+
+Note: sherpa-onnx already download and cache the sherpa-onnx binaries. You can do this manually instead.
+Note: to link sherpa-onnx libs dynamically set `SHERPA_BUILD_SHARED_LIBS` to `1`.
+Note: you should disable rust-analyzer while doing this. otherwise it will rebuild it with different environment variable on each save which will take long.... time.
+Note: on Linux when linking statically you should set this env: `RUSTFLAGS="-C relocation-model=dynamic-no-pic"`
+
+
+macOS (arm64/x86-64)
+
+```console
+wget https://github.com/k2-fsa/sherpa-onnx/releases/download/v1.10.28/sherpa-onnx-v1.10.28-osx-universal2-static.tar.bz2
+tar xf sherpa-onnx-v1.10.28-osx-universal2-static.tar.bz2
+export SHERPA_LIB_PATH="$(pwd)/sherpa-onnx-v1.10.28-osx-universal2-static"
+cargo build
+```
+
+
+
+
+Windows (x86-64)
+
+```console
+wget.exe https://github.com/k2-fsa/sherpa-onnx/releases/download/v1.10.28/sherpa-onnx-v1.10.28-win-x64-static.tar.bz2
+tar.exe xf sherpa-onnx-v1.10.28-win-x64-static.tar.bz2
+$env:SHERPA_LIB_PATH="$pwd/sherpa-onnx-v1.10.28-win-x64-static"
+cargo build
+```
+
+
+
+
+Linux (x86-64)
+
+```console
+wget https://github.com/k2-fsa/sherpa-onnx/releases/download/v1.10.28/sherpa-onnx-v1.10.28-linux-x64-static.tar.bz2
+tar xf sherpa-onnx-v1.10.28-linux-x64-static.tar.bz2
+export SHERPA_LIB_PATH="$(pwd)/sherpa-onnx-v1.10.28-linux-x64-static"
+export RUSTFLAGS="-C relocation-model=dynamic-no-pic"
+cargo build
+```
+
+
+
### Resample wav file for 16khz
```console
@@ -43,10 +96,16 @@ ffmpeg -i -ar 16000 -ac 1 -c:a pcm_s16le
```console
cd sys/sherpa-onnx
git pull origin master
+git checkout
```
### Gotachas
+On Linux you should set `RUSTFLAGS="-C relocation-model=dynamic-no-pic"`
+
+
+When using GPU such as DirectML or Cuda
+
---
When running `--example` with dynamic libraries eg. with `directml` or `cuda` you need to have the DLLs from `target` folder in PATH.
@@ -58,15 +117,154 @@ copy target\debug\examples\transcribe.exe target\debug
target\debug\transcribe.exe motivation.wav
```
+When building with cuda you should use cuda `11.x`
+In addition install `cudnn` with `sudo apt install nvidia-cudnn`
+
+
+
+
+Whisper limits
+
---
Currently whisper can transcribe only chunks of 30s max.
---
-When building with cuda you should use cuda `11.x`
-In addition install `cudnn` with `sudo apt install nvidia-cudnn`
+
+
+
+Static linking failed on Windows
+
+You can resolve it by creating `.cargo/config.toml` next to `Cargo.toml` with the following:
+
+```toml
+[target.'cfg(windows)']
+rustflags = ["-C target-feature=+crt-static"]
+```
+
+Or set the environment variable `RUSTFLAGS` to `-C target-feature=+crt-static`
+
+If it doesn't help make sure all of your dependencies also links MSVC runtime statically.
+You can inspect the build with the following:
+
+1. Set `RUSTC_LOG` to `rustc_codegen_ssa::back::link=info`
+2. Build with
+
+```console
+cargo build -vv
+```
+
+Since there's a lot of output, it's good idea to pipe it to file and check later:
+
+```console
+cargo build -vv >log.txt 2>&1
+```
+
+Look for the flags `/MD` (Meaning it links it dynamically) and `/MT` or `-MT` (Meaning it links it statically). See [MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html) and [pyannote-rs/issues/1](https://github.com/thewh1teagle/pyannote-rs/issues/1)
+
+
+
+
+Fix build issues with build flags
+
+Controlling build flags
+Please see `env::var` calls in `build.rs`.
+
+
+
+
+Cmake error: path exceeded
+
+Cmake filed with error about maxium paths exceeded. eg. `The fully qualified file name must be less than 260 characters.`
+
+1. Open PowerShell as admin and execute:
+
+```powershell
+New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
+-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
+```
+
+2. Restart PC
+
+
+
+### Shared library not found while it's in the same directly of executable
+
+Modify the shared librarie and binary files to load other shared libraries located in the same folder.
+
+```console
+patchelf --set-rpath '$ORIGIN' /path/to/binary/or/shared/library.so
+```
### Debug build
-For debug the build process of sherpa-onnx, please set `BUILD_DEBUG=1` environment variable before build.
+For debug the build process of sherpa-onnx, please set `SHERPA_BUILD_DEBUG=1` environment variable before build.
+
+## Release new version
+
+```console
+gh release create v0.4.1 --title v0.4.1 --generate-notes
+```
+
+## Calculate sha256 for dist table
+
+```console
+shasum -a 256 | tr 'a-z' 'A-Z'
+```
+
+## See debug log from build
+
+```
+SHERPA_BUILD_DEBUG=1 cargo build -vv
+```
+
+## Build for Android
+
+You must install NDK from Android Studio settings.
+
+```console
+rustup target add aarch64-linux-android
+cargo install cargo-ndk
+export NDK_HOME="$HOME/Library/Android/sdk/ndk/27.0.12077973" # ls $HOME/Library/Android/sdk/ndk/
+cargo ndk -t arm64-v8a build --release
+```
+
+## Build for IOS
+
+Install Xcode command line tools
+
+```console
+xcode-select --install
+```
+
+Install toolchain
+
+```console
+# IOS
+rustup target add aarch64-apple-ios
+# Intel chip emulator
+rustup target add x86_64-apple-ios
+# Apple chip emulator
+rustup target add aarch64-apple-ios-sim
+```
+
+Build
+
+```console
+export RUSTFLAGS="-C link-arg=-fapple-link-rtlib" # See https://github.com/bmrlab/gendam/issues/96
+cargo build --release --target aarch64-apple-ios
+```
+
+## Build for Windows arm64
+
+1. Install toolchain in Visual Studio
+
+Open Visual Studio Installer, go to Individual Components, search ARM64, select MSVC v[version] - ARM64 build tools, and click Modify.
+
+1. Build
+
+```console
+rustup target add aarch64-pc-windows-msvc
+cargo build --no-default-features --target aarch64-pc-windows-msvc --release
+```
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 1912a0b..a0befbf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 4
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
[[package]]
name = "aho-corasick"
version = "1.1.3"
@@ -11,32 +17,11 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "alsa"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37fe60779335388a88c01ac6c3be40304d1e349de3ada3b15f7808bb90fa9dce"
-dependencies = [
- "alsa-sys",
- "bitflags 2.6.0",
- "libc",
-]
-
-[[package]]
-name = "alsa-sys"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527"
-dependencies = [
- "libc",
- "pkg-config",
-]
-
[[package]]
name = "anstream"
-version = "0.6.14"
+version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
+checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -49,57 +34,52 @@ dependencies = [
[[package]]
name = "anstyle"
-version = "1.0.7"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
+checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]]
name = "anstyle-parse"
-version = "0.2.4"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
+checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
-version = "1.1.0"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
+checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
dependencies = [
- "windows-sys 0.52.0",
+ "windows-sys 0.60.2",
]
[[package]]
name = "anstyle-wincon"
-version = "3.0.3"
+version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
+checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
dependencies = [
"anstyle",
- "windows-sys 0.52.0",
+ "once_cell_polyfill",
+ "windows-sys 0.60.2",
]
[[package]]
-name = "anyhow"
-version = "1.0.86"
+name = "base64"
+version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
-
-[[package]]
-name = "autocfg"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bindgen"
-version = "0.69.4"
+version = "0.69.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
+checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags",
"cexpr",
"clang-sys",
"itertools",
@@ -118,44 +98,54 @@ dependencies = [
[[package]]
name = "bitflags"
-version = "1.3.2"
+version = "2.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
[[package]]
-name = "bitflags"
-version = "2.6.0"
+name = "block-buffer"
+version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
[[package]]
-name = "bumpalo"
-version = "3.16.0"
+name = "byteorder"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
-name = "bytes"
-version = "1.7.1"
+name = "bzip2"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
+checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
+dependencies = [
+ "bzip2-sys",
+ "libc",
+]
[[package]]
-name = "cc"
-version = "1.1.0"
+name = "bzip2-sys"
+version = "0.1.13+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8"
+checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14"
dependencies = [
- "jobserver",
- "libc",
- "once_cell",
+ "cc",
+ "pkg-config",
]
[[package]]
-name = "cesu8"
-version = "1.1.0"
+name = "cc"
+version = "1.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
+checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44"
+dependencies = [
+ "find-msvc-tools",
+ "shlex",
+]
[[package]]
name = "cexpr"
@@ -168,9 +158,9 @@ dependencies = [
[[package]]
name = "cfg-if"
-version = "1.0.0"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "clang-sys"
@@ -185,9 +175,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.9"
+version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462"
+checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931"
dependencies = [
"clap_builder",
"clap_derive",
@@ -195,9 +185,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.9"
+version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942"
+checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6"
dependencies = [
"anstream",
"anstyle",
@@ -207,9 +197,9 @@ dependencies = [
[[package]]
name = "clap_derive"
-version = "4.5.8"
+version = "4.5.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085"
+checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
dependencies = [
"heck",
"proc-macro2",
@@ -219,110 +209,109 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.7.1"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
+checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "cmake"
-version = "0.1.50"
+version = "0.1.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
+checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
dependencies = [
"cc",
]
[[package]]
name = "colorchoice"
-version = "1.0.1"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
+checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
-name = "combine"
-version = "4.6.7"
+name = "cpufeatures"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
dependencies = [
- "bytes",
- "memchr",
+ "libc",
]
[[package]]
-name = "core-foundation-sys"
-version = "0.8.6"
+name = "crc32fast"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
+dependencies = [
+ "cfg-if",
+]
[[package]]
-name = "coreaudio-rs"
-version = "0.11.3"
+name = "crypto-common"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "bitflags 1.3.2",
- "core-foundation-sys",
- "coreaudio-sys",
+ "generic-array",
+ "typenum",
]
[[package]]
-name = "coreaudio-sys"
-version = "0.2.15"
+name = "digest"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f01585027057ff5f0a5bf276174ae4c1594a2c5bde93d5f46a016d76270f5a9"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
- "bindgen",
+ "block-buffer",
+ "crypto-common",
]
[[package]]
-name = "cpal"
-version = "0.15.3"
+name = "dirs"
+version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779"
+checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
- "alsa",
- "core-foundation-sys",
- "coreaudio-rs",
- "dasp_sample",
- "jni",
- "js-sys",
- "libc",
- "mach2",
- "ndk",
- "ndk-context",
- "oboe",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "windows",
+ "dirs-sys",
]
[[package]]
-name = "dasp_sample"
-version = "0.11.0"
+name = "dirs-sys"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
+checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
+dependencies = [
+ "libc",
+ "option-ext",
+ "redox_users",
+ "windows-sys 0.48.0",
+]
[[package]]
-name = "either"
-version = "1.13.0"
+name = "displaydoc"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
[[package]]
-name = "equivalent"
-version = "1.0.1"
+name = "either"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "errno"
-version = "0.3.9"
+version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.52.0",
+ "windows-sys 0.61.0",
]
[[package]]
@@ -336,16 +325,68 @@ dependencies = [
]
[[package]]
-name = "glob"
-version = "0.3.1"
+name = "filetime"
+version = "0.2.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "libredox",
+ "windows-sys 0.60.2",
+]
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d"
+
+[[package]]
+name = "flate2"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+]
[[package]]
-name = "hashbrown"
-version = "0.14.5"
+name = "form_urlencoded"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "glob"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "heck"
@@ -355,11 +396,11 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "home"
-version = "0.5.9"
+version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
+checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
dependencies = [
- "windows-sys 0.52.0",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -369,76 +410,139 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
-name = "indenter"
-version = "0.3.3"
+name = "icu_collections"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
+checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
[[package]]
-name = "indexmap"
-version = "2.3.0"
+name = "icu_locale_core"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0"
+checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a"
dependencies = [
- "equivalent",
- "hashbrown",
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
]
[[package]]
-name = "is_terminal_polyfill"
-version = "1.70.0"
+name = "icu_normalizer"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
+checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
[[package]]
-name = "itertools"
-version = "0.12.1"
+name = "icu_normalizer_data"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
+checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
+
+[[package]]
+name = "icu_properties"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
dependencies = [
- "either",
+ "displaydoc",
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "potential_utf",
+ "zerotrie",
+ "zerovec",
]
[[package]]
-name = "jni"
-version = "0.21.1"
+name = "icu_properties_data"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
+
+[[package]]
+name = "icu_provider"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
+checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af"
dependencies = [
- "cesu8",
- "cfg-if",
- "combine",
- "jni-sys",
- "log",
- "thiserror",
- "walkdir",
- "windows-sys 0.45.0",
+ "displaydoc",
+ "icu_locale_core",
+ "stable_deref_trait",
+ "tinystr",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
]
[[package]]
-name = "jni-sys"
-version = "0.3.0"
+name = "idna"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
[[package]]
-name = "jobserver"
-version = "0.1.32"
+name = "idna_adapter"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
+checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
dependencies = [
- "libc",
+ "icu_normalizer",
+ "icu_properties",
]
[[package]]
-name = "js-sys"
-version = "0.3.69"
+name = "indenter"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
+checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+
+[[package]]
+name = "itertools"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
- "wasm-bindgen",
+ "either",
]
+[[package]]
+name = "itoa"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+
[[package]]
name = "lazy_static"
version = "1.5.0"
@@ -453,80 +557,74 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
-version = "0.2.155"
+version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
+checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
[[package]]
name = "libloading"
-version = "0.8.4"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
+checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
dependencies = [
"cfg-if",
- "windows-targets 0.52.6",
+ "windows-targets 0.53.3",
]
[[package]]
-name = "linux-raw-sys"
-version = "0.4.14"
+name = "libredox"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
+checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
+dependencies = [
+ "bitflags",
+ "libc",
+ "redox_syscall",
+]
[[package]]
-name = "log"
-version = "0.4.22"
+name = "linux-raw-sys"
+version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
-name = "mach2"
-version = "0.4.2"
+name = "linux-raw-sys"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709"
-dependencies = [
- "libc",
-]
+checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
[[package]]
-name = "memchr"
-version = "2.7.4"
+name = "litemap"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
[[package]]
-name = "minimal-lexical"
-version = "0.2.1"
+name = "log"
+version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
[[package]]
-name = "ndk"
-version = "0.8.0"
+name = "memchr"
+version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
-dependencies = [
- "bitflags 2.6.0",
- "jni-sys",
- "log",
- "ndk-sys",
- "num_enum",
- "thiserror",
-]
+checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
-name = "ndk-context"
-version = "0.1.1"
+name = "minimal-lexical"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
-name = "ndk-sys"
-version = "0.5.0+25.2.9519653"
+name = "miniz_oxide"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
- "jni-sys",
+ "adler2",
]
[[package]]
@@ -540,123 +638,103 @@ dependencies = [
]
[[package]]
-name = "num-derive"
-version = "0.4.2"
+name = "once_cell"
+version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
-name = "num-traits"
-version = "0.2.19"
+name = "once_cell_polyfill"
+version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
-dependencies = [
- "autocfg",
-]
+checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
-name = "num_enum"
-version = "0.7.3"
+name = "option-ext"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179"
-dependencies = [
- "num_enum_derive",
-]
+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
-name = "num_enum_derive"
-version = "0.7.3"
+name = "percent-encoding"
+version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
-dependencies = [
- "proc-macro-crate",
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
-name = "oboe"
-version = "0.6.1"
+name = "pin-project-lite"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb"
-dependencies = [
- "jni",
- "ndk",
- "ndk-context",
- "num-derive",
- "num-traits",
- "oboe-sys",
-]
+checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
-name = "oboe-sys"
-version = "0.6.1"
+name = "pkg-config"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8bb09a4a2b1d668170cfe0a7d5bc103f8999fb316c98099b6a9939c9f2e79d"
-dependencies = [
- "cc",
-]
+checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
-name = "once_cell"
-version = "1.19.0"
+name = "potential_utf"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-
-[[package]]
-name = "pkg-config"
-version = "0.3.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
+checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
+dependencies = [
+ "zerovec",
+]
[[package]]
name = "prettyplease"
-version = "0.2.20"
+version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
"syn",
]
[[package]]
-name = "proc-macro-crate"
-version = "3.1.0"
+name = "proc-macro2"
+version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
+checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
- "toml_edit",
+ "unicode-ident",
]
[[package]]
-name = "proc-macro2"
-version = "1.0.86"
+name = "quote"
+version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
- "unicode-ident",
+ "proc-macro2",
]
[[package]]
-name = "quote"
-version = "1.0.36"
+name = "redox_syscall"
+version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
dependencies = [
- "proc-macro2",
+ "bitflags",
+]
+
+[[package]]
+name = "redox_users"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
+dependencies = [
+ "getrandom",
+ "libredox",
+ "thiserror",
]
[[package]]
name = "regex"
-version = "1.10.5"
+version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
+checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
dependencies = [
"aho-corasick",
"memchr",
@@ -666,9 +744,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.7"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
+checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
dependencies = [
"aho-corasick",
"memchr",
@@ -677,9 +755,23 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.4"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
+checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
[[package]]
name = "rustc-hash"
@@ -689,47 +781,152 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
-version = "0.38.34"
+version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags",
"errno",
"libc",
- "linux-raw-sys",
- "windows-sys 0.52.0",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "rustix"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.11.0",
+ "windows-sys 0.61.0",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc"
+dependencies = [
+ "log",
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
]
[[package]]
-name = "same-file"
-version = "1.0.6"
+name = "rustls-pki-types"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79"
dependencies = [
- "winapi-util",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a37813727b78798e53c2bec3f5e8fe12a6d6f8389bf9ca7802add4c9905ad8"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
+
+[[package]]
+name = "serde"
+version = "1.0.223"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a505d71960adde88e293da5cb5eda57093379f64e61cf77bf0e6a63af07a7bac"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.223"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20f57cbd357666aa7b3ac84a90b4ea328f1d4ddb6772b430caa5d9e1309bb9e9"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.223"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d428d07faf17e306e699ec1e91996e5a165ba5d6bce5b5155173e91a8a01a56"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.145"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+dependencies = [
+ "itoa",
+ "memchr",
+ "ryu",
+ "serde",
+ "serde_core",
+]
+
+[[package]]
+name = "sha2"
+version = "0.10.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
]
[[package]]
name = "sherpa-rs"
-version = "0.1.8-beta.3"
+version = "0.6.6"
dependencies = [
- "anyhow",
"clap",
- "cpal",
"eyre",
"hound",
- "log",
- "num-traits",
"sherpa-rs-sys",
+ "tracing",
]
[[package]]
name = "sherpa-rs-sys"
-version = "0.1.8-beta.3"
+version = "0.6.6"
dependencies = [
"bindgen",
+ "bzip2",
"cmake",
+ "dirs",
+ "flate2",
"glob",
+ "lazy_static",
+ "serde",
+ "serde_json",
+ "sha2",
+ "tar",
+ "ureq",
]
[[package]]
@@ -738,37 +935,88 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+[[package]]
+name = "smallvec"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+
+[[package]]
+name = "socks"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b"
+dependencies = [
+ "byteorder",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
[[package]]
name = "syn"
-version = "2.0.70"
+version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16"
+checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tar"
+version = "0.4.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a"
+dependencies = [
+ "filetime",
+ "libc",
+ "xattr",
+]
+
[[package]]
name = "thiserror"
-version = "1.0.63"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.63"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
@@ -776,118 +1024,132 @@ dependencies = [
]
[[package]]
-name = "toml_datetime"
-version = "0.6.8"
+name = "tinystr"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
+checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
[[package]]
-name = "toml_edit"
-version = "0.21.1"
+name = "tracing"
+version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
+checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
- "indexmap",
- "toml_datetime",
- "winnow",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
]
[[package]]
-name = "unicode-ident"
-version = "1.0.12"
+name = "tracing-attributes"
+version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
[[package]]
-name = "utf8parse"
-version = "0.2.2"
+name = "tracing-core"
+version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
+dependencies = [
+ "once_cell",
+]
[[package]]
-name = "walkdir"
-version = "2.5.0"
+name = "typenum"
+version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
-dependencies = [
- "same-file",
- "winapi-util",
-]
+checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
[[package]]
-name = "wasm-bindgen"
-version = "0.2.92"
+name = "unicode-ident"
+version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
+checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.92"
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "ureq"
+version = "2.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
+checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d"
dependencies = [
- "bumpalo",
+ "base64",
"log",
"once_cell",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
+ "rustls",
+ "rustls-pki-types",
+ "socks",
+ "url",
+ "webpki-roots 0.26.11",
]
[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.42"
+name = "url"
+version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
+checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+ "serde",
]
[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.92"
+name = "utf8_iter"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.92"
+name = "utf8parse"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "version_check"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.92"
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
-name = "web-sys"
-version = "0.3.69"
+name = "webpki-roots"
+version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
+checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "js-sys",
- "wasm-bindgen",
+ "webpki-roots 1.0.2",
+]
+
+[[package]]
+name = "webpki-roots"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"
+dependencies = [
+ "rustls-pki-types",
]
[[package]]
@@ -899,78 +1161,101 @@ dependencies = [
"either",
"home",
"once_cell",
- "rustix",
+ "rustix 0.38.44",
]
[[package]]
-name = "winapi-util"
-version = "0.1.9"
+name = "winapi"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
- "windows-sys 0.52.0",
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
]
[[package]]
-name = "windows"
-version = "0.54.0"
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[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.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
+
+[[package]]
+name = "windows-link"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
- "windows-core",
- "windows-targets 0.52.6",
+ "windows-targets 0.48.5",
]
[[package]]
-name = "windows-core"
-version = "0.54.0"
+name = "windows-sys"
+version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-result",
"windows-targets 0.52.6",
]
[[package]]
-name = "windows-result"
-version = "0.1.2"
+name = "windows-sys"
+version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
-version = "0.45.0"
+version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
- "windows-targets 0.42.2",
+ "windows-targets 0.53.3",
]
[[package]]
name = "windows-sys"
-version = "0.52.0"
+version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa"
dependencies = [
- "windows-targets 0.52.6",
+ "windows-link 0.2.0",
]
[[package]]
name = "windows-targets"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
]
[[package]]
@@ -982,18 +1267,35 @@ dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm",
+ "windows_i686_gnullvm 0.52.6",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
+[[package]]
+name = "windows-targets"
+version = "0.53.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
+dependencies = [
+ "windows-link 0.1.3",
+ "windows_aarch64_gnullvm 0.53.0",
+ "windows_aarch64_msvc 0.53.0",
+ "windows_i686_gnu 0.53.0",
+ "windows_i686_gnullvm 0.53.0",
+ "windows_i686_msvc 0.53.0",
+ "windows_x86_64_gnu 0.53.0",
+ "windows_x86_64_gnullvm 0.53.0",
+ "windows_x86_64_msvc 0.53.0",
+]
+
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
@@ -1001,11 +1303,17 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+
[[package]]
name = "windows_aarch64_msvc"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
@@ -1013,11 +1321,17 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+
[[package]]
name = "windows_i686_gnu"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
@@ -1025,17 +1339,29 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
+
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+
[[package]]
name = "windows_i686_msvc"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
@@ -1043,11 +1369,17 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+
[[package]]
name = "windows_x86_64_gnu"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
@@ -1055,11 +1387,17 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
@@ -1067,11 +1405,17 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+
[[package]]
name = "windows_x86_64_msvc"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
@@ -1080,10 +1424,107 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
-name = "winnow"
-version = "0.5.40"
+name = "windows_x86_64_msvc"
+version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
+checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
+
+[[package]]
+name = "writeable"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
+
+[[package]]
+name = "xattr"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909"
dependencies = [
- "memchr",
+ "libc",
+ "rustix 1.1.2",
+]
+
+[[package]]
+name = "yoke"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
+
+[[package]]
+name = "zerotrie"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
]
diff --git a/Cargo.toml b/Cargo.toml
index c7b50e2..c4a4556 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,42 +1,4 @@
-[package]
-name = "sherpa-rs"
-version = "0.1.8-beta.3"
-edition = "2021"
-authors = ["thewh1teagle"]
-license = "MIT"
-repository = "https://github.com/thewh1teagle/sherpa-rs"
-description = "Rust bindings to https://github.com/k2-fsa/sherpa-onnx"
-readme = "README.md"
-keywords = [
- "audio",
- "embeddings",
- "speech-recognition",
- "sherpa",
- "diarization",
-]
-
-[dependencies]
-eyre = "0.6.12"
-hound = { version = "3.5.1" }
-log = "0.4.22"
-num-traits = "0.2.19"
-sherpa-rs-sys = { path = "sys", version = "0.1.8-beta.1" }
-
-[dev-dependencies]
-clap = { version = "4.5.8", features = ["derive"] }
-cpal = "0.15.3"
-anyhow = "*"
-
[workspace]
-members = ["sys"]
-
-[features]
-default = []
-tts = ["sherpa-rs-sys/tts"]
-cuda = ["sherpa-rs-sys/cuda"]
-directml = ["sherpa-rs-sys/directml"]
-
-
-[[example]]
-name = "tts"
-required-features = ["tts"]
+resolver = "2"
+members = ["crates/sherpa-rs", "crates/sherpa-rs-sys"]
+exclude = ["examples/tauri-app/src-tauri"]
diff --git a/README.md b/README.md
index b609d30..a6bd2b9 100644
--- a/README.md
+++ b/README.md
@@ -9,15 +9,21 @@ Rust bindings to [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx)
- Spoken language detection
- Speaker embedding (labeling)
+- Speaker diarization
- Speech to text
- Text to speech
+- Text punctuation
- Voice activity detection
+- Audio tagging
+- Keyword spotting
## Supported Platforms
- Windows
- Linux
- macOS
+- Android
+- IOS
## Install
@@ -34,11 +40,20 @@ Please see [BUILDING.md](BUILDING.md).
- `cuda`: enable CUDA support
- `directml`: enable DirectML support
- `tts`: enable TTS
+- `download-binaries`: use prebuilt sherpa-onnx libraries for faster builds. cached.
+- `static`: use static sherpa-onnx libraries and link them statically.
+- `sys`: expose raw c bindings (sys crate)
-## Docs
+## Documentation
-See [sherpa/intro.html](https://k2-fsa.github.io/sherpa/intro.html)
+For the documentation on `sherpa_rs`, please visit [docs.rs/sherpa_rs](https://docs.rs/sherpa-rs/latest/sherpa_rs).
+
+For documentation on `sherpa-onnx`, refer to the [sherpa/intro.html](https://k2-fsa.github.io/sherpa/intro.html).
## Examples
See [examples](examples)
+
+## Models
+
+All pretrained models available at [sherpa/onnx/pretrained_models](https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html)
diff --git a/sys/.gitignore b/crates/sherpa-rs-sys/.gitignore
similarity index 100%
rename from sys/.gitignore
rename to crates/sherpa-rs-sys/.gitignore
diff --git a/sys/Cargo.toml b/crates/sherpa-rs-sys/Cargo.toml
similarity index 52%
rename from sys/Cargo.toml
rename to crates/sherpa-rs-sys/Cargo.toml
index c517f0c..08b4877 100644
--- a/sys/Cargo.toml
+++ b/crates/sherpa-rs-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sherpa-rs-sys"
-version = "0.1.8-beta.3"
+version = "0.6.6"
edition = "2021"
authors = ["thewh1teagle"]
homepage = "https://github.com/thewh1teagle/sherpa-rs"
@@ -27,18 +27,46 @@ include = [
"sherpa-onnx/CMakeLists.txt",
"sherpa-onnx/LICENSE",
"sherpa-onnx/.clang*",
- "src/*.rs",
+ "src/",
"build.rs",
"wrapper.h",
+ "dist.json",
+ "checksum.txt",
]
[build-dependencies]
bindgen = "0.69.4"
cmake = "0.1"
glob = "0.3.1"
+lazy_static = { version = "1.5.0" }
+
+# Download binaries
+ureq = { version = "2.1", optional = true, default-features = false, features = [
+ "tls",
+ "socks-proxy",
+] }
+tar = { version = "0.4", optional = true }
+bzip2 = { version = "0.4.4", optional = true, features = ["static"] }
+flate2 = { version = "1.0", optional = true }
+sha2 = { version = "0.10", optional = true }
+dirs = { version = "5.0.1", optional = true }
+serde_json = { version = "1.0.134", optional = true }
+serde = { version = "1.0.216", features = ["derive"], optional = true }
+
[features]
-default = []
+default = ["download-binaries"]
+download-binaries = [
+ "dep:ureq",
+ "dep:tar",
+ "dep:bzip2",
+ "dep:flate2",
+ "dep:sha2",
+ "dep:dirs",
+ "dep:serde_json",
+ "dep:serde",
+]
+static = []
tts = []
cuda = []
directml = []
diff --git a/crates/sherpa-rs-sys/build.rs b/crates/sherpa-rs-sys/build.rs
new file mode 100644
index 0000000..aafc0e5
--- /dev/null
+++ b/crates/sherpa-rs-sys/build.rs
@@ -0,0 +1,559 @@
+use cmake::Config;
+use glob::glob;
+use std::collections::HashMap;
+use std::env;
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+#[path = "src/download_binaries.rs"]
+#[cfg(feature = "download-binaries")]
+mod download_binaries;
+
+macro_rules! debug_log {
+ ($($arg:tt)*) => {
+ // SHERPA_BUILD_DEBUG=1 cargo build
+ if std::env::var("SHERPA_BUILD_DEBUG").unwrap_or_default() == "1" {
+ println!("cargo:warning=[DEBUG] {}", format!($($arg)*));
+ }
+ };
+}
+
+lazy_static::lazy_static! {
+ // clang --print-targets
+ // rustc --print target-list
+ static ref RUST_CLANG_TARGET_MAP: HashMap = {
+ let mut m = HashMap::new();
+ m.insert("aarch64-linux-android".to_string(), "armv8-linux-androideabi".to_string());
+ m.insert("aarch64-apple-ios-sim".to_string(), "arm64-apple-ios-simulator".to_string());
+ m
+ };
+}
+
+fn link_lib(lib: &str, is_dynamic: bool) {
+ let lib_kind = if is_dynamic { "dylib" } else { "static" };
+ debug_log!("cargo:rustc-link-lib={}={}", lib_kind, lib);
+ println!("cargo:rustc-link-lib={}={}", lib_kind, lib);
+}
+
+fn link_framework(framework: &str) {
+ debug_log!("cargo:rustc-link-lib=framework={}", framework);
+ println!("cargo:rustc-link-lib=framework={}", framework);
+}
+
+fn add_search_path>(path: P) {
+ debug_log!("cargo:rustc-link-search={}", path.as_ref().display());
+ println!("cargo:rustc-link-search={}", path.as_ref().display());
+}
+
+fn copy_file(src: PathBuf, dst: PathBuf) {
+ if let Err(err) = std::fs::hard_link(&src, &dst) {
+ debug_log!("Failed to hardlink {:?}. fallback to copy.", err);
+ fs::copy(&src, &dst)
+ .unwrap_or_else(|_| panic!("Failed to copy {} to {}", src.display(), dst.display()));
+ }
+}
+
+fn get_cargo_target_dir() -> Result> {
+ let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR")?);
+ let profile = std::env::var("PROFILE")?;
+ let mut target_dir = None;
+ let mut sub_path = out_dir.as_path();
+ while let Some(parent) = sub_path.parent() {
+ if parent.ends_with(&profile) {
+ target_dir = Some(parent);
+ break;
+ }
+ sub_path = parent;
+ }
+ let target_dir = target_dir.ok_or("not found")?;
+ Ok(target_dir.to_path_buf())
+}
+
+fn delete_folder(src: &Path) -> std::io::Result<()> {
+ if src.exists() {
+ fs::remove_dir_all(src)?;
+ }
+ Ok(())
+}
+
+fn copy_folder(src: &Path, dst: &Path) {
+ std::fs::create_dir_all(dst).expect("Failed to create dst directory");
+ if cfg!(windows) {
+ std::process::Command::new("robocopy.exe")
+ .arg("/e")
+ .arg(src)
+ .arg(dst)
+ .status()
+ .expect("Failed to execute robocopy command");
+ } else {
+ std::process::Command::new("cp")
+ .arg("-rf")
+ .arg(src)
+ .arg(dst.parent().unwrap())
+ .status()
+ .expect("Failed to execute cp command");
+ }
+}
+
+fn extract_lib_names(out_dir: &Path, is_dynamic: bool, target_os: &str) -> Vec {
+ let lib_pattern = if target_os == "windows" {
+ "*.lib"
+ } else if target_os == "macos" {
+ if is_dynamic {
+ "*.dylib"
+ } else {
+ "*.a"
+ }
+ } else if
+ // Linux, Android
+ is_dynamic {
+ "*.so"
+ } else {
+ "*.a"
+ };
+
+ let libs_dir = out_dir.join("lib");
+ let pattern = libs_dir.join(lib_pattern);
+ debug_log!("Extract libs {}", pattern.display());
+
+ let mut lib_names: Vec = Vec::new();
+
+ // Process the libraries based on the pattern
+ for entry in glob(pattern.to_str().unwrap()).unwrap() {
+ match entry {
+ Ok(path) => {
+ let stem = path.file_stem().unwrap();
+ let stem_str = stem.to_str().unwrap();
+
+ // Remove the "lib" prefix if present
+ let lib_name = if stem_str.starts_with("lib") {
+ stem_str.strip_prefix("lib").unwrap_or(stem_str)
+ } else {
+ stem_str
+ };
+ lib_names.push(lib_name.to_string());
+ }
+ Err(e) => println!("cargo:warning=error={}", e),
+ }
+ }
+ lib_names
+}
+
+fn extract_lib_assets(out_dir: &Path, target_os: &str) -> Vec {
+ let shared_lib_pattern = if target_os == "windows" {
+ "*.dll"
+ } else if target_os == "macos" {
+ "*.dylib"
+ } else {
+ "*.so"
+ };
+
+ let libs_dir = out_dir.join("lib");
+ let pattern = libs_dir.join(shared_lib_pattern);
+ debug_log!("Extract lib assets {}", pattern.display());
+ let mut files = Vec::new();
+
+ for entry in glob(pattern.to_str().unwrap()).unwrap() {
+ match entry {
+ Ok(path) => {
+ files.push(path);
+ }
+ Err(e) => eprintln!("cargo:warning=error={}", e),
+ }
+ }
+
+ files
+}
+
+fn macos_link_search_path() -> Option {
+ let output = Command::new("clang")
+ .arg("--print-search-dirs")
+ .output()
+ .ok()?;
+ if !output.status.success() {
+ println!(
+ "failed to run 'clang --print-search-dirs', continuing without a link search path"
+ );
+ return None;
+ }
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ for line in stdout.lines() {
+ if line.contains("libraries: =") {
+ let path = line.split('=').nth(1)?;
+ return Some(format!("{}/lib/darwin", path));
+ }
+ }
+
+ println!("failed to determine link search path, continuing without it");
+ None
+}
+
+fn rerun_on_env_changes(vars: &[&str]) {
+ for env in vars {
+ println!("cargo::rerun-if-env-changed={}", env);
+ }
+}
+
+fn rerun_if_changed(vars: &[&str]) {
+ for var in vars {
+ println!("cargo:rerun-if-changed={}", var);
+ }
+}
+
+fn main() {
+ rerun_if_changed(&["wrapper.h", "dist.json", "checksum.txt", "./sherpa-onnx"]);
+ rerun_on_env_changes(&[
+ "SHERPA_BUILD_SHARED_LIBS",
+ "CMAKE_BUILD_PARALLEL_LEVEL",
+ "CMAKE_VERBOSE",
+ "SHERPA_LIB_PATH",
+ "SHERPA_STATIC_CRT",
+ "SHERPA_LIB_PROFILE",
+ "BUILD_DEBUG",
+ ]);
+
+ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
+ debug_log!("target_os = {}", target_os);
+
+ // Show warning if static enabled on Linux without RUSTFLAGS
+ #[cfg(all(
+ feature = "static",
+ target_os = "linux",
+ target_arch = "x86_64",
+ feature = "download-binaries"
+ ))]
+ {
+ if !env::var("RUSTFLAGS")
+ .unwrap_or_default()
+ .contains("relocation-model=dynamic-no-pic")
+ {
+ panic!(
+ "cargo:warning=\
+ Please enable the following environment variable when static feature enabled on Linux: RUSTFLAGS=\"-C relocation-model=dynamic-no-pic\""
+ )
+ }
+ }
+
+ let target = env::var("TARGET").unwrap();
+ let is_mobile = target.contains("android") || target.contains("ios");
+ debug_log!("TARGET: {:?}", target);
+ let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
+
+ let target_dir = get_cargo_target_dir().unwrap();
+ let sherpa_dst = out_dir.join("sherpa-onnx");
+ let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("Failed to get CARGO_MANIFEST_DIR");
+ let sherpa_src = Path::new(&manifest_dir).join("sherpa-onnx");
+
+ // Dynamic by default
+ #[allow(unused_mut)]
+ let mut is_dynamic = if cfg!(feature = "static") {
+ false // Static feature is enabled
+ } else if cfg!(any(feature = "directml", feature = "cuda")) {
+ true // DirectML or CUDA feature is enabled
+ } else if let Ok(val) = env::var("SHERPA_BUILD_SHARED_LIBS") {
+ val == "1" // Environment variable determines dynamic state
+ } else {
+ true // Default to true
+ };
+
+ debug_log!("TARGET: {}", target);
+ debug_log!("CARGO_MANIFEST_DIR: {}", manifest_dir);
+ debug_log!("TARGET_DIR: {}", target_dir.display());
+ debug_log!("OUT_DIR: {}", out_dir.display());
+
+ // Prepare sherpa-onnx source
+ if !sherpa_dst.exists() {
+ debug_log!("Copy {} to {}", sherpa_src.display(), sherpa_dst.display());
+ delete_folder(&sherpa_src.join("scripts")).unwrap();
+ copy_folder(&sherpa_src, &sherpa_dst);
+ }
+ // Speed up build
+ env::set_var(
+ "CMAKE_BUILD_PARALLEL_LEVEL",
+ std::thread::available_parallelism()
+ .unwrap()
+ .get()
+ .to_string(),
+ );
+
+ // Bindings
+ if env::var("SHERPA_SKIP_GENERATE_BINDINGS").is_ok() {
+ debug_log!("Skip generate bindings");
+ std::fs::copy("src/bindings.rs", out_dir.join("bindings.rs"))
+ .expect("Failed to copy bindings.rs");
+ } else {
+ let mut bindings_builder = bindgen::Builder::default()
+ .header("wrapper.h")
+ .clang_arg(format!("-I{}", sherpa_dst.display()))
+ .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));
+
+ if let Some(clang_target) = RUST_CLANG_TARGET_MAP.get(&target) {
+ // Explicitly set target in case we are cross-compiling.
+ // See https://github.com/rust-lang/rust-bindgen/issues/1780 for context.
+ debug_log!("mapped clang target: {}", clang_target);
+ bindings_builder = bindings_builder.clang_arg(format!("--target={}", clang_target));
+ }
+
+ debug_log!("Generating bindings...");
+ let bindings_builder = bindings_builder
+ .generate()
+ .expect("Failed to generate bindings");
+
+ // Write the generated bindings to an output file
+ let bindings_path = out_dir.join("bindings.rs");
+
+ debug_log!("Writing bindings to {:?}", bindings_path);
+ bindings_builder
+ .write_to_file(bindings_path)
+ .expect("Failed to write bindings");
+ debug_log!("Bindings Created");
+ }
+
+ // Skip build when docs.rs website built this crate
+ // Only build the bindings.rs file.
+ if env::var("DOCS_RS") == Ok("1".to_string()) {
+ println!("cargo:warning=Detected DOCS_RS. Skipping build / fetch.");
+ return;
+ }
+
+ #[cfg(feature = "download-binaries")]
+ let mut optional_dist: Option = None;
+
+ let mut sherpa_libs: Vec = Vec::new();
+
+ #[cfg(feature = "download-binaries")]
+ {
+ // Download libraries, cache and set SHERPA_LIB_PATH
+ use download_binaries::{extract_tbz, fetch_file, get_cache_dir, sha256, DIST_TABLE};
+ debug_log!("Download binaries enabled");
+ // debug_log!("Dist table: {:?}", DIST_TABLE.targets);
+ // Try download sherpa libs and set SHERPA_LIB_PATH
+ if let Some(dist) = DIST_TABLE.get(&target, &mut is_dynamic) {
+ debug_log!("is_dynamic after: {}", is_dynamic);
+ optional_dist = Some(dist.clone());
+ let mut cache_dir = if let Some(dir) = get_cache_dir() {
+ dir.join(target.clone()).join(&dist.checksum)
+ } else {
+ println!("cargo:warning=Could not determine cache directory, using OUT_DIR");
+ PathBuf::from(env::var("OUT_DIR").unwrap())
+ };
+ if fs::create_dir_all(&cache_dir).is_err() {
+ println!("cargo:warning=Could not create cache directory, using OUT_DIR");
+ cache_dir = env::var("OUT_DIR").unwrap().into();
+ }
+ debug_log!("Cache dir: {}", cache_dir.display());
+
+ let lib_dir = cache_dir.join(&dist.name);
+
+ // if is mobile then check if cache dir not empty
+ // Sherpa uses special directory structure for mobile
+ let cache_dir_empty = cache_dir
+ .read_dir()
+ .map(|mut entries| entries.next().is_none())
+ .unwrap_or(true);
+
+ if (is_mobile && cache_dir_empty) || (!is_mobile && !lib_dir.exists()) {
+ let downloaded_file = fetch_file(&dist.url);
+ let hash = sha256(&downloaded_file);
+ // verify checksum
+ assert_eq!(
+ hash, dist.checksum,
+ "Checksum mismatch: {} != {}",
+ hash, dist.checksum
+ );
+
+ extract_tbz(&downloaded_file, &cache_dir);
+ } else {
+ debug_log!("Skip fetch file. Using cache from {}", lib_dir.display());
+ }
+
+ // In Android, we need to set SHERPA_LIB_PATH to the cache directory sincie it has jniLibs
+ if is_mobile {
+ env::set_var("SHERPA_LIB_PATH", &cache_dir);
+ } else {
+ env::set_var("SHERPA_LIB_PATH", cache_dir.join(&dist.name));
+ }
+
+ debug_log!("dist libs: {:?}", dist.libs);
+ if let Some(libs) = dist.libs {
+ for lib in libs.iter() {
+ let lib_path = cache_dir.join(lib);
+ let lib_parent = lib_path.parent().unwrap();
+ add_search_path(lib_parent);
+ }
+
+ sherpa_libs = libs
+ .iter()
+ .map(download_binaries::extract_lib_name)
+ .collect();
+ } else {
+ sherpa_libs = extract_lib_names(&lib_dir, is_dynamic, &target_os);
+ }
+ } else {
+ println!("cargo:warning=Failed to download binaries. fallback to manual build.");
+ }
+ }
+
+ if let Ok(sherpa_lib_path) = env::var("SHERPA_LIB_PATH") {
+ // Skip build if SHERPA_LIB_PATH specified
+ debug_log!("Skpping build with Cmake...");
+ debug_log!("SHERPA_LIB_PATH: {}", sherpa_lib_path);
+ add_search_path(Path::new(&sherpa_lib_path).join("lib"));
+ if sherpa_libs.is_empty() {
+ sherpa_libs = extract_lib_names(Path::new(&sherpa_lib_path), is_dynamic, &target_os);
+ }
+ } else {
+ // Build with CMake
+ let profile = env::var("SHERPA_LIB_PROFILE").unwrap_or("Release".to_string());
+ let static_crt = env::var("SHERPA_STATIC_CRT")
+ .map(|v| v == "1")
+ .unwrap_or(true);
+ let mut config = Config::new(&sherpa_dst);
+
+ config.define("CMAKE_POLICY_VERSION_MINIMUM", "3.5");
+
+ config
+ .define("SHERPA_ONNX_ENABLE_C_API", "ON")
+ .define("SHERPA_ONNX_ENABLE_BINARY", "OFF")
+ .define("BUILD_SHARED_LIBS", if is_dynamic { "ON" } else { "OFF" })
+ .define("SHERPA_ONNX_ENABLE_WEBSOCKET", "OFF")
+ .define("SHERPA_ONNX_ENABLE_TTS", "OFF")
+ .define("SHERPA_ONNX_BUILD_C_API_EXAMPLES", "OFF");
+
+ if target_os == "windows" {
+ config.static_crt(static_crt);
+ }
+
+ // TTS
+ if cfg!(feature = "tts") {
+ config.define("SHERPA_ONNX_ENABLE_TTS", "ON");
+ }
+
+ // Cuda https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
+ if cfg!(feature = "cuda") {
+ debug_log!("Cuda enabled");
+ config.define("SHERPA_ONNX_ENABLE_GPU", "ON");
+ config.define("BUILD_SHARED_LIBS", "ON");
+ }
+
+ // DirectML https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html
+ if cfg!(feature = "directml") {
+ debug_log!("DirectML enabled");
+ config.define("SHERPA_ONNX_ENABLE_DIRECTML", "ON");
+ config.define("BUILD_SHARED_LIBS", "ON");
+ }
+
+ if target_os == "windows" || target_os == "linux" || target == "android" {
+ config.define("SHERPA_ONNX_ENABLE_PORTAUDIO", "ON");
+ }
+
+ // General
+ config
+ .profile(&profile)
+ .very_verbose(std::env::var("CMAKE_VERBOSE").is_ok()) // Not verbose by default
+ .always_configure(false);
+
+ let build_dir = config.build();
+ add_search_path(&build_dir);
+
+ // Extract libs on desktop platforms
+ if !is_mobile {
+ sherpa_libs = extract_lib_names(&build_dir, is_dynamic, &target_os);
+ }
+ }
+
+ // Linking
+
+ debug_log!("Sherpa libs: {:?}", sherpa_libs);
+ add_search_path(out_dir.join("lib"));
+
+ for lib in sherpa_libs {
+ if lib.contains("cxx") {
+ continue;
+ }
+ link_lib(&lib, is_dynamic);
+ }
+
+ // Windows debug
+ if cfg!(all(debug_assertions, windows)) {
+ link_lib("msvcrtd", true);
+ }
+
+ // macOS
+ if target_os == "macos" || target_os == "ios" {
+ link_framework("CoreML");
+ link_framework("Foundation");
+ link_lib("c++", true);
+ }
+
+ // Linux
+ if target_os == "linux" || target == "android" {
+ link_lib("stdc++", true);
+ }
+
+ // macOS
+ if target_os == "macos" {
+ // On (older) OSX we need to link against the clang runtime,
+ // which is hidden in some non-default path.
+ //
+ // More details at https://github.com/alexcrichton/curl-rust/issues/279.
+ if let Some(path) = macos_link_search_path() {
+ add_search_path(path);
+ link_lib("clang_rt.osx", is_dynamic);
+ }
+ }
+
+ // Copy dynamic libraries
+
+ if is_dynamic {
+ let mut libs_assets = extract_lib_assets(&out_dir, &target_os);
+ if let Ok(sherpa_lib_path) = env::var("SHERPA_LIB_PATH") {
+ libs_assets.extend(extract_lib_assets(Path::new(&sherpa_lib_path), &target_os));
+ }
+
+ #[cfg(feature = "download-binaries")]
+ if let Some(dist) = optional_dist {
+ if let Some(assets) = dist.libs {
+ if let Ok(sherpa_lib_path) = env::var("SHERPA_LIB_PATH") {
+ let sherpa_lib_path = Path::new(&sherpa_lib_path);
+ libs_assets.extend(assets.iter().map(|p| sherpa_lib_path.join(p)));
+ }
+ }
+ }
+
+ for asset in libs_assets {
+ let asset_clone = asset.clone();
+ let filename = asset_clone.file_name().unwrap();
+ let filename = filename.to_str().unwrap();
+ let dst = target_dir.join(filename);
+ // debug_log!("HARD LINK {} TO {}", asset.display(), dst.display());
+ if !dst.exists() {
+ copy_file(asset.clone(), dst);
+ }
+
+ // Copy DLLs to examples as well
+ if target_dir.join("examples").exists() {
+ let dst = target_dir.join("examples").join(filename);
+ // debug_log!("HARD LINK {} TO {}", asset.display(), dst.display());
+ if !dst.exists() {
+ copy_file(asset.clone(), dst);
+ }
+ }
+
+ // Copy DLLs to target/profile/deps as well for tests
+ let dst = target_dir.join("deps").join(filename);
+ // debug_log!("HARD LINK {} TO {}", asset.display(), dst.display());
+ if !dst.exists() {
+ copy_file(asset.clone(), dst);
+ }
+ }
+
+ // TODO: add rpath for Android and iOS so it can find its dependencies in the same directory of executable
+ // if is_mobile {
+ // // Add rpath for Android and iOS so that the shared library can find its dependencies in the same directory as well
+ // println!("cargo:rustc-link-arg=-Wl,-rpath,'$ORIGIN'");
+ // }
+ }
+}
diff --git a/crates/sherpa-rs-sys/checksum.txt b/crates/sherpa-rs-sys/checksum.txt
new file mode 100644
index 0000000..ceb0e91
--- /dev/null
+++ b/crates/sherpa-rs-sys/checksum.txt
@@ -0,0 +1,82 @@
+sherpa-onnx-1.11.5-rknn.aar c9177e475f85e61922ced3d10277cb261a985c75007307cd01df39423710bce0
+sherpa-onnx-1.11.5.aar 1fd9dfefb19df233f868553e872e98b8bd636ac428c0a0b709bc1405bc7eafa0
+sherpa-onnx-non-streaming-asr-x64-v1.11.5.exe c049394c10beca44de540b3da6c81618b2c198efe53d87c471145c429294ec1c
+sherpa-onnx-non-streaming-asr-x86-v1.11.5.exe f72fb5ed449e90455a4de5b2c1548b5416daa117e067fc5a11ddf7d8a1306fc6
+sherpa-onnx-non-streaming-tts-x64-v1.11.5.exe 904c920fe6b500a455ac48832d1689d966a8bcf0b5eed26e62ce1bc6ba4a9df5
+sherpa-onnx-non-streaming-tts-x86-v1.11.5.exe 7c42aa3df603fe6186cb96c5301ab70d7bfbd0d4f9ef7ccb95f77ab33e89471c
+sherpa-onnx-static-link-onnxruntime-1.11.5.aar 5701bf4e6d4ff16c72cc58fd606e9d27e43ed6d72919216199451ddf673c78a4
+sherpa-onnx-streaming-asr-x64-v1.11.5.exe a0b6cfb44e9fde8cd78e516c59d59c1f7ac0bc82bfe76cca497452e218ca9a3d
+sherpa-onnx-streaming-asr-x86-v1.11.5.exe 4cba9b3a20abd87c5422869411c53a722622cdd82e768587b653f6b01a8f7460
+sherpa-onnx-v1.11.5-android-rknn.tar.bz2 4da67093851a44991eac90b1a1e6519db51ea62dd796cad3e1669a1880f24c14
+sherpa-onnx-v1.11.5-android-static-link-onnxruntime.tar.bz2 7e7f7d91617fa77361eb2fbfd9f90aa5d9b7a73be8764e64f6c0b90bcd71af34
+sherpa-onnx-v1.11.5-android.tar.bz2 76e21f461f9527d7ba46c0deb2dec035aaa87e78b8cb46ade883ac9d4d9b853b
+sherpa-onnx-v1.11.5-ios-no-tts.tar.bz2 84533a2d9287907178b68d0aeb0ae6939d4a109f34675d46655f2ff6d6185dc7
+sherpa-onnx-v1.11.5-ios.tar.bz2 7daf9111f30200416e504428ef457a9f60009ae67a2bd4e3bfb829f5d096fab5
+sherpa-onnx-v1.11.5-java11.jar 7b86e00abc8667d606bc94f47a954ebb9359fc7f764a227b644de3f3962a85ff
+sherpa-onnx-v1.11.5-java16.jar fe844835b8df5bb4e2973d12b172779ff961b3944fa6caed63fde3cbfd8d500c
+sherpa-onnx-v1.11.5-java17.jar 46826ae8972cb98a72e9437a2d31ca12c715ce31786e31a525d9db8b1b0265a7
+sherpa-onnx-v1.11.5-java18.jar 90504699e7e6a91dc3c2552c16759127d95f71ef3caf7c0c11b804a51e772cab
+sherpa-onnx-v1.11.5-java19.jar a1f4d27f77a1720328b0ce7aa149759b9dabe2ca2ccba52fc0d0cc3857e7c2e9
+sherpa-onnx-v1.11.5-java20.jar af3e213d29fc36ba2428d275aa7c6f5a8aeae9bbf794101397a1c240ccf30a54
+sherpa-onnx-v1.11.5-java21.jar 5a89cb1a48160703e78d4d66f4e61404c48493d1507f1529b0c1a67f7d472075
+sherpa-onnx-v1.11.5-java22.jar a6c49e60cf15efb341059593668d3fa34d42e03b695f4dfcc838cee196ca400c
+sherpa-onnx-v1.11.5-java23.jar 6dd7e9610c5ded573432e461a807ede2672714c9cca1982bf5e57827d7dc74f0
+sherpa-onnx-v1.11.5-java8.jar 3043da43f887f4ecea1aff05df70ea2b31a92d23a90131a3ea1165b35f3c12be
+sherpa-onnx-v1.11.5-linux-aarch64-jni.tar.bz2 12faa7a6fdf25748388713ea7e1bb8c9664372a6291a334a4a9ec4ea5f02f211
+sherpa-onnx-v1.11.5-linux-aarch64-shared-cpu.tar.bz2 18403204bd3dfbe303cc7785ff82449daaaf964ca4fa67ec94fa7be71308173d
+sherpa-onnx-v1.11.5-linux-aarch64-shared-gpu-onnxruntime-1.11.0.tar.bz2 f607b4e5fc6e02d08776ec4a1d4756aa6b8df2d98945c4b20450cf09e3ffa591
+sherpa-onnx-v1.11.5-linux-aarch64-shared-gpu-onnxruntime-1.16.0.tar.bz2 dea5c525647001f73262323cb048516010cd867404061a278b554a408dc82e25
+sherpa-onnx-v1.11.5-linux-aarch64-shared-gpu-onnxruntime-1.18.0.tar.bz2 9f0817095111f5edfab109a82967116ef15fad3076fabbe982a1eba74de135a5
+sherpa-onnx-v1.11.5-linux-aarch64-shared-gpu-onnxruntime-1.18.1.tar.bz2 a3493baaff5e4ef6d9c3413aadc9b5670df8612db7155ec53c292e9449ddd77e
+sherpa-onnx-v1.11.5-linux-aarch64-static.tar.bz2 818a78fd2c7b92df09c65a806087679368bb58df49d344172cf113ad95f2dcd1
+sherpa-onnx-v1.11.5-linux-riscv64-shared.tar.bz2 d5a02212c3b43f98682e7c088691acba23e1fa3ba4f86e186aeeaa525e3eaee6
+sherpa-onnx-v1.11.5-linux-x64-gpu.tar.bz2 01844c0534883cb9b4ae032f6b4500ecc9ce5f2031d5e9459fbdada9d1f6b8e9
+sherpa-onnx-v1.11.5-linux-x64-jni.tar.bz2 a052bcf0b795ee2c6f36e65adbf9acaddbe595f95723708765b1435e372e5a79
+sherpa-onnx-v1.11.5-linux-x64-shared-no-tts.tar.bz2 96d790688fbb422f6073b61a6298709e3a54ec94978450037c4ef2adacbd0bc2
+sherpa-onnx-v1.11.5-linux-x64-shared.tar.bz2 596962a9ca9b839fd80587cd20d859c2262132e08471a27406a1105635dca652
+sherpa-onnx-v1.11.5-linux-x64-static-no-tts.tar.bz2 4e16de788d2ce79ab576d97adabf4c67981deed0ac35af0860eb120f710b28a6
+sherpa-onnx-v1.11.5-linux-x64-static.tar.bz2 c53d52615101b09610871ef66e34efc11e611b7d9b2ddd81468382b7efa72d16
+sherpa-onnx-v1.11.5-macos-xcframework-static.tar.bz2 fdff377597fb5ac0ef124b19a807bdcd512c44df2352942dd388f2d3b28210a4
+sherpa-onnx-v1.11.5-ohos-arm64-v8a.tar.bz2 3418b81d7dda64aa6fcb9212bf7240d132a102edfad059407ca9a316c2875039
+sherpa-onnx-v1.11.5-ohos-armeabi-v7a.tar.bz2 09d8195b6aa2a69b60f9a3ee61060822756a2af09371b7b6c719400ebf65be7c
+sherpa-onnx-v1.11.5-ohos-x86_64.tar.bz2 261b35d9b16772198487492e0d87bfcfb2cdc26abac166f9879a731d547c2ca1
+sherpa-onnx-v1.11.5-osx-arm64-jni.tar.bz2 e7e62cada2fd5510f114a191367a33de689a63f6aeb40ef0e652aca5b92c5c87
+sherpa-onnx-v1.11.5-osx-universal2-shared-no-tts.tar.bz2 5cf8ea5658751577b0b79f66a6969cb74efe66b8c4fb2ce4eb8341ccbfc78c76
+sherpa-onnx-v1.11.5-osx-universal2-shared.tar.bz2 741cd84e42b5615f395b40510d9a12a73cb89cb38b3e540e1c11bc0eb5e92c29
+sherpa-onnx-v1.11.5-osx-universal2-static-no-tts.tar.bz2 433d03ac9240bb1091e82c10de4cc3c15f9031e7eeea85dbebb06c6681440b24
+sherpa-onnx-v1.11.5-osx-universal2-static.tar.bz2 24ea1b1a0205c8408e22ee5459596aa2e46e32512cac2ec3075ee489039d2fd3
+sherpa-onnx-v1.11.5-osx-x86_64-jni.tar.bz2 ed90b3a5a0fa561c2ccd1491b9ddabd5fc03ce9b145669c3705d4e542936e97f
+sherpa-onnx-v1.11.5-rknn-linux-aarch64-shared.tar.bz2 44d6999f8ff1df4aa868f1678d72bfbb0949b8c2377f8a998d236127e4f6cf5e
+sherpa-onnx-v1.11.5-rknn-linux-aarch64-static.tar.bz2 077cd6bb55c47c2ab527bbaa54485b5e9f7b076f1f49b200d4c62456365f4164
+sherpa-onnx-v1.11.5-win-x64-cuda.tar.bz2 f05b5062659420b41200515dfaad2ec68eb1b7a985bfabf41018cbb71b559094
+sherpa-onnx-v1.11.5-win-x64-jni.tar.bz2 b54bc561b496c374a00a0e5ccfecca7de7222fa5d1ea641d8c11445b82a46373
+sherpa-onnx-v1.11.5-win-x64-shared-no-tts.tar.bz2 efe8a46ce1ca7f93b9c4343ac953bb2fad9aea99fb3f7d0d7b71e8a4139a2f89
+sherpa-onnx-v1.11.5-win-x64-shared.tar.bz2 0c3955581cad3e8267968f83adb816536ef3002a09d20c7a3bcc57df1770a73f
+sherpa-onnx-v1.11.5-win-x64-static-no-tts.tar.bz2 114b9f0f5a99c07126f0d50cccbb73474ff4ca7c5204bd7a18ed1d3b19dbc3b9
+sherpa-onnx-v1.11.5-win-x64-static.tar.bz2 b403f3abab3d9122c0253163d41e13b2c37453635fa0182bce4fded284b374a7
+sherpa-onnx-v1.11.5-win-x86-shared-no-tts.tar.bz2 9b7f2b6a7796065cc43e61483765219d6baede2692f4f1bdd049a1be002268c4
+sherpa-onnx-v1.11.5-win-x86-shared.tar.bz2 7c067fae12f55bcd06ca4abd371041b49a9200fb5179587e393d1cf6af6f6e3b
+sherpa-onnx-v1.11.5-win-x86-static-no-tts.tar.bz2 5b82c8304d208704e913fba70ce4a770dacdeee5b812ac7f59e3fc21d0bd458d
+sherpa-onnx-v1.11.5-win-x86-static.tar.bz2 7a5c15d68d1aaa978c18e0fa844055d75e97d36ef580e760c321232a1c36f161
+sherpa-onnx-v1.11.5.jar 6dd7e9610c5ded573432e461a807ede2672714c9cca1982bf5e57827d7dc74f0
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-en-moonshine_tiny.tar.bz2 b77beb68216dbadc9a5a11fac17b34770727c7f879a268aa2273901ec4dc3d5f
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-en-whisper_tiny.tar.bz2 b8e76f841f5467b49e27f155f7dcc1658cd0db168016173b8d6c0ed8a371af0b
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-en-zipformer_gigaspeech.tar.bz2 17f7bbd154c41a130ce198a293684db1a8eb23a6641cdab55385675dd6f2245b
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-ja-zipformer_reazonspeech.tar.bz2 1ec8ad2a8429c6c79b4c68cfa60d7068e64a88c715f2058225ad23374f9ff7cc
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-multi_lang-dolphin_ctc.tar.bz2 558635e721d990cb3fa348f168e914a65832a17e1a15cd9c76299eb913c554c6
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-th-zipformer_gigaspeech2.tar.bz2 1edcb15d712b38de04c8afe94df4d9bcf6a72f328ce22b11d5aeb3995b4fc768
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-zh-telespeech.tar.bz2 cc94e3a228b27dddef6976cfd267a5a6a7a65aeeb303035b5f6e7e3400cf656a
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-zh-zipformer_wenetspeech.tar.bz2 eb4ebff87c4f84b5c2e006af8b28d7f903060efd4a0e32ded54c72fd0a7c2dad
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-zh_en-paraformer_large.tar.bz2 f140f95040aeab96f2afd5eb6156c2ab3ab953a204348a8bcea07cee5e941cec
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-zh_en-paraformer_small.tar.bz2 04e7109dc4c9fbec3b3f7f5afe9fa9e3324abd602acdf0e3a27e9e01ecde2f98
+sherpa-onnx-wasm-simd-1.11.5-vad-asr-zh_en_ja_ko_cantonese-sense_voice_small.tar.bz2 715d836bf52dc57ab12dee1c5e7354fa1c41e0da2c1c38bdbff97679d1a84d6e
+sherpa-onnx-wasm-simd-v1.11.5-de-tts.tar.bz2 7dae01ffb67ecd899d1a17b3050e1301d9c7b2e97f44e974f4624e9e0d08d9c8
+sherpa-onnx-wasm-simd-v1.11.5-en-asr-zipformer.tar.bz2 2f6dae1df1f6d41e30a74a4931e724b6d4f3da548f0dbef18df9ac8aaaf1c8bd
+sherpa-onnx-wasm-simd-v1.11.5-en-tts.tar.bz2 6887019933848c143fb28ec1c09532f3418b3e497e801e04613e1f4faf22f16d
+sherpa-onnx-wasm-simd-v1.11.5-speaker-diarization.tar.bz2 45cc511cfcf334544d159399f149581c955a96cac9b2624888b1871657c9f819
+sherpa-onnx-wasm-simd-v1.11.5-speech-enhancement-gtcrn.tar.bz2 a231a75a2cb4f8b91c0d698b0bd7c7854c14056865affaf359064edda48e00c4
+sherpa-onnx-wasm-simd-v1.11.5-vad.tar.bz2 ca626fcf30fa6235324ef27daa4166359f925f4eb455182cf04c226f1d123b14
+sherpa-onnx-wasm-simd-v1.11.5-zh-cantonese-en-asr-paraformer.tar.bz2 96d056f3248702569833e641233e43cc32cff3e319c95e7f67f2165d6c63002c
+sherpa-onnx-wasm-simd-v1.11.5-zh-en-asr-paraformer.tar.bz2 305be043713097b1a475f1f7c0df005c1dece026c9e1347b4028919579e39eab
+sherpa-onnx-wasm-simd-v1.11.5-zh-en-asr-zipformer.tar.bz2 435e695b1df8e1fbee4a4144190876770bb3dbb6bca6137730de9040019a4148
+sherpa_onnx-v1.11.5.har 3c85d9feaa004c7d2ff0c1fc49f8c8ac37142c51c34cad79aa95efc631a3d361
diff --git a/crates/sherpa-rs-sys/dist.json b/crates/sherpa-rs-sys/dist.json
new file mode 100644
index 0000000..201aed7
--- /dev/null
+++ b/crates/sherpa-rs-sys/dist.json
@@ -0,0 +1,58 @@
+{
+ "tag": "v1.11.5",
+ "url": "https://github.com/k2-fsa/sherpa-onnx/releases/download/{tag}/{archive}",
+ "targets": {
+ "x86_64-pc-windows-msvc": {
+ "static": "sherpa-onnx-{tag}-win-x64-static.tar.bz2",
+ "dynamic": "sherpa-onnx-{tag}-win-x64-shared.tar.bz2"
+ },
+ "x86_64-unknown-linux-gnu": {
+ "static": "sherpa-onnx-{tag}-linux-x64-static.tar.bz2",
+ "dynamic": "sherpa-onnx-{tag}-linux-x64-shared.tar.bz2"
+ },
+ "aarch64-apple-darwin": {
+ "static": "sherpa-onnx-{tag}-osx-universal2-static.tar.bz2",
+ "dynamic": "sherpa-onnx-{tag}-osx-universal2-shared.tar.bz2"
+ },
+ "x86_64-apple-darwin": {
+ "static": "sherpa-onnx-{tag}-osx-universal2-static.tar.bz2",
+ "dynamic": "sherpa-onnx-{tag}-osx-universal2-shared.tar.bz2"
+ },
+ "android": {
+ "archive": "sherpa-onnx-{tag}-android.tar.bz2",
+ "is_dynamic": true,
+ "targets": {
+ "aarch64-linux-android": [
+ "jniLibs/arm64-v8a/libsherpa-onnx-c-api.so",
+ "jniLibs/arm64-v8a/libonnxruntime.so"
+ ],
+ "x86_64-linux-android": [
+ "jniLibs/x86_64/libsherpa-onnx-c-api.so",
+ "jniLibs/x86_64/libonnxruntime.so"
+ ],
+ "armv7-linux-androideabi": [
+ "jniLibs/armeabi-v7a/libsherpa-onnx-c-api.so",
+ "jniLibs/armeabi-v7a/libonnxruntime.so"
+ ]
+ }
+ },
+ "ios": {
+ "archive": "sherpa-onnx-{tag}-ios.tar.bz2",
+ "is_dynamic": false,
+ "targets": {
+ "aarch64-apple-ios": [
+ "build-ios/ios-onnxruntime/1.17.1/onnxruntime.xcframework/ios-arm64/libonnxruntime.a",
+ "build-ios/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a"
+ ],
+ "aarch64-apple-ios-sim": [
+ "build-ios/ios-onnxruntime/1.17.1/onnxruntime.xcframework/ios-arm64_x86_64-simulator/libonnxruntime.a",
+ "build-ios/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a"
+ ],
+ "x86_64-apple-ios": [
+ "build-ios/ios-onnxruntime/1.17.1/onnxruntime.xcframework/ios-arm64_x86_64-simulator/libonnxruntime.a",
+ "build-ios/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a"
+ ]
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/crates/sherpa-rs-sys/sherpa-onnx b/crates/sherpa-rs-sys/sherpa-onnx
new file mode 160000
index 0000000..baec2da
--- /dev/null
+++ b/crates/sherpa-rs-sys/sherpa-onnx
@@ -0,0 +1 @@
+Subproject commit baec2da74524697f5c88ea6063d0c6fc06a72d36
diff --git a/crates/sherpa-rs-sys/src/download_binaries.rs b/crates/sherpa-rs-sys/src/download_binaries.rs
new file mode 100644
index 0000000..41af8bd
--- /dev/null
+++ b/crates/sherpa-rs-sys/src/download_binaries.rs
@@ -0,0 +1,258 @@
+use std::{
+ collections::HashMap,
+ path::{Path, PathBuf},
+};
+
+use serde::Deserialize;
+use serde_json::Value;
+
+// Prebuilt sherpa-onnx doesn't have Cuda support
+#[cfg(all(
+ any(target_os = "windows", target_os = "linux"),
+ feature = "download-binaries",
+ feature = "cuda"
+))]
+compile_error!(
+ "The 'download-binaries' and 'cuda' features cannot be enabled at the same time.\n\
+ To resolve this, please disable the 'download-binaries' feature when using 'cuda'.\n\
+ For example, in your Cargo.toml:\n\
+ [dependencies]\n\
+ sherpa-rs = { default-features = false, features = [\"cuda\"] }"
+);
+
+// Prebuilt sherpa-onnx doesn't have DirectML support
+#[cfg(all(windows, feature = "download-binaries", feature = "directml"))]
+compile_error!(
+ "The 'download-binaries' and 'directml' features cannot be enabled at the same time.\n\
+ To resolve this, please disable the 'download-binaries' feature when using 'directml'.\n\
+ For example, in your Cargo.toml:\n\
+ [dependencies]\n\
+ sherpa-rs = { default-features = false, features = [\"directml\"] }"
+);
+
+// Prebuilt sherpa-onnx does not include TTS in static builds.
+#[cfg(all(
+ windows,
+ feature = "download-binaries",
+ feature = "static",
+ feature = "tts"
+))]
+compile_error!(
+ "The 'download-binaries', 'static', and 'tts' features cannot be enabled at the same time.\n\
+ To resolve this, please disable the 'tts' feature when using 'static' and 'download-binaries' together.\n\
+ For example, in your Cargo.toml:\n\
+ [dependencies]\n\
+ sherpa-rs = { default-features = false, features = [\"static\", \"tts\"] }"
+);
+
+macro_rules! debug_log {
+ ($($arg:tt)*) => {
+ // SHERPA_BUILD_DEBUG=1 cargo build
+ if std::env::var("SHERPA_BUILD_DEBUG").unwrap_or_default() == "1" {
+ println!("cargo:warning=[DEBUG] {}", format!($($arg)*));
+ }
+ };
+}
+
+pub fn fetch_file(source_url: &str) -> Vec {
+ let resp = ureq::AgentBuilder::new()
+ .try_proxy_from_env(true)
+ .build()
+ .get(source_url)
+ .timeout(std::time::Duration::from_secs(1800))
+ .call()
+ .unwrap_or_else(|err| panic!("Failed to GET `{source_url}`: {err}"));
+
+ let len = resp
+ .header("Content-Length")
+ .and_then(|s| s.parse::().ok())
+ .expect("Content-Length header should be present on archive response");
+ debug_log!("Fetch file {} {}", source_url, len);
+ let mut reader = resp.into_reader();
+ let mut buffer = Vec::new();
+ reader
+ .read_to_end(&mut buffer)
+ .unwrap_or_else(|err| panic!("Failed to download from `{source_url}`: {err}"));
+ assert_eq!(buffer.len(), len);
+ buffer
+}
+
+static DIST_CONTENT: &str = include_str!("../dist.json");
+static DIST_CHECKSUM_CONTENT: &str = include_str!("../checksum.txt");
+lazy_static::lazy_static! {
+ pub static ref DIST_TABLE: DistTable = DistTable::new(DIST_CONTENT);
+ pub static ref DIST_CHECKSUM: HashMap = {
+ DIST_CHECKSUM_CONTENT
+ .lines()
+ .map(|line| {
+ let mut parts = line.split_whitespace();
+ let key = parts.next().unwrap().to_string();
+ let value = parts.next().unwrap().to_string();
+ (key, value)
+ })
+ .collect()
+ };
+}
+
+#[derive(Debug, Deserialize)]
+pub struct DistTable {
+ pub tag: String,
+ pub url: String,
+ pub targets: HashMap,
+}
+
+#[derive(Debug, Clone)]
+pub struct Dist {
+ pub url: String,
+ pub name: String,
+ pub checksum: String,
+ pub libs: Option>, // Paths to the extracted libraries
+}
+
+impl DistTable {
+ fn new(content: &str) -> Self {
+ let mut table: DistTable = serde_json::from_str(content)
+ .unwrap_or_else(|_| panic!("Failed to parse dist.json: {}", content));
+ table.url = table.url.replace("{tag}", &table.tag);
+ for value in table.targets.values_mut() {
+ // expand static with {tag}
+ if let Some(static_value) = value.get("static") {
+ let static_value = static_value.as_str().unwrap();
+ value["static"] = Value::String(static_value.replace("{tag}", &table.tag));
+ }
+ // expand dynamic with {tag}
+ if let Some(dynamic_value) = value.get("dynamic") {
+ let dynamic_value = dynamic_value.as_str().unwrap();
+ value["dynamic"] = Value::String(dynamic_value.replace("{tag}", &table.tag));
+ }
+ // expand archive with {tag}
+ if let Some(archive_value) = value.get("archive") {
+ let archive_value = archive_value.as_str().unwrap();
+ value["archive"] = Value::String(archive_value.replace("{tag}", &table.tag));
+ }
+ }
+ table
+ }
+
+ pub fn get(&self, target: &str, is_dynamic: &mut bool) -> Option {
+ debug_log!("Extracting dist for target: {}", target);
+ // debug_log!("dist table: {:?}", self);
+ let target_dist = if target.contains("android") {
+ self.targets.get("android").unwrap()
+ } else if target.contains("ios") {
+ self.targets.get("ios").unwrap()
+ } else {
+ self.targets
+ .get(target)
+ .unwrap_or_else(||
+ panic!("Target {} not found. try to disable download-feature with --no-default-features.", target)
+ )
+ };
+ debug_log!(
+ "raw target_dist: {:?}",
+ serde_json::to_string(target_dist).unwrap()
+ );
+ let archive = if target_dist.get("archive").is_some() {
+ // archive name
+ // static/dynamic located in 'is_dynamic' field
+ target_dist.get("archive").unwrap().as_str().unwrap()
+ } else if *is_dynamic {
+ // dynamic archive name
+ target_dist.get("dynamic").unwrap().as_str().unwrap()
+ } else {
+ // static archive name
+ target_dist.get("static").unwrap().as_str().unwrap()
+ };
+ let name = archive.replace(".tar.bz2", "");
+ let name = name.replace(".tar.gz", "");
+
+ let libs: Option> = target_dist["targets"][target].as_array().map(|libs| {
+ libs.iter()
+ .map(|lib| lib.as_str().unwrap().to_string())
+ .collect()
+ });
+
+ let url = self.url.replace("{archive}", archive);
+ let checksum = DIST_CHECKSUM.get(archive)?;
+
+ // modify is_dynamic
+ debug_log!("checking is_dynamic");
+ if let Some(target_dist) = target_dist.get("is_dynamic") {
+ *is_dynamic = target_dist.as_bool()?;
+ debug_log!("is_dynamic: {}", *is_dynamic);
+ }
+
+ let dist = Dist {
+ url,
+ name,
+ checksum: checksum.to_string(),
+ libs,
+ };
+ debug_log!("dist: {:?}", dist);
+ Some(dist)
+ }
+}
+
+#[allow(unused)]
+fn hex_str_to_bytes(c: impl AsRef<[u8]>) -> Vec {
+ fn nibble(c: u8) -> u8 {
+ match c {
+ b'A'..=b'F' => c - b'A' + 10,
+ b'a'..=b'f' => c - b'a' + 10,
+ b'0'..=b'9' => c - b'0',
+ _ => panic!(),
+ }
+ }
+
+ c.as_ref()
+ .chunks(2)
+ .map(|n| (nibble(n[0]) << 4) | nibble(n[1]))
+ .collect()
+}
+
+fn bytes_to_hex_str(bytes: Vec) -> String {
+ let mut s = String::with_capacity(bytes.len() * 2);
+ for byte in bytes {
+ s.push_str(&format!("{:02x}", byte));
+ }
+ s
+}
+
+pub fn sha256(buf: &[u8]) -> String {
+ let hash_bytes: Vec = ::digest(buf).to_vec();
+ bytes_to_hex_str(hash_bytes)
+}
+
+pub fn get_cache_dir() -> Option {
+ dirs::cache_dir().map(|p| p.join("sherpa-rs"))
+}
+
+#[allow(unused)]
+pub fn extract_tgz(buf: &[u8], output: &Path) {
+ let buf: std::io::BufReader<&[u8]> = std::io::BufReader::new(buf);
+ let tar = flate2::read::GzDecoder::new(buf);
+ let mut archive = tar::Archive::new(tar);
+ archive.unpack(output).expect("Failed to extract .tgz file");
+}
+
+pub fn extract_tbz(buf: &[u8], output: &Path) {
+ debug_log!("extracging tbz to {}", output.display());
+ let buf: std::io::BufReader<&[u8]> = std::io::BufReader::new(buf);
+ let tar = bzip2::read::BzDecoder::new(buf); // Use BzDecoder for .bz2
+ let mut archive = tar::Archive::new(tar);
+ archive.unpack(output).expect("Failed to extract .tbz file");
+}
+
+pub fn extract_lib_name>(path: P) -> String {
+ path.as_ref()
+ .file_name()
+ .and_then(|name| name.to_str())
+ .map(|name| {
+ name.strip_prefix("lib")
+ .unwrap_or(name)
+ .replace(".so", "")
+ .replace(".dylib", "")
+ .replace(".a", "")
+ })
+ .unwrap_or_else(|| "".to_string())
+}
diff --git a/sys/src/lib.rs b/crates/sherpa-rs-sys/src/lib.rs
similarity index 100%
rename from sys/src/lib.rs
rename to crates/sherpa-rs-sys/src/lib.rs
diff --git a/sys/wrapper.h b/crates/sherpa-rs-sys/wrapper.h
similarity index 100%
rename from sys/wrapper.h
rename to crates/sherpa-rs-sys/wrapper.h
diff --git a/crates/sherpa-rs/Cargo.toml b/crates/sherpa-rs/Cargo.toml
new file mode 100644
index 0000000..927dd40
--- /dev/null
+++ b/crates/sherpa-rs/Cargo.toml
@@ -0,0 +1,128 @@
+[package]
+name = "sherpa-rs"
+version = "0.6.6"
+edition = "2021"
+authors = ["thewh1teagle"]
+license = "MIT"
+repository = "https://github.com/thewh1teagle/sherpa-rs"
+description = "Rust bindings to https://github.com/k2-fsa/sherpa-onnx"
+readme = "../../README.md"
+keywords = [
+ "audio",
+ "embeddings",
+ "speech-recognition",
+ "sherpa",
+ "diarization",
+]
+
+[lib]
+crate-type = ["cdylib", "rlib"]
+
+[dependencies]
+eyre = "0.6.12"
+hound = { version = "3.5.1" }
+sherpa-rs-sys = { path = "../sherpa-rs-sys", version = "0.6.6", default-features = false }
+tracing = "0.1.40"
+
+[dev-dependencies]
+clap = { version = "4.5.8", features = ["derive"] }
+
+[features]
+default = ["download-binaries", "tts"]
+download-binaries = ["sherpa-rs-sys/download-binaries"]
+static = ["sherpa-rs-sys/static"]
+sys = []
+tts = ["sherpa-rs-sys/tts"]
+cuda = ["sherpa-rs-sys/cuda"]
+directml = ["sherpa-rs-sys/directml"]
+
+[[example]]
+name = "tts_kokoro"
+required-features = ["tts"]
+path = "../../examples/tts_kokoro.rs"
+
+[[example]]
+name = "tts_vits"
+required-features = ["tts"]
+path = "../../examples/tts_vits.rs"
+
+[[example]]
+name = "tts_matcha"
+required-features = ["tts"]
+path = "../../examples/tts_matcha.rs"
+
+[[example]]
+name = "audio_tag"
+path = "../../examples/audio_tag.rs"
+
+[[example]]
+name = "keyword_spot"
+path = "../../examples/keyword_spot.rs"
+
+[[example]]
+name = "punctuate"
+path = "../../examples/punctuate.rs"
+
+[[example]]
+name = "speaker_id"
+path = "../../examples/speaker_id.rs"
+
+[[example]]
+name = "vad"
+path = "../../examples/vad.rs"
+
+[[example]]
+name = "vad_whisper"
+path = "../../examples/vad_whisper.rs"
+
+[[example]]
+name = "zipformer"
+path = "../../examples/zipformer.rs"
+
+[[example]]
+name = "diarize"
+path = "../../examples/diarize.rs"
+
+[[example]]
+name = "language_id"
+path = "../../examples/language_id.rs"
+
+[[example]]
+name = "speaker_embedding"
+path = "../../examples/speaker_embedding.rs"
+
+[[example]]
+name = "vad_segment"
+path = "../../examples/vad_segment.rs"
+
+[[example]]
+name = "whisper"
+path = "../../examples/whisper.rs"
+
+[[example]]
+name = "moonshine"
+path = "../../examples/moonshine.rs"
+
+[[example]]
+name = "sense_voice"
+path = "../../examples/sense_voice.rs"
+
+[[example]]
+name = "paraformer"
+path = "../../examples/paraformer.rs"
+
+[[example]]
+name = "transducer"
+path = "../../examples/transducer.rs"
+
+[[example]]
+name = "transducer_vosk"
+path = "../../examples/transducer_vosk.rs"
+
+[[example]]
+name = "dolphin"
+path = "../../examples/dolphin.rs"
+
+[[example]]
+name = "parakeet"
+path = "../../examples/parakeet.rs"
\ No newline at end of file
diff --git a/src/add_punctuation.rs b/crates/sherpa-rs/src/add_punctuation.rs
similarity index 100%
rename from src/add_punctuation.rs
rename to crates/sherpa-rs/src/add_punctuation.rs
diff --git a/crates/sherpa-rs/src/audio_tag.rs b/crates/sherpa-rs/src/audio_tag.rs
new file mode 100644
index 0000000..aa32a3e
--- /dev/null
+++ b/crates/sherpa-rs/src/audio_tag.rs
@@ -0,0 +1,95 @@
+use eyre::{bail, Result};
+
+use crate::{
+ get_default_provider,
+ utils::{cstr_to_string, cstring_from_str},
+};
+
+#[derive(Debug, Default, Clone)]
+pub struct AudioTagConfig {
+ pub model: String,
+ pub labels: String,
+ pub top_k: i32,
+ pub ced: Option,
+ pub debug: bool,
+ pub num_threads: Option,
+ pub provider: Option,
+}
+
+pub struct AudioTag {
+ audio_tag: *const sherpa_rs_sys::SherpaOnnxAudioTagging,
+ config: AudioTagConfig,
+}
+
+impl AudioTag {
+ pub fn new(config: AudioTagConfig) -> Result {
+ let config_clone = config.clone();
+
+ let model = cstring_from_str(&config.model);
+ let ced = cstring_from_str(&config.ced.unwrap_or_default());
+ let labels = cstring_from_str(&config.labels);
+ let provider = cstring_from_str(&config.provider.unwrap_or(get_default_provider()));
+
+ let sherpa_config = sherpa_rs_sys::SherpaOnnxAudioTaggingConfig {
+ model: sherpa_rs_sys::SherpaOnnxAudioTaggingModelConfig {
+ zipformer: sherpa_rs_sys::SherpaOnnxOfflineZipformerAudioTaggingModelConfig {
+ model: model.as_ptr(),
+ },
+ ced: ced.as_ptr(),
+ num_threads: config.num_threads.unwrap_or(1),
+ debug: config.debug.into(),
+ provider: provider.as_ptr(),
+ },
+ labels: labels.as_ptr(),
+ top_k: config.top_k,
+ };
+ let audio_tag = unsafe { sherpa_rs_sys::SherpaOnnxCreateAudioTagging(&sherpa_config) };
+
+ if audio_tag.is_null() {
+ bail!("Failed to create audio tagging");
+ }
+ Ok(Self {
+ audio_tag,
+ config: config_clone,
+ })
+ }
+
+ pub fn compute(&mut self, samples: Vec, sample_rate: u32) -> Vec {
+ let mut events = Vec::new();
+ unsafe {
+ let stream = sherpa_rs_sys::SherpaOnnxAudioTaggingCreateOfflineStream(self.audio_tag);
+ sherpa_rs_sys::SherpaOnnxAcceptWaveformOffline(
+ stream,
+ sample_rate as i32,
+ samples.as_ptr(),
+ samples.len() as i32,
+ );
+
+ let results = sherpa_rs_sys::SherpaOnnxAudioTaggingCompute(
+ self.audio_tag,
+ stream,
+ self.config.top_k,
+ );
+
+ for i in 0..self.config.top_k {
+ let event = *results.add(i.try_into().unwrap());
+ let event_name = cstr_to_string((*event).name as _);
+ events.push(event_name);
+ }
+
+ sherpa_rs_sys::SherpaOnnxDestroyOfflineStream(stream);
+ }
+ events
+ }
+}
+
+unsafe impl Send for AudioTag {}
+unsafe impl Sync for AudioTag {}
+
+impl Drop for AudioTag {
+ fn drop(&mut self) {
+ unsafe {
+ sherpa_rs_sys::SherpaOnnxDestroyAudioTagging(self.audio_tag);
+ }
+ }
+}
diff --git a/crates/sherpa-rs/src/diarize.rs b/crates/sherpa-rs/src/diarize.rs
new file mode 100644
index 0000000..74c30f1
--- /dev/null
+++ b/crates/sherpa-rs/src/diarize.rs
@@ -0,0 +1,169 @@
+use crate::{get_default_provider, utils::cstring_from_str};
+use eyre::{bail, Result};
+use std::{path::Path, ptr::null_mut};
+
+#[derive(Debug)]
+pub struct Diarize {
+ sd: *const sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarization,
+}
+
+#[derive(Debug, Clone)]
+pub struct Segment {
+ pub start: f32,
+ pub end: f32,
+ pub speaker: i32,
+}
+
+type ProgressCallback = Box i32) + Send + 'static>;
+
+#[derive(Debug, Clone)]
+pub struct DiarizeConfig {
+ pub num_clusters: Option,
+ pub threshold: Option,
+ pub min_duration_on: Option,
+ pub min_duration_off: Option,
+ pub provider: Option,
+ pub debug: bool,
+}
+
+impl Default for DiarizeConfig {
+ fn default() -> Self {
+ Self {
+ num_clusters: Some(4),
+ threshold: Some(0.5),
+ min_duration_on: Some(0.0),
+ min_duration_off: Some(0.0),
+ provider: None,
+ debug: false,
+ }
+ }
+}
+
+impl Diarize {
+ pub fn new>(
+ segmentation_model: P,
+ embedding_model: P,
+ config: DiarizeConfig,
+ ) -> Result {
+ let provider = config.provider.unwrap_or(get_default_provider());
+
+ let debug = config.debug;
+ let debug = if debug { 1 } else { 0 };
+
+ let embedding_model = embedding_model.as_ref().to_str().unwrap();
+ let segmentation_model = segmentation_model.as_ref().to_str().unwrap();
+
+ let clustering_config = sherpa_rs_sys::SherpaOnnxFastClusteringConfig {
+ num_clusters: config.num_clusters.unwrap_or(4),
+ threshold: config.threshold.unwrap_or(0.5),
+ };
+
+ let embedding_model = cstring_from_str(embedding_model);
+ let provider = cstring_from_str(&provider.clone());
+ let segmentation_model = cstring_from_str(segmentation_model);
+
+ let config = sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationConfig {
+ embedding: sherpa_rs_sys::SherpaOnnxSpeakerEmbeddingExtractorConfig {
+ model: embedding_model.as_ptr(),
+ num_threads: 1,
+ debug,
+ provider: provider.as_ptr(),
+ },
+ clustering: clustering_config,
+ min_duration_off: config.min_duration_off.unwrap_or(0.0),
+ min_duration_on: config.min_duration_on.unwrap_or(0.0),
+ segmentation: sherpa_rs_sys::SherpaOnnxOfflineSpeakerSegmentationModelConfig {
+ pyannote: sherpa_rs_sys::SherpaOnnxOfflineSpeakerSegmentationPyannoteModelConfig {
+ model: segmentation_model.as_ptr(),
+ },
+ num_threads: 1,
+ debug,
+ provider: provider.as_ptr(),
+ },
+ };
+
+ let sd = unsafe { sherpa_rs_sys::SherpaOnnxCreateOfflineSpeakerDiarization(&config) };
+
+ if sd.is_null() {
+ bail!("Failed to initialize offline speaker diarization");
+ }
+ Ok(Self { sd })
+ }
+
+ pub fn compute(
+ &mut self,
+ mut samples: Vec,
+ progress_callback: Option,
+ ) -> Result> {
+ let samples_ptr = samples.as_mut_ptr();
+ let mut segments = Vec::new();
+ unsafe {
+ let mut callback_box =
+ progress_callback.map(|cb| Box::new(cb) as Box);
+ let callback_ptr = callback_box
+ .as_mut()
+ .map(|b| b.as_mut() as *mut ProgressCallback as *mut std::ffi::c_void)
+ .unwrap_or(null_mut());
+
+ let result = sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationProcessWithCallback(
+ self.sd,
+ samples_ptr,
+ samples.len() as i32,
+ if callback_box.is_some() {
+ Some(progress_callback_wrapper)
+ } else {
+ None
+ },
+ callback_ptr,
+ );
+
+ let num_segments =
+ sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationResultGetNumSegments(result);
+ let segments_ptr: *const sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationSegment =
+ sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime(result);
+
+ if !segments_ptr.is_null() && num_segments > 0 {
+ let segments_result: &[
+ sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationSegment
+ ] = std::slice::from_raw_parts(segments_ptr, num_segments as usize);
+
+ for segment in segments_result {
+ // Use segment here
+
+ segments.push(Segment {
+ start: segment.start,
+ end: segment.end,
+ speaker: segment.speaker,
+ });
+ }
+ } else {
+ bail!("No segments found or invalid pointer.");
+ }
+
+ sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationDestroySegment(segments_ptr);
+ sherpa_rs_sys::SherpaOnnxOfflineSpeakerDiarizationDestroyResult(result);
+
+ Ok(segments)
+ }
+ }
+}
+
+unsafe extern "C" fn progress_callback_wrapper(
+ num_processed_chunk: i32,
+ num_total_chunks: i32,
+ arg: *mut std::ffi::c_void,
+) -> i32 {
+ let callback = &mut *(arg as *mut ProgressCallback);
+ callback(num_processed_chunk, num_total_chunks)
+}
+
+unsafe impl Send for Diarize {}
+unsafe impl Sync for Diarize {}
+
+impl Drop for Diarize {
+ fn drop(&mut self) {
+ unsafe {
+ sherpa_rs_sys::SherpaOnnxDestroyOfflineSpeakerDiarization(self.sd);
+ }
+ }
+}
diff --git a/crates/sherpa-rs/src/dolphin.rs b/crates/sherpa-rs/src/dolphin.rs
new file mode 100644
index 0000000..985b7c8
--- /dev/null
+++ b/crates/sherpa-rs/src/dolphin.rs
@@ -0,0 +1,131 @@
+use crate::{get_default_provider, utils::cstring_from_str};
+use eyre::{bail, Result};
+use std::mem;
+
+#[derive(Debug)]
+pub struct DolphinRecognizer {
+ recognizer: *const sherpa_rs_sys::SherpaOnnxOfflineRecognizer,
+}
+
+pub type DolphinRecognizerResult = super::OfflineRecognizerResult;
+
+#[derive(Debug, Clone)]
+pub struct DolphinConfig {
+ pub model: String,
+ pub tokens: String,
+ pub decoding_method: String,
+
+ pub provider: Option,
+ pub num_threads: Option,
+ pub debug: bool,
+}
+
+impl Default for DolphinConfig {
+ fn default() -> Self {
+ Self {
+ model: String::new(),
+ tokens: String::new(),
+ decoding_method: String::from("greedy_search"),
+ debug: false,
+ provider: None,
+ num_threads: Some(1),
+ }
+ }
+}
+
+impl DolphinRecognizer {
+ pub fn new(config: DolphinConfig) -> Result {
+ let debug = config.debug.into();
+ let provider = config.provider.unwrap_or(get_default_provider());
+
+ let provider_ptr = cstring_from_str(&provider);
+ let num_threads = config.num_threads.unwrap_or(2);
+ let model_ptr = cstring_from_str(&config.model);
+ let tokens_ptr = cstring_from_str(&config.tokens);
+ let decoding_method_ptr = cstring_from_str(&config.decoding_method);
+
+ let model_config = unsafe {
+ sherpa_rs_sys::SherpaOnnxOfflineModelConfig {
+ debug,
+ num_threads,
+ provider: provider_ptr.as_ptr(),
+ dolphin: sherpa_rs_sys::SherpaOnnxOfflineDolphinModelConfig {
+ model: model_ptr.as_ptr(),
+ },
+ tokens: tokens_ptr.as_ptr(),
+
+ // Zeros
+ nemo_ctc: mem::zeroed::<_>(),
+ paraformer: mem::zeroed::<_>(),
+ tdnn: mem::zeroed::<_>(),
+ telespeech_ctc: mem::zeroed::<_>(),
+ fire_red_asr: mem::zeroed::<_>(),
+ transducer: mem::zeroed::<_>(),
+ whisper: mem::zeroed::<_>(),
+ sense_voice: mem::zeroed::<_>(),
+ moonshine: mem::zeroed::<_>(),
+ bpe_vocab: mem::zeroed::<_>(),
+ model_type: mem::zeroed::<_>(),
+ modeling_unit: mem::zeroed::<_>(),
+ }
+ };
+
+ let config = unsafe {
+ sherpa_rs_sys::SherpaOnnxOfflineRecognizerConfig {
+ decoding_method: decoding_method_ptr.as_ptr(),
+ model_config,
+ feat_config: sherpa_rs_sys::SherpaOnnxFeatureConfig {
+ sample_rate: 16000,
+ feature_dim: 80,
+ },
+ hotwords_file: mem::zeroed::<_>(),
+ hotwords_score: mem::zeroed::<_>(),
+ lm_config: mem::zeroed::<_>(),
+ max_active_paths: mem::zeroed::<_>(),
+ rule_fars: mem::zeroed::<_>(),
+ rule_fsts: mem::zeroed::<_>(),
+ blank_penalty: mem::zeroed::<_>(),
+ hr: mem::zeroed::<_>(),
+ }
+ };
+
+ let recognizer = unsafe { sherpa_rs_sys::SherpaOnnxCreateOfflineRecognizer(&config) };
+
+ if recognizer.is_null() {
+ bail!("Failed to create recognizer");
+ }
+
+ Ok(Self { recognizer })
+ }
+
+ pub fn transcribe(&mut self, sample_rate: u32, samples: &[f32]) -> DolphinRecognizerResult {
+ unsafe {
+ let stream = sherpa_rs_sys::SherpaOnnxCreateOfflineStream(self.recognizer);
+ sherpa_rs_sys::SherpaOnnxAcceptWaveformOffline(
+ stream,
+ sample_rate as i32,
+ samples.as_ptr(),
+ samples.len().try_into().unwrap(),
+ );
+ sherpa_rs_sys::SherpaOnnxDecodeOfflineStream(self.recognizer, stream);
+ let result_ptr = sherpa_rs_sys::SherpaOnnxGetOfflineStreamResult(stream);
+ let raw_result = result_ptr.read();
+ let result = DolphinRecognizerResult::new(&raw_result);
+ // Free
+ sherpa_rs_sys::SherpaOnnxDestroyOfflineRecognizerResult(result_ptr);
+ sherpa_rs_sys::SherpaOnnxDestroyOfflineStream(stream);
+ result
+ }
+ }
+}
+
+unsafe impl Send for DolphinRecognizer {}
+unsafe impl Sync for DolphinRecognizer {}
+
+impl Drop for DolphinRecognizer {
+ fn drop(&mut self) {
+ unsafe {
+ sherpa_rs_sys::SherpaOnnxDestroyOfflineRecognizer(self.recognizer);
+ }
+ }
+}
diff --git a/src/embedding_manager.rs b/crates/sherpa-rs/src/embedding_manager.rs
similarity index 86%
rename from src/embedding_manager.rs
rename to crates/sherpa-rs/src/embedding_manager.rs
index 345ab93..f4f67fb 100644
--- a/src/embedding_manager.rs
+++ b/crates/sherpa-rs/src/embedding_manager.rs
@@ -1,7 +1,5 @@
+use crate::utils::{cstr_to_string, cstring_from_str};
use eyre::{bail, Result};
-use std::ffi::{CStr, CString};
-
-use crate::cstr_to_string;
#[derive(Debug, Clone)]
pub struct EmbeddingManager {
@@ -32,8 +30,8 @@ impl EmbeddingManager {
if name.is_null() {
return None;
}
- let cstr = CStr::from_ptr(name);
- Some(cstr.to_str().unwrap_or_default().to_string())
+ let name = cstr_to_string(name as _);
+ Some(name)
}
}
@@ -59,7 +57,7 @@ impl EmbeddingManager {
let mut matches: Vec = Vec::new();
for i in 0..result.count {
let match_c = matches_c[i as usize];
- let name = cstr_to_string!(match_c.name);
+ let name = cstr_to_string(match_c.name as _);
let score = match_c.score;
matches.push(SpeakerMatch { name, score });
}
@@ -69,16 +67,16 @@ impl EmbeddingManager {
}
pub fn add(&mut self, name: String, embedding: &mut [f32]) -> Result<()> {
- let name_cstr = CString::new(name.clone())?;
-
+ let name_c = cstring_from_str(&name.clone());
unsafe {
let status = sherpa_rs_sys::SherpaOnnxSpeakerEmbeddingManagerAdd(
self.manager,
- name_cstr.into_raw(),
+ name_c.as_ptr(),
embedding.as_mut_ptr(),
);
+
if status.is_negative() {
- bail!("Failed to register {}", name)
+ bail!("Failed to register {}", name);
}
Ok(())
}
@@ -92,6 +90,6 @@ impl Drop for EmbeddingManager {
fn drop(&mut self) {
unsafe {
sherpa_rs_sys::SherpaOnnxDestroySpeakerEmbeddingManager(self.manager);
- };
+ }
}
}
diff --git a/crates/sherpa-rs/src/keyword_spot.rs b/crates/sherpa-rs/src/keyword_spot.rs
new file mode 100644
index 0000000..941838d
--- /dev/null
+++ b/crates/sherpa-rs/src/keyword_spot.rs
@@ -0,0 +1,161 @@
+use std::mem;
+
+use crate::{
+ get_default_provider,
+ utils::{cstr_to_string, cstring_from_str},
+};
+use eyre::{bail, Result};
+
+#[derive(Debug, Clone)]
+pub struct KeywordSpotConfig {
+ pub zipformer_encoder: String,
+ pub zipformer_decoder: String,
+ pub zipformer_joiner: String,
+
+ pub tokens: String,
+ pub keywords: String,
+ pub max_active_path: i32,
+ pub keywords_threshold: f32,
+ pub keywords_score: f32,
+
+ pub num_trailing_blanks: i32,
+
+ pub sample_rate: i32,
+ pub feature_dim: i32,
+
+ pub debug: bool,
+ pub num_threads: Option,
+ pub provider: Option,
+}
+
+impl Default for KeywordSpotConfig {
+ fn default() -> Self {
+ Self {
+ keywords_threshold: 0.1,
+ max_active_path: 4,
+ keywords_score: 3.0,
+ keywords: String::new(),
+ tokens: String::new(),
+
+ sample_rate: 16000,
+ feature_dim: 80,
+ num_trailing_blanks: 1,
+
+ zipformer_decoder: String::new(),
+ zipformer_encoder: String::new(),
+ zipformer_joiner: String::new(),
+
+ debug: false,
+ num_threads: None,
+ provider: Some("cpu".into()),
+ }
+ }
+}
+
+pub struct KeywordSpot {
+ spotter: *const sherpa_rs_sys::SherpaOnnxKeywordSpotter,
+ stream: *const sherpa_rs_sys::SherpaOnnxOnlineStream,
+}
+
+impl KeywordSpot {
+ // Create new keyboard spotter along with stream
+ // Ready for streaming or regular use
+ pub fn new(config: KeywordSpotConfig) -> Result {
+ let provider = cstring_from_str(&config.provider.unwrap_or(get_default_provider()));
+
+ let zipformer_encoder = cstring_from_str(&config.zipformer_encoder);
+ let zipformer_decoder = cstring_from_str(&config.zipformer_decoder);
+ let zipformer_joiner = cstring_from_str(&config.zipformer_joiner);
+
+ let tokens = cstring_from_str(&config.tokens);
+ let keywords = cstring_from_str(&config.keywords);
+
+ let sherpa_config = unsafe {
+ sherpa_rs_sys::SherpaOnnxKeywordSpotterConfig {
+ feat_config: sherpa_rs_sys::SherpaOnnxFeatureConfig {
+ sample_rate: config.sample_rate,
+ feature_dim: config.feature_dim,
+ },
+ keywords_buf: mem::zeroed::<_>(),
+ keywords_buf_size: 0,
+ keywords_file: keywords.as_ptr(),
+ max_active_paths: config.max_active_path,
+ keywords_score: config.keywords_score,
+ keywords_threshold: config.keywords_threshold,
+ num_trailing_blanks: config.num_trailing_blanks,
+ model_config: sherpa_rs_sys::SherpaOnnxOnlineModelConfig {
+ transducer: sherpa_rs_sys::SherpaOnnxOnlineTransducerModelConfig {
+ encoder: zipformer_encoder.as_ptr(),
+ decoder: zipformer_decoder.as_ptr(),
+ joiner: zipformer_joiner.as_ptr(),
+ },
+ num_threads: config.num_threads.unwrap_or(1),
+ provider: provider.as_ptr(),
+ debug: config.debug.into(),
+ tokens: tokens.as_ptr(),
+
+ paraformer: mem::zeroed::<_>(),
+ zipformer2_ctc: mem::zeroed::<_>(),
+ model_type: mem::zeroed::<_>(),
+ modeling_unit: mem::zeroed::<_>(),
+ bpe_vocab: mem::zeroed::<_>(),
+ tokens_buf: mem::zeroed::<_>(),
+ tokens_buf_size: mem::zeroed::<_>(),
+ },
+ }
+ };
+ let spotter = unsafe { sherpa_rs_sys::SherpaOnnxCreateKeywordSpotter(&sherpa_config) };
+
+ if spotter.is_null() {
+ bail!("Failed to create keyword spotter");
+ }
+ let stream = unsafe { sherpa_rs_sys::SherpaOnnxCreateKeywordStream(spotter) };
+ if stream.is_null() {
+ bail!("Failed to create SherpaOnnx keyword stream");
+ }
+
+ Ok(Self { spotter, stream })
+ }
+
+ pub fn extract_keyword(
+ &mut self,
+ samples: Vec,
+ sample_rate: u32,
+ ) -> Result