flite 0.0.3.1 → 0.1.0

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.
@@ -36,12 +36,22 @@ RUBY_VERSION =~ /(\d+).(\d+)/
36
36
  require "flite_#{$1}#{$2}0"
37
37
 
38
38
  module Flite
39
+ # @private
39
40
  @@default_voice = Flite::Voice.new
40
41
 
42
+ # Returns the voice used by {String#speak} and {String#to_speech}.
43
+ #
44
+ # @return [Flite::Voice]
41
45
  def self.default_voice
42
46
  @@default_voice
43
47
  end
44
48
 
49
+ # Set the voice used by {String#speak} and {String#to_speech}.
50
+ # When <code>name</code> is a {Flite::Voice}, use it.
51
+ # Otherwise, use a new voice created by <code>Flite::Voice.new(name)</code>.
52
+ #
53
+ # @param [Flite::Voice or String] name voice or voice name
54
+ # @see Flite::Voice#initialize
45
55
  def self.default_voice=(name)
46
56
  if name.is_a? Flite::Voice
47
57
  @@default_voice = name
@@ -49,10 +59,43 @@ module Flite
49
59
  @@default_voice = Flite::Voice.new(name)
50
60
  end
51
61
  end
62
+
63
+ if RUBY_PLATFORM =~ /mingw32|win32/
64
+ self.sleep_time_after_speaking = 0.3
65
+ end
52
66
  end
53
67
 
54
68
  class String
55
- def to_speech(out = nil)
56
- Flite.default_voice.speech(self, out)
69
+ # Speaks <code>self</code>
70
+ #
71
+ # @example
72
+ # "Hello Flite World!".speak
73
+ def speak
74
+ Flite.default_voice.speak(self)
75
+ end
76
+
77
+ # @overload to_speech(audio_type = :wave, opts = {})
78
+ #
79
+ # Converts <code>self</code> to audio data.
80
+ #
81
+ # @example
82
+ # # Save speech as wav
83
+ # File.binwrite('hello_flite_world.wav',
84
+ # 'Hello Flite World!'.to_speech())
85
+ #
86
+ # # Save speech as mp3
87
+ # File.binwrite('hello_flite_world.mp3',
88
+ # 'Hello Flite World!'to_speech(:mp3))
89
+ #
90
+ # # Save speech as mp3 whose bitrate is 128k.
91
+ # File.binwrite('hello_flite_world.mp3',
92
+ # 'Hello Flite World!'.to_speech(:mp3, :bitrate => 128))
93
+ #
94
+ # @param [Symbol] audo_type :wave or :mp3 (when mp3 support is enabled)
95
+ # @param [Hash] opts audio encoder options
96
+ # @return [String] audio data
97
+ # @see Flite.supported_audio_types
98
+ def to_speech(*args)
99
+ Flite.default_voice.to_speech(self, *args)
57
100
  end
58
101
  end
@@ -1,3 +1,3 @@
1
1
  module Flite
2
- VERSION = "0.0.3.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kubo Takehiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,8 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: |
56
- Ruby-flite is a small speech synthesis library using CMU flite[http://cmuflite.org].
56
+ Ruby-flite is a small speech synthesis library for ruby using
57
+ CMU flite[http://cmuflite.org].
57
58
 
58
59
  CMU Flite (festival-lite) is a small, fast run-time synthesis engine
59
60
  developed at CMU and primarily designed for small embedded machines
@@ -63,7 +64,8 @@ description: |
63
64
  email:
64
65
  - kubo@jiubao.org
65
66
  executables:
66
- - saytime.rb
67
+ - saytime
68
+ - speaking-web-server
67
69
  extensions:
68
70
  - ext/flite/extconf.rb
69
71
  extra_rdoc_files: []
@@ -72,10 +74,12 @@ files:
72
74
  - LICENSE.txt
73
75
  - README.md
74
76
  - Rakefile
75
- - bin/saytime.rb
77
+ - bin/saytime
78
+ - bin/speaking-web-server
76
79
  - ext/flite/extconf.rb
77
80
  - ext/flite/rbflite.c
78
81
  - ext/flite/rbflite.h
82
+ - ext/flite/win32_binary_gem.c
79
83
  - flite.gemspec
80
84
  - lib/flite.rb
81
85
  - lib/flite/version.rb