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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c466f1634ec854c56f86aed2a54048fdfd9fe2a1
4
- data.tar.gz: e72bef896934ab2ff48765dcb1becc3c49286848
3
+ metadata.gz: 02079d8daee09dc6ec066133d692c323fc9866bd
4
+ data.tar.gz: 200d45fc5ac79777c741129f99e561dc3e0be1ee
5
5
  SHA512:
6
- metadata.gz: a12014fc82d4b52a4d5dea88a52f451eab7e81d7c1991bd97be8b5e8a9effd6026379861b7b97d6ad2a87585db792c42288a485b7cae7c0e125999a635846212
7
- data.tar.gz: a9ce602b8c60e5e1f1f1554f2537a24699118f4d7bb1e0923f13916972d947959d45b3501c0376bcbb2fea6088b6b83cdc2cf493e82433804d5c597775a122de
6
+ metadata.gz: d420ca7f8505c32f5e625c6dc42c8612621c1f2fb149eb45acac0c90eb3768de0f07f05cb0d3a9ebe75199c7826a9e688a4a2d6ba1e83bf479e18647e69d7a4c
7
+ data.tar.gz: e30dc907a6b3a248c24a28fa1c4f3b4a5b3d58752edce2903d818844ab3dcdbddacfb7c2737dc6d5f678127e9e4641b9e7dd62bd31854ca089bb17069b13d9a3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Text2voice
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: :HIGHT)
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
 
@@ -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 = {HIGHT: "2", ROW: "1", NORMAL: nil}
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: nil, level: NORMAL)
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 volulme(param)
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
 
@@ -1,3 +1,3 @@
1
1
  class TextToVoice
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-21 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler