text2voice 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/text2voice.rb +8 -7
- data/lib/text2voice/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02079d8daee09dc6ec066133d692c323fc9866bd
|
4
|
+
data.tar.gz: 200d45fc5ac79777c741129f99e561dc3e0be1ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d420ca7f8505c32f5e625c6dc42c8612621c1f2fb149eb45acac0c90eb3768de0f07f05cb0d3a9ebe75199c7826a9e688a4a2d6ba1e83bf479e18647e69d7a4c
|
7
|
+
data.tar.gz: e30dc907a6b3a248c24a28fa1c4f3b4a5b3d58752edce2903d818844ab3dcdbddacfb7c2737dc6d5f678127e9e4641b9e7dd62bd31854ca089bb17069b13d9a3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Text2Voice
|
2
2
|
|
3
3
|
This gem is Voice Text Web API(https://cloud.voicetext.jp/webapi/docs/introduction) for Ruby.
|
4
4
|
|
@@ -24,9 +24,9 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
voice.speak("こころぴょんぴょん")
|
26
26
|
.speaker("haruka")
|
27
|
-
.emotion(emotion: :happiness, level: :
|
27
|
+
.emotion(emotion: :happiness, level: :high)
|
28
28
|
|
29
|
-
voice.save_as("test.wav")
|
29
|
+
voice.save_as("test.wav")
|
30
30
|
|
31
31
|
## Contributing
|
32
32
|
|
data/lib/text2voice.rb
CHANGED
@@ -7,7 +7,7 @@ class TextToVoice
|
|
7
7
|
class Unauthoeized < StandardError; end
|
8
8
|
|
9
9
|
ENDPOINT = URI('https://api.voicetext.jp/v1/tts')
|
10
|
-
EMOTION_LEVEL = {
|
10
|
+
EMOTION_LEVEL = { normal: "1", high: "2" }
|
11
11
|
|
12
12
|
def initialize(api_key)
|
13
13
|
@api_key = api_key
|
@@ -22,7 +22,7 @@ class TextToVoice
|
|
22
22
|
self
|
23
23
|
end
|
24
24
|
|
25
|
-
def emotion(emotion
|
25
|
+
def emotion(emotion:, level: :normal)
|
26
26
|
@emotion = emotion.to_s
|
27
27
|
@emotion_level = EMOTION_LEVEL[level]
|
28
28
|
self
|
@@ -38,7 +38,7 @@ class TextToVoice
|
|
38
38
|
self
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def volume(param)
|
42
42
|
@volume = param.to_s
|
43
43
|
self
|
44
44
|
end
|
@@ -50,7 +50,7 @@ class TextToVoice
|
|
50
50
|
|
51
51
|
def save_as(filename)
|
52
52
|
res = send_request()
|
53
|
-
|
53
|
+
|
54
54
|
case res
|
55
55
|
when Net::HTTPOK
|
56
56
|
binary_to_wav(filename, res.body)
|
@@ -64,10 +64,11 @@ class TextToVoice
|
|
64
64
|
end
|
65
65
|
|
66
66
|
private
|
67
|
+
|
67
68
|
def create_request(text, speaker, emotion, emotion_level, pitch, speed, volume)
|
68
69
|
req = Net::HTTP::Post.new(ENDPOINT.path)
|
69
|
-
req.basic_auth(@api_key, '')
|
70
|
-
data = "text=#{text}"
|
70
|
+
req.basic_auth(@api_key, '')
|
71
|
+
data = "text=#{text}"
|
71
72
|
data << ";speaker=#{speaker}"
|
72
73
|
data << ";emotion=#{emotion}"
|
73
74
|
data << ";emotion_level=#{emotion_level}"
|
@@ -75,7 +76,7 @@ class TextToVoice
|
|
75
76
|
data << ";speed=#{speed}"
|
76
77
|
data << ";volume=#{volume}"
|
77
78
|
req.body = data
|
78
|
-
|
79
|
+
|
79
80
|
return req
|
80
81
|
end
|
81
82
|
|
data/lib/text2voice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text2voice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alitaso345
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|