Skip to content

Commit

Permalink
add default parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
solaoi committed Jul 17, 2023
1 parent c149447 commit b6899b9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ curl -X POST -H "Content-Type: application/json" -d '@sample.json' localhost:999
RequestBody (JSON Format) is below.
see a sample [here](https://raw.githubusercontent.com/solaoi/voicepeaky/main/sample.json).

| Field | Type | Sample |
| ------------- | ----------------------- | --------------------- |
| - (parent) | JSONObject | - |
| narrator | string*1 | "Japanese Male Child" |
| emotion | JSONObject | - |
| emotion/happy | number(0 - 100) | 0 |
| emotion/fun | number(0 - 100) | 0 |
| emotion/angry | number(0 - 100) | 0 |
| emotion/sad | number(0 - 100) | 0 |
| speed | number(50 - 200) | 100 |
| pitch | number(-300 - 300) | 0 |
| text | string | "こんにちは" |
| Field | Type | Default | Required |
| ------------- | ----------------------- | ------------------- | -------- |
| narrator | string*1 | "Japanese Female 1" | false |
| emotion | JSONObject | - | false |
| emotion/happy | number(0 - 100) | 0 | false |
| emotion/fun | number(0 - 100) | 0 | false |
| emotion/angry | number(0 - 100) | 0 | false |
| emotion/sad | number(0 - 100) | 0 | false |
| speed | number(50 - 200) | 100 | false |
| pitch | number(-300 - 300) | 0 | false |
| text | string | - | true |

*1
| Types of Narrators | Requirements |
Expand Down Expand Up @@ -78,7 +77,7 @@ brew upgrade voicepeaky
```sh
# Install with wget or curl
## set the latest version on releases.
VERSION=v1.0.3
VERSION=v1.0.4
## set the OS you use. (macos)
OS=linux
## case you use wget
Expand Down
14 changes: 7 additions & 7 deletions src/speech.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ type
proc createSpeech*(json:JsonNode, text:string) :Speech=
result = new Speech
try:
result.narrator = json["narrator"].getStr
result.happy = json["emotion"]["happy"].getInt
result.fun = json["emotion"]["fun"].getInt
result.angry = json["emotion"]["angry"].getInt
result.sad = json["emotion"]["sad"].getInt
result.speed = json["speed"].getInt
result.pitch = json["pitch"].getInt
result.narrator = json{"narrator"}.getStr("Japanese Female 1")
result.happy = json{"emotion"}{"happy"}.getInt(0)
result.fun = json{"emotion"}{"fun"}.getInt(0)
result.angry = json{"emotion"}{"angry"}.getInt(0)
result.sad = json{"emotion"}{"sad"}.getInt(0)
result.speed = json{"speed"}.getInt(100)
result.pitch = json{"pitch"}.getInt(0)
result.text = text
except:
raise newException(SpeechInitError, fmt"request body is invalid")
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.3"
version = "1.0.4"
author = "solaoi"
description = "Voicepeak Server"
license = "MIT"
Expand Down

0 comments on commit b6899b9

Please sign in to comment.