From d5db03d6f56649da64087971f5311c6288a3097c Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sun, 10 Dec 2023 15:43:49 +0800 Subject: [PATCH 1/2] Fix audio track buffer size --- .../app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/SherpaOnnxTts/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt b/android/SherpaOnnxTts/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt index 4cf88e158c..b2e4890d61 100644 --- a/android/SherpaOnnxTts/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt +++ b/android/SherpaOnnxTts/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt @@ -61,7 +61,11 @@ class MainActivity : AppCompatActivity() { private fun initAudioTrack() { val sampleRate = tts.sampleRate() - val bufLength = (sampleRate * 0.1).toInt() + val bufLength = AudioTrack.getMinBufferSize( + sampleRate, + AudioFormat.CHANNEL_OUT_MONO, + AudioFormat.ENCODING_PCM_FLOAT + ) Log.i(TAG, "sampleRate: ${sampleRate}, buffLength: ${bufLength}") val attr = AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) From a654b61c8ca0aea1ad3196e0ccf1d523b23c3dc8 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Sun, 10 Dec 2023 17:47:20 +0800 Subject: [PATCH 2/2] Fix CI --- .github/workflows/apk-tts.yaml | 4 ++-- .github/workflows/test-build-wheel.yaml | 2 +- .github/workflows/test-go.yaml | 5 ----- .github/workflows/test-pip-install.yaml | 2 +- scripts/apk/generate-tts-apk-script.py | 9 +++++++-- scripts/go/_internal/.gitignore | 1 + scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh | 1 + .../run-vits-piper-en_US-lessac-medium.sh | 1 + scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh | 1 + .../_internal/non-streaming-tts/run-vits-zh-aishell3.sh | 1 + 10 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 scripts/go/_internal/.gitignore create mode 120000 scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh create mode 120000 scripts/go/_internal/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh create mode 120000 scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh create mode 120000 scripts/go/_internal/non-streaming-tts/run-vits-zh-aishell3.sh diff --git a/.github/workflows/apk-tts.yaml b/.github/workflows/apk-tts.yaml index 6672cc5002..2180adacbf 100644 --- a/.github/workflows/apk-tts.yaml +++ b/.github/workflows/apk-tts.yaml @@ -26,8 +26,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - total: ["30"] - index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"] + total: ["40"] + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-build-wheel.yaml b/.github/workflows/test-build-wheel.yaml index ddbc409977..c82d361c6f 100644 --- a/.github/workflows/test-build-wheel.yaml +++ b/.github/workflows/test-build-wheel.yaml @@ -74,7 +74,7 @@ jobs: export PATH=/c/hostedtoolcache/windows/Python/3.8.10/x64/bin:$PATH export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH - export PATH=/c/hostedtoolcache/windows/Python/3.11.6/x64/bin:$PATH + export PATH=/c/hostedtoolcache/windows/Python/3.11.7/x64/bin:$PATH which sherpa-onnx sherpa-onnx --help diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index e1d3038f4c..1ea5888ee9 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -65,8 +65,6 @@ jobs: run: | mkdir tts-waves - cp -v go-api-examples/non-streaming-tts/*.sh scripts/go/_internal/non-streaming-tts/ - cd scripts/go/_internal/non-streaming-tts/ ls -lh go mod tidy @@ -106,8 +104,6 @@ jobs: - name: Test non-streaming decoding files (macOS) shell: bash run: | - cp -v go-api-examples/non-streaming-decode-files/*.sh scripts/go/_internal/non-streaming-decode-files/ - cd scripts/go/_internal/non-streaming-decode-files/ ls -lh go mod tidy @@ -148,7 +144,6 @@ jobs: - name: Test streaming decoding files shell: bash run: | - cp -v go-api-examples/streaming-decode-files/*.sh scripts/go/_internal/streaming-decode-files cd scripts/go/_internal/streaming-decode-files ls -lh go mod tidy diff --git a/.github/workflows/test-pip-install.yaml b/.github/workflows/test-pip-install.yaml index aebbc2891e..587258f816 100644 --- a/.github/workflows/test-pip-install.yaml +++ b/.github/workflows/test-pip-install.yaml @@ -66,7 +66,7 @@ jobs: export PATH=/c/hostedtoolcache/windows/Python/3.8.10/x64/bin:$PATH export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH - export PATH=/c/hostedtoolcache/windows/Python/3.11.6/x64/bin:$PATH + export PATH=/c/hostedtoolcache/windows/Python/3.11.7/x64/bin:$PATH sherpa-onnx --help diff --git a/scripts/apk/generate-tts-apk-script.py b/scripts/apk/generate-tts-apk-script.py index 25471c8ac6..da944dbde1 100755 --- a/scripts/apk/generate-tts-apk-script.py +++ b/scripts/apk/generate-tts-apk-script.py @@ -250,11 +250,16 @@ def main(): start = index * num_per_runner end = start + num_per_runner - if index == args.total - 1: - end = num_models + + remaining = num_models - args.total * num_per_runner print(f"{index}/{total}: {start}-{end}/{num_models}") d["tts_model_list"] = all_model_list[start:end] + if index < remaining: + s = args.total * num_per_runner + index + d["tts_model_list"].append(all_model_list[s]) + print(f"{s}/{num_models}") + s = template.render(**d) with open("./build-apk-tts.sh", "w") as f: print(s, file=f) diff --git a/scripts/go/_internal/.gitignore b/scripts/go/_internal/.gitignore new file mode 100644 index 0000000000..6af50295b3 --- /dev/null +++ b/scripts/go/_internal/.gitignore @@ -0,0 +1 @@ +!*.sh diff --git a/scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh b/scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh new file mode 120000 index 0000000000..16eea28c37 --- /dev/null +++ b/scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh @@ -0,0 +1 @@ +../../../../go-api-examples/non-streaming-tts/run-vits-ljs.sh \ No newline at end of file diff --git a/scripts/go/_internal/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh b/scripts/go/_internal/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh new file mode 120000 index 0000000000..bceddb70a9 --- /dev/null +++ b/scripts/go/_internal/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh @@ -0,0 +1 @@ +../../../../go-api-examples/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh \ No newline at end of file diff --git a/scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh b/scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh new file mode 120000 index 0000000000..0f8326fb6b --- /dev/null +++ b/scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh @@ -0,0 +1 @@ +../../../../go-api-examples/non-streaming-tts/run-vits-vctk.sh \ No newline at end of file diff --git a/scripts/go/_internal/non-streaming-tts/run-vits-zh-aishell3.sh b/scripts/go/_internal/non-streaming-tts/run-vits-zh-aishell3.sh new file mode 120000 index 0000000000..1ffaaf2251 --- /dev/null +++ b/scripts/go/_internal/non-streaming-tts/run-vits-zh-aishell3.sh @@ -0,0 +1 @@ +../../../../go-api-examples/non-streaming-tts/run-vits-zh-aishell3.sh \ No newline at end of file