win32-loquendo 1.1.0-x86-mingw32 → 1.1.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWRhNmQ0OGYxZjA1M2Q0NWEzYWJlZjQ2ZGE1ZDRkNzViY2NhMzU5Nw==
4
+ ODAxYWUzOGM0ZjA2ZmNjNmJlMDEyNTc4YTgxMGVkZDEwY2U2OWM4Ng==
5
5
  data.tar.gz: !binary |-
6
- NGJlMDgwODE3YTJmZTA1MTVmMTMzNDRiZDI4NTZmYTI4MjAxYTVhMw==
6
+ YzRjODVlZTk5OTFmMzRkOGUxM2E3Y2FhMTk5ZmMzZDJlMTljZTQzMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTkyNjFhMTgxNTMxZmY4YzJiOGE3NGE2MTJiZmIzNjA3YzBlZDQzODAxNzJj
10
- MGYxMDE3MjFmM2QyNGU5MDEwNjZhNTlkM2E3OTRmYjk1MzQwZTUzNTViMTMx
11
- NDdlZjE0OGJiNDE0ZmQ1NGE4YjgzNGEzNmRhOTEwMWVmOGY5Y2I=
9
+ MGFmNDk0MDZlNWI1ZmU1YzljODZkMDNhYjBkZmZkMTRhYmU2MzI1NzVlYWJk
10
+ ZTc4MDY4MTJlODA3NWZmNmU3NDA4ZmMzMjlhNTFjMzgzNTZiZDY5MTUzOTUw
11
+ MTA3NTIwYjc3OWQ2ZTBmNmFkNmE2Y2U1YzYyNjU2MzFjMjEwMTU=
12
12
  data.tar.gz: !binary |-
13
- OGNiN2RkMGMxYTVlNjE3ZTQ3YzBjNGFmNGRlNTk0MjVmM2JkY2NmZWFiMTlj
14
- MTJlMzg5YTQ0NDE0MzZjNDJiZjBkNmNlZjYwZmFjYTk4MzFmMjBkMzI1ZWNj
15
- OGU3YWM2NjEyNmI2YmQ1YzQxMzZhODQwMGY1YzM2MDMzOWNiNTA=
13
+ OThkNjgxNDExNzJmNzZlMmZlODRhNTJmN2UzZWRiMmRmMWUzNTBiNmE3NGZj
14
+ M2IxY2QyZGQzYmVmNTM2ODZhY2M3ZjdhZTA1MWNjZGFlNTU0MGQ4OWQ0YjAy
15
+ M2IyYTFkMmE3Njg4ZjU0OTc4ZTkzOWUwYzhiYjU2ZTMwY2NjNTY=
data/README.md CHANGED
@@ -1,101 +1,106 @@
1
- # Win32::Loquendo
2
-
3
- Ruby interface to the Loquendo speech synthesis (text to speech / TTS) program.
4
-
5
- It also ships a command line utility `say` which allows you to get spoken
6
- text directly from the console.
7
-
8
- This gem only runs on Microsoft Windows as it relies both on the Win32 API as
9
- well as the DLL files used by the Loquendo distribution. For that reason it
10
- has been name spaced in the win32 module to make it abundantly clear which
11
- platform it supports.
12
-
13
- ## Prerequisites
14
-
15
- * Must have Loquendo installed on the machine in order to use this gem.
16
- * ruby ffi library, will be installed automatically through rubygems
17
-
18
- ## Installation
19
-
20
- $ gem install win32-loquendo
21
-
22
- ## API usage
23
-
24
- Basic example showing the three types of use
25
-
26
- require 'win32/loquendo'
27
-
28
- reader = Win32::Loquendo::Reader.new()
29
-
30
- reader.say("Say it aloud") # Send the text to the sound card
31
-
32
- reader.say("Give me the data") do |data|
33
- # do stuff with the string of PCM WAVE bytes
34
- end
35
-
36
- reader.write("audio.wav", "Save the spoken text to a file")
37
-
38
- Customize how the text is spoken
39
-
40
- reader = Win32::Loquendo::Reader.new({
41
- :sample_rate => 32000, # Pick a sample rate in Hz
42
- :channels => 2, # Stereo or mono (1 or 2 audio channels)
43
- :voice => "Elizabeth" # Specify the default voice to use
44
- })
45
-
46
- reader.say "Hi, this is Elizabeth speaking" # Speak with the default voice.
47
- reader.say "and this is Simon", "Simon" # Override the default voice
48
- # for this utterance.
49
-
50
- reader.voices.each do |name| # List installed voices that can
51
- reader.say "My name is #{name}", name # be used for speaking.
52
- end
53
-
54
- Note that you can customize a lot on the fly regarding how Loquendo speaks, by
55
- simply adding commands as part of the text being spoken. For example:
56
-
57
- * Trigger whatever pre-programmed demo phrase the voice used was shipped with.
58
-
59
- reader.say("\\demosentence and I'm speaking through ruby win32-loquendo")
60
-
61
- * Provide proper pronunciation for words using [X-SAMPA][*]
62
-
63
- reader.say("Hello, or in Finnish; \SAMPA=;('t_de4ve)", "Dave")
64
-
65
- Finally you can launch speech prompts in parallel, overlapping to the degree
66
- you'd like by running reader instances in separate threads. This example
67
- generates something eerily similar to Google's audio captchas, using 10
68
- overlapping voices.
69
-
70
- (0...40).to_a.shuffle.each_slice(4).map{|a| a.join(" ") }.map{|s|
71
- Thread.new { Win32::Loquendo::Reader.new.say(s) }
72
- }.each {|t|
73
- t.join
74
- }
75
-
76
- A note of caution: Only ever interact with a reader from one and the same thread.
77
- If used from different threads it will cause undefined behavior (errors,
78
- hangs, crashes), since the library interact with C-code over FFI and such
79
- interactions are not thread safe.
80
-
81
- ## Command line usage
82
-
83
- The command line program is named `say`
84
-
85
- Usage: say [OPTIONS] [TEXT]
86
-
87
- TEXT is the text you want to be spoken
88
-
89
- Options:
90
- -c (1|2) audio channels to use
91
- -f FILE write audio to FILE instead of speaking it aloud
92
- -h show this help text
93
- -l lists the available voices
94
- -s N sample rate in Hz
95
- -v voice is the voice to use for speaking
96
-
97
- To speak a phrase with the default voice, it's as easy as
98
-
99
- say My PC can now speak, just like my Mac!
100
-
101
- [*]: http://en.wikipedia.org/wiki/X-SAMPA
1
+ # Win32::Loquendo
2
+
3
+ Ruby interface to the Loquendo speech synthesis (text to speech / TTS) program.
4
+
5
+ It also ships a command line utility `say` which allows you to get spoken
6
+ text directly from the console.
7
+
8
+ This gem only runs on Microsoft Windows as it relies both on the Win32 API as
9
+ well as the DLL files used by the Loquendo distribution. For that reason it
10
+ has been name spaced in the win32 module to make it abundantly clear which
11
+ platform it supports.
12
+
13
+ ## Prerequisites
14
+
15
+ * Must have Loquendo installed on the machine in order to use this gem.
16
+ * ruby ffi library, will be installed automatically through rubygems
17
+
18
+ ## Installation
19
+
20
+ $ gem install win32-loquendo
21
+
22
+ ## API usage
23
+
24
+ Basic example showing the three types of use
25
+
26
+ require 'win32/loquendo'
27
+
28
+ reader = Win32::Loquendo::Reader.new()
29
+
30
+ reader.say("Say it aloud") # Send the text to the sound card
31
+
32
+ reader.say("Give me the data") do |data|
33
+ # do stuff with the string of PCM WAVE bytes
34
+ end
35
+
36
+ reader.write("audio.wav", "Save the spoken text to a file")
37
+
38
+ Customize how the text is spoken
39
+
40
+ reader = Win32::Loquendo::Reader.new({
41
+ :sample_rate => 32000, # Pick a sample rate in Hz
42
+ :channels => 2, # Stereo or mono (1 or 2 audio channels)
43
+ :voice => "Elizabeth" # Specify the default voice to use
44
+ })
45
+
46
+ reader.say "Hi, this is Elizabeth speaking" # Speak with the default voice.
47
+ reader.say "and this is Simon", "Simon" # Override the default voice
48
+ # for this utterance.
49
+
50
+ reader.voices.each do |name| # List installed voices that can
51
+ reader.say "My name is #{name}", name # be used for speaking.
52
+ end
53
+
54
+ Note that you can customize a lot on the fly regarding how Loquendo speaks, by
55
+ simply adding commands as part of the text being spoken. For example:
56
+
57
+ * Trigger whatever pre-programmed demo phrase the voice used was shipped with.
58
+
59
+ reader.say("\\demosentence and I'm speaking through ruby win32-loquendo")
60
+
61
+ * Provide proper pronunciation for words using [X-SAMPA][*]
62
+
63
+ reader.say("Hello, or in Finnish; \SAMPA=;('t_de4ve)", "Dave")
64
+
65
+ Finally you can launch speech prompts in parallel, overlapping to the degree
66
+ you'd like by running reader instances in separate threads. This example
67
+ generates something eerily similar to Google's audio captchas, using 10
68
+ overlapping voices.
69
+
70
+ (0...40).to_a.shuffle.each_slice(4).map{|a| a.join(" ") }.map{|s|
71
+ Thread.new { Win32::Loquendo::Reader.new.say(s) }
72
+ }.each {|t|
73
+ t.join
74
+ }
75
+
76
+ A note of caution: Only ever interact with a reader from one and the same thread.
77
+ If used from different threads it will cause undefined behavior (errors,
78
+ hangs, crashes), since the library interact with C-code over FFI and such
79
+ interactions are not thread safe.
80
+
81
+ ## Command line usage
82
+
83
+ The command line program is named `say`
84
+
85
+ Usage: say [OPTIONS] [TEXT]
86
+
87
+ TEXT is the text you want to be spoken
88
+
89
+ Options:
90
+ -c (1|2) audio channels to use
91
+ -f FILE write audio to FILE instead of speaking it aloud
92
+ -h show this help text
93
+ -l lists the available voices
94
+ -s N sample rate in Hz
95
+ -v voice is the voice to use for speaking
96
+
97
+ To speak a phrase with the default voice, it's as easy as
98
+
99
+ say My PC can now speak, just like my Mac!
100
+
101
+ You can also change the default voice, so you don't have to provide the `-v`
102
+ option all the time. To change the default voice, create the file
103
+ "`%HOME%/.win32-loquendo`" and enter the voice you want to use on the first
104
+ line in that file.
105
+
106
+ [*]: http://en.wikipedia.org/wiki/X-SAMPA
data/bin/say CHANGED
@@ -10,7 +10,7 @@ def usage
10
10
  " -h show this help text",
11
11
  " -l lists the available voices",
12
12
  " -s N sample rate in Hz",
13
- " -v voice is the voice to use for speaking"
13
+ " -v voice is the voice to use for speaking (default: #{Win32::Loquendo::Reader.default_voice})"
14
14
  exit(1)
15
15
  end
16
16
 
@@ -15,14 +15,18 @@ module Win32
15
15
  # @option opts [Integer] :channels (2) denotes Stereo or mono, 2 or 1 channel.
16
16
  # @option opts [String] :voice (Elisabeth) default voice to use unless
17
17
  # overridden when calling {#say} or {#write}.
18
+ # @note To change the default voice, create the file "%HOME%/.win32-loquendo"
19
+ # and enter the voice you want to use on the first line.
18
20
  def initialize(opts={})
19
21
  @opts = {
20
22
  :sample_rate => 32000,
21
23
  :channels => 2,
22
- :voice => "Elizabeth"
24
+ :voice => self.class.default_voice
23
25
  }.merge(opts)
24
26
  @speaking = false
25
27
 
28
+ info "using voice: #{@opts[:voice]}"
29
+
26
30
  # Sanity checking of input parameters
27
31
  unless @opts[:sample_rate].kind_of?(Integer) && @opts[:sample_rate] > 0
28
32
  raise LoquendoException, ":sample_rate must be an integer and larger than zero, but %s was specified" % @opts[:sample_rate].to_s
@@ -104,6 +108,15 @@ module Win32
104
108
  buff.read_string.split(";")
105
109
  end
106
110
 
111
+ def self.default_voice
112
+ fn = ENV['HOME'] + "./.win32-loquendo"
113
+ if File.exists?(fn)
114
+ File.readlines(fn).first.strip
115
+ else
116
+ "Elizabeth"
117
+ end
118
+ end
119
+
107
120
  private #################################################################
108
121
 
109
122
  def say_aloud(text, voice = @opts[:voice])
@@ -1,5 +1,5 @@
1
1
  module Win32
2
2
  module Loquendo
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-loquendo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Jonas Tingeborn