Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Oct 20, 2023
1 parent a05b001 commit 23d99a4
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 112 deletions.
122 changes: 121 additions & 1 deletion .github/workflows/test-go-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '>=1.20'
go-version: '>=1.12'

- name: Display go version
shell: bash
Expand All @@ -66,6 +66,121 @@ jobs:
run: |
gcc --version
- name: Test non-streaming TTS (Linux/macOS)
if: matrix.os != 'windows-latest'
shell: bash
run: |
mkdir tts-waves
cd go-api-examples/non-streaming-tts
ls -lh
go mod tidy
cat go.mod
go build
ls -lh
git lfs install
echo "Test vits-ljs"
git clone https://huggingface.co/csukuangfj/vits-ljs
./run-vits-ljs.sh
rm -rf vits-ljs
echo "Test vits-vctk"
git clone https://huggingface.co/csukuangfj/vits-vctk
./run-vits-vctk.sh
rm -rf vits-vctk
echo "Test vits-zh-aishell3"
git clone https://huggingface.co/csukuangfj/vits-zh-aishell3
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
ls -lh *.wav
cp *.wav ../../tts-waves/
- name: Test non-streaming TTS (Win64)
if: matrix.os == 'windows-latest' && matrix.arch == 'x64'
shell: bash
run: |
mkdir tts-waves
cd go-api-examples/non-streaming-tts
ls -lh
go mod tidy
cat go.mod
go build
ls -lh
echo $PWD
ls -lh /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/
ls -lh /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/*
cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/x86_64-pc-windows-gnu/*.dll .
ls -lh
git lfs install
echo "Test vits-ljs"
git clone https://huggingface.co/csukuangfj/vits-ljs
./run-vits-ljs.sh
rm -rf vits-ljs
echo "Test vits-vctk"
git clone https://huggingface.co/csukuangfj/vits-vctk
./run-vits-vctk.sh
rm -rf vits-vctk
echo "Test vits-zh-aishell3"
git clone https://huggingface.co/csukuangfj/vits-zh-aishell3
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
ls -lh *.wav
cp *.wav ../../tts-waves/
- name: Test non-streaming TTS (Win32)
if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
shell: bash
run: |
cd go-api-examples/non-streaming-tts
ls -lh
go mod tidy
cat go.mod
ls -lh
go env GOARCH
go env
echo "------------------------------"
go env -w GOARCH=386
go env -w CGO_ENABLED=1
go env
go clean
go build
echo $PWD
ls -lh /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/
cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/i686-pc-windows-gnu/*.dll .
ls -lh
git lfs install
echo "Test vits-ljs"
git clone https://huggingface.co/csukuangfj/vits-ljs
./run-vits-ljs.sh
rm -rf vits-ljs
echo "Test vits-vctk"
git clone https://huggingface.co/csukuangfj/vits-vctk
./run-vits-vctk.sh
rm -rf vits-vctk
echo "Test vits-zh-aishell3"
git clone https://huggingface.co/csukuangfj/vits-zh-aishell3
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
ls -lh *.wav
cp *.wav ../../tts-waves/
- name: Test non-streaming decoding files (Linux/macOS)
if: matrix.os != 'windows-latest'
shell: bash
Expand Down Expand Up @@ -298,3 +413,8 @@ jobs:
git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en
./run-paraformer.sh
rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en
- uses: actions/upload-artifact@v3
with:
name: tts-waves
path: tts-waves
6 changes: 0 additions & 6 deletions go-api-examples/non-streaming-decode-files/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
module non-streaming-decode-files

go 1.12

require (
github.com/k2-fsa/sherpa-onnx-go v1.7.12-alpha
github.com/spf13/pflag v1.0.5
github.com/youpy/go-wav v0.3.2
)
35 changes: 0 additions & 35 deletions go-api-examples/non-streaming-decode-files/go.sum

This file was deleted.

8 changes: 6 additions & 2 deletions go-api-examples/non-streaming-tts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ func main() {
log.Println("Output filename:", filename)

log.Println("Initializing model (may take several seconds)")

tts := sherpa.NewOfflineTts(&config)
log.Println("Model created!")
defer sherpa.DeleteOfflineTts(tts)

log.Println("Model created!")

log.Println("Start generating!")

audio := tts.Generate(text, sid)

log.Println("Done!")

ok := audio.Save(filename)
if ok != 1 {
log.Fatalf("Failed to write", filename)
}

log.Println("Done!")
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
module real-time-speech-recognition-from-microphone

go 1.12

require (
github.com/gordonklaus/portaudio v0.0.0-20230709114228-aafa478834f5
github.com/k2-fsa/sherpa-onnx-go v1.7.12-alpha
github.com/spf13/pflag v1.0.5
)

This file was deleted.

6 changes: 0 additions & 6 deletions go-api-examples/streaming-decode-files/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
module streaming-decode-files

go 1.12

require (
github.com/k2-fsa/sherpa-onnx-go v1.7.12-alpha
github.com/spf13/pflag v1.0.5
github.com/youpy/go-wav v0.3.2
)
35 changes: 0 additions & 35 deletions go-api-examples/streaming-decode-files/go.sum

This file was deleted.

5 changes: 0 additions & 5 deletions scripts/go/_internal/non-streaming-tts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@ module non-streaming-tts
go 1.12

replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../

require (
github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5
)
2 changes: 0 additions & 2 deletions scripts/go/_internal/non-streaming-tts/go.sum

This file was deleted.

3 changes: 1 addition & 2 deletions scripts/go/sherpa_onnx.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ func (tts *OfflineTts) Generate(text string, sid int) *GeneratedAudio {
defer C.free(unsafe.Pointer(s))

audio := C.SherpaOnnxOfflineTtsGenerate(tts.impl, s, C.int(sid))
defer C.SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio)

ans := &GeneratedAudio{}
ans.SampleRate = int(audio.sample_rate)
Expand All @@ -588,8 +589,6 @@ func (tts *OfflineTts) Generate(text string, sid int) *GeneratedAudio {
ans.Samples[i] = float32(samples[i])
}

C.SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio)

return ans
}

Expand Down

0 comments on commit 23d99a4

Please sign in to comment.