Skip to content

Commit

Permalink
fix synthesis duration test regression - round 2 (#69)
Browse files Browse the repository at this point in the history
* fix synthesis duration test regression - round 2

* also test on macos 12

* revert

Co-authored-by: Yulin Li <[email protected]>
  • Loading branch information
yulin-li and Yulin Li authored Jun 9, 2022
1 parent 07fc8e6 commit 731ff62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
go: [1.13, 1.15, 1.16]
go: [1.13, 1.17, 1.18]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
Expand Down
6 changes: 4 additions & 2 deletions speech/speech_synthesizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ func TestSynthesizerEvents(t *testing.T) {
defer event.Close()
t.Logf("SynthesisCompleted, audio length %d", len(event.Result.AudioData))
checkSynthesisResult(t, &event.Result, common.SynthesizingAudioCompleted)
if !almostEqual((float64)(event.Result.AudioDuration/time.Millisecond), (float64)(len(event.Result.AudioData)/32), 100) {
t.Errorf("Synthesis duration incorrect")
durationFromProperty := (float64)(event.Result.AudioDuration/time.Millisecond)
durationFromAudioBuffer := (float64)(len(event.Result.AudioData)/32)
if !almostEqual(durationFromProperty, durationFromAudioBuffer, 150) {
t.Errorf("Synthesis duration incorrect (%.2f vs %.2f)", durationFromProperty, durationFromAudioBuffer)
}
synthesisCompletedFuture <- "synthesisCompletedFuture"
})
Expand Down

0 comments on commit 731ff62

Please sign in to comment.