Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix android tts audio buffer size and fix CI. #478

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/apk-tts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions .github/workflows/test-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions scripts/apk/generate-tts-apk-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions scripts/go/_internal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.sh
1 change: 1 addition & 0 deletions scripts/go/_internal/non-streaming-tts/run-vits-ljs.sh
1 change: 1 addition & 0 deletions scripts/go/_internal/non-streaming-tts/run-vits-vctk.sh