Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
solaoi committed Jul 14, 2023
1 parent 45714d7 commit 9ad0e3c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ brew upgrade voicepeaky
```sh
# Install with wget or curl
## set the latest version on releases.
VERSION=v1.0.0
VERSION=v1.0.1
## set the OS you use. (macos)
OS=linux
## case you use wget
Expand All @@ -90,3 +90,7 @@ tar xvf ./voicepeaky${OS}.tar.gz
## move it to a location in your $PATH, such as /usr/local/bin.
mv ./voicepeaky /usr/local/bin/
```

## Note

Voicepeak occasionally crashes; Voicepeaky will automatically retry, but if an error popup appears, please close it.
31 changes: 20 additions & 11 deletions src/voicepeaky.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,33 @@ proc pollingFiles() {.thread.} =
for f in walkDir(workspace):
files.add(f.path)
files.sort();
for file in files:
for i, file in files:
let _ = execCmd("afplay " & file)
removeFile(file)
if i == files.len - 1:
removeFile(file)
else:
spawn removeFile(file)

proc pollingSpeeches() {.thread.} =
{.cast(gcsafe).}:
while true:
if speeches.len != 0:
let speech = speeches.pop()
let _ = execCmd("/Applications/voicepeak.app/Contents/MacOS/voicepeak --say " & speech.text &
" --narrator \"" & speech.narrator &
"\" --emotion happy=" & $speech.happy &
",fun=" & $speech.fun &
",angry=" & $speech.fun &
",sad=" & $speech.fun &
" --speed " & $speech.speed &
" --pitch " & $speech.pitch &
" --out " & workspace & "/" & $now() & ".wav")
let retryLimit = 2
var count = 0
while true:
count += 1
let errCode = execCmd("/Applications/voicepeak.app/Contents/MacOS/voicepeak --say " & speech.text &
" --narrator \"" & speech.narrator &
"\" --emotion happy=" & $speech.happy &
",fun=" & $speech.fun &
",angry=" & $speech.fun &
",sad=" & $speech.fun &
" --speed " & $speech.speed &
" --pitch " & $speech.pitch &
" --out " & workspace & "/" & $now() & ".wav &>/dev/null")
if errCode == 0 or count > retryLimit:
break;

when isMainModule:
if not dirExists(workspace):
Expand Down
2 changes: 1 addition & 1 deletion voicepeaky.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "1.0.0"
version = "1.0.1"
author = "solaoi"
description = "Voicepeak Server"
license = "MIT"
Expand Down

0 comments on commit 9ad0e3c

Please sign in to comment.