mac-say 0.1.0 → 0.2.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 +5 -5
- data/ChangeLog.md +26 -2
- data/LICENSE.txt +1 -1
- data/README.md +35 -13
- data/examples/examples.rb +15 -6
- data/img/voices_manual.png +0 -0
- data/lib/mac/say/version.rb +2 -2
- data/lib/mac/say/voices_attributes.rb +647 -0
- data/lib/mac/say.rb +120 -52
- data/mac-say.gemspec +11 -11
- data/test/fake/say +3 -1
- data/test/helper.rb +7 -3
- data/test/test_mac-say.rb +71 -59
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7fbd8952d1388b8784f78db4baf677ccb88da4219377fd2b268a0d843b3cb04a
|
4
|
+
data.tar.gz: f0e497209c8b6f9b5e3e29d3b2adcab49c5376e2a6c9613375dbe66dd0aa1af6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efac1b9b152281063b8540cab4d88e7561f405a3edf560409b808b061f0b410fe6bad88b3db857bb6eff83b070a0280d1220e6920e9852e6f26fb3a4881d36ca
|
7
|
+
data.tar.gz: 4de62bb491c7bb0fdd6c8311b5d7cf2d905a78c0fe0a1479ee3a7d32e8926028960e1714a191e7c5d6b8a8a63f406a4d526f2bf41e27bbdacf93a365daf590cb
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,28 @@
|
|
1
|
-
|
1
|
+
v0.2.1 / 2017-12-10
|
2
|
+
===================
|
2
3
|
|
3
|
-
*
|
4
|
+
* Added space separated voices support (MacOS High Sierra) i.e. 'Good news', 'Bad News', 'Pipe Organ'
|
5
|
+
* Added a new unofficial voice attribute `singing` (for voices like 'Cellos')
|
6
|
+
* Added a new ar_SA voice — 'Laila'
|
4
7
|
|
8
|
+
v0.2.0 / 2017-02-16
|
9
|
+
===================
|
10
|
+
|
11
|
+
* Added useful voices meta-information: gender, quality, "is it a joke?"-flag (WARNING: all the attributes values provided are highly subjective!)
|
12
|
+
* Implemented searching for voices by more than one attribute (i.e. @voices.find_all &block delegation)
|
13
|
+
* Improved/Fixed documentation
|
14
|
+
|
15
|
+
v.0.1.1 / 2017-01-30
|
16
|
+
====================
|
17
|
+
|
18
|
+
* Fixed leaked `nil` output from the main lib file
|
19
|
+
* Test code with colourful language deleted from the main lib file 🤦🏻♂️
|
20
|
+
|
21
|
+
v0.1.0 / 2017-01-30
|
22
|
+
===================
|
23
|
+
|
24
|
+
* First version
|
25
|
+
* Basic TTS (Strings/Multiline strings/Files)
|
26
|
+
* Dynamic voices list parsing (based on the real `say` output)
|
27
|
+
* Voices search (by one of the attributes: name / language / country)
|
28
|
+
* Full test/docs coverage + CI configuration + fake `say` command for CI
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
|
7
7
|
> Ruby wrapper around the modern version of the macOS `say` command. Inspired by the @bratta's [mactts](https://github.com/bratta/mactts)
|
8
8
|
>
|
9
|
-
> [](https://travis-ci.org/smileart/mac-say) [](https://coveralls.io/github/smileart/mac-say?branch=dev) [](https://codeclimate.com/github/smileart/mac-say) [](https://inch-ci.org/github/smileart/mac-say)
|
9
|
+
> [](https://travis-ci.org/smileart/mac-say) [](https://coveralls.io/github/smileart/mac-say?branch=dev) [](https://codeclimate.com/github/smileart/mac-say) [](https://inch-ci.org/github/smileart/mac-say) [](https://rubygems.org/gems/mac-say)
|
10
10
|
|
11
11
|
* [Homepage](https://rubygems.org/gems/mac-say)
|
12
12
|
* [Documentation](http://rubydoc.info/gems/mac-say/frames)
|
13
|
-
* [Email](mailto:smileart21
|
13
|
+
* [Email](mailto:smileart21@gmail.com)
|
14
14
|
|
15
15
|
## Features
|
16
16
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
* [x] Multiline strings support
|
20
20
|
* [x] Dynamic voices parsing (based on real `say` output)
|
21
21
|
* [x] Voices list generation (including samples and ISO information)
|
22
|
-
* [x] Voices search (by name / language / country)
|
22
|
+
* [x] Voices search (by name / language / country / etc.)
|
23
23
|
* [x] Simple (class-level) and customisable (instance-level) usage
|
24
24
|
* [ ] Observe reading progress line by line❓
|
25
25
|
* [ ] Audio output support❓
|
@@ -41,11 +41,20 @@ require 'mac/say'
|
|
41
41
|
# Get all the voices
|
42
42
|
pp Mac::Say.voices
|
43
43
|
|
44
|
-
# Collect the separate
|
44
|
+
# Collect the separate attributes lists
|
45
45
|
pp Mac::Say.voices.collect { |v| v[:name] }
|
46
|
-
pp Mac::Say.voices.collect { |v| v[:
|
46
|
+
pp Mac::Say.voices.collect { |v| v[:language] }
|
47
47
|
pp Mac::Say.voices.collect { |v| v[:sample] }
|
48
48
|
|
49
|
+
# Look for voices by an attribute
|
50
|
+
pp Mac::Say.voice(:singing, true)
|
51
|
+
pp Mac::Say.voice(:joke, false)
|
52
|
+
pp Mac::Say.voice(:gender, :female)
|
53
|
+
|
54
|
+
# Look for voices by multiple attributes
|
55
|
+
pp Mac::Say.voice { |v| v[:joke] == true && v[:gender] == :female }
|
56
|
+
pp Mac::Say.voice { |v| v[:language] == :en && v[:gender] == :male && v[:quality] == :high && v[:joke] == false }
|
57
|
+
|
49
58
|
# Find a voice (returns a Hash)
|
50
59
|
pp Mac::Say.voice(:name, :alex)
|
51
60
|
pp Mac::Say.voice(:country, :scotland)
|
@@ -54,7 +63,7 @@ pp Mac::Say.voice(:country, :scotland)
|
|
54
63
|
pp Mac::Say.voice(:language, :en)
|
55
64
|
|
56
65
|
# Work with the voices collection
|
57
|
-
indian_english = Mac::Say.voice(:country, :in).select { |v| v[:
|
66
|
+
indian_english = Mac::Say.voice(:country, :in).select { |v| v[:language] == :en }.first[:name]
|
58
67
|
|
59
68
|
# Use multiline text
|
60
69
|
puts Mac::Say.say <<-DATA, indian_english
|
@@ -74,7 +83,7 @@ talker = Mac::Say.new(voice: Mac::Say.voice(:country, :scotland)[:name])
|
|
74
83
|
talker.say string: talker.voice(:country, :scotland)[:sample]
|
75
84
|
|
76
85
|
# with the dynamic voice name selected from the multiple voices
|
77
|
-
talker = Mac::Say.
|
86
|
+
talker = Mac::Say.new
|
78
87
|
voice = talker.voice(:language, :en)&.sample(1)&.first&.fetch :name
|
79
88
|
talker.say string: 'Hello world!', voice: voice
|
80
89
|
|
@@ -182,29 +191,33 @@ end
|
|
182
191
|
# wrong feature
|
183
192
|
begin
|
184
193
|
Mac::Say.voice(:tone, :enthusiastic)
|
185
|
-
rescue Mac::Say::
|
194
|
+
rescue Mac::Say::UnknownVoiceAttribute => e
|
186
195
|
puts e.message
|
187
196
|
end
|
188
197
|
|
189
198
|
# wrong feature
|
190
199
|
begin
|
191
200
|
Mac::Say.new.voice(:articulation, :nostalgic)
|
192
|
-
rescue Mac::Say::
|
201
|
+
rescue Mac::Say::UnknownVoiceAttribute => e
|
193
202
|
puts e.message
|
194
203
|
end
|
195
204
|
```
|
196
205
|
|
197
|
-
## Installing & Updating MacOS TTS Voices
|
206
|
+
## Installing & Updating MacOS TTS Voices (MacOS 12.2+)
|
198
207
|
|
199
|
-
Open `System Preferences` using Spotlight / Alfred / Dock and follow text or visual instructions:
|
208
|
+
Open `System Preferences` using Menu / Spotlight / Alfred / Dock and follow text or visual instructions:
|
200
209
|
|
201
210
|
```
|
202
|
-
System Preferences → Accessibility →
|
211
|
+
System Preferences → Accessibility → Spoken Content → System Voice →
|
203
212
|
→ Customize… → (select voices) → OK → (Wait for download…)
|
204
213
|
```
|
205
214
|
|
206
215
|

|
207
216
|
|
217
|
+
## Caveats
|
218
|
+
|
219
|
+
- All the `Siri...` voices you might see in the system voices list are not available in `say`, that's why you can not user them
|
220
|
+
|
208
221
|
## Dev Notes
|
209
222
|
|
210
223
|
```sh
|
@@ -230,8 +243,17 @@ $ bundle exec m
|
|
230
243
|
$ bundle exec m ./test/test_mac-say.rb:34
|
231
244
|
```
|
232
245
|
|
246
|
+
__Additionally to update dependencies I use my [one-liner](https://gist.github.com/smileart/9d1d17e9da8cba19f792304fd4b0e58d).__
|
247
|
+
|
248
|
+
```
|
249
|
+
# A snippet to look for any new/unknown voices and test their attributes
|
250
|
+
pp Mac::Say.voices.select {|v| v[:gender].nil? }
|
251
|
+
talker = Mac::Say.new(voice: :rishi)
|
252
|
+
talker.say string: 'Hello, my name is Rishi. I am an Indian-English voice.'
|
253
|
+
```
|
254
|
+
|
233
255
|
## Copyright
|
234
256
|
|
235
|
-
Copyright (c)
|
257
|
+
Copyright (c) 2022 Serge Bedzhyk
|
236
258
|
|
237
259
|
See [LICENSE.txt](./LICENSE.txt) for details.
|
data/examples/examples.rb
CHANGED
@@ -7,11 +7,20 @@ require_relative '../lib/mac/say'
|
|
7
7
|
# Get all the voices
|
8
8
|
pp Mac::Say.voices
|
9
9
|
|
10
|
-
# Collect the separate
|
10
|
+
# Collect the separate attributes lists
|
11
11
|
pp Mac::Say.voices.collect { |v| v[:name] }
|
12
|
-
pp Mac::Say.voices.collect { |v| v[:
|
12
|
+
pp Mac::Say.voices.collect { |v| v[:language] }
|
13
13
|
pp Mac::Say.voices.collect { |v| v[:sample] }
|
14
14
|
|
15
|
+
# Look for voices by an attribute
|
16
|
+
pp Mac::Say.voice(:singing, true)
|
17
|
+
pp Mac::Say.voice(:joke, false)
|
18
|
+
pp Mac::Say.voice(:gender, :female)
|
19
|
+
|
20
|
+
# Look for voices by multiple attributes
|
21
|
+
pp Mac::Say.voice { |v| v[:joke] == true && v[:gender] == :female }
|
22
|
+
pp Mac::Say.voice { |v| v[:language] == :en && v[:gender] == :male && v[:quality] == :high && v[:joke] == false }
|
23
|
+
|
15
24
|
# Find a voice (returns a Hash)
|
16
25
|
pp Mac::Say.voice(:name, :alex)
|
17
26
|
pp Mac::Say.voice(:country, :scotland)
|
@@ -20,7 +29,7 @@ pp Mac::Say.voice(:country, :scotland)
|
|
20
29
|
pp Mac::Say.voice(:language, :en)
|
21
30
|
|
22
31
|
# Work with the voices collection
|
23
|
-
indian_english = Mac::Say.voice(:country, :in).select { |v| v[:
|
32
|
+
indian_english = Mac::Say.voice(:country, :in).select { |v| v[:language] == :en }.first[:name]
|
24
33
|
|
25
34
|
# Use multiline text
|
26
35
|
puts Mac::Say.say <<-DATA, indian_english
|
@@ -40,7 +49,7 @@ talker = Mac::Say.new(voice: Mac::Say.voice(:country, :scotland)[:name])
|
|
40
49
|
talker.say string: talker.voice(:country, :scotland)[:sample]
|
41
50
|
|
42
51
|
# with the dynamic voice name selected from the multiple voices
|
43
|
-
talker = Mac::Say.
|
52
|
+
talker = Mac::Say.new
|
44
53
|
voice = talker.voice(:language, :en)&.sample(1)&.first&.fetch :name
|
45
54
|
talker.say string: 'Hello world!', voice: voice
|
46
55
|
|
@@ -148,13 +157,13 @@ end
|
|
148
157
|
# wrong feature
|
149
158
|
begin
|
150
159
|
Mac::Say.voice(:tone, :enthusiastic)
|
151
|
-
rescue Mac::Say::
|
160
|
+
rescue Mac::Say::UnknownVoiceAttribute => e
|
152
161
|
puts e.message
|
153
162
|
end
|
154
163
|
|
155
164
|
# wrong feature
|
156
165
|
begin
|
157
166
|
Mac::Say.new.voice(:articulation, :nostalgic)
|
158
|
-
rescue Mac::Say::
|
167
|
+
rescue Mac::Say::UnknownVoiceAttribute => e
|
159
168
|
puts e.message
|
160
169
|
end
|
data/img/voices_manual.png
CHANGED
Binary file
|
data/lib/mac/say/version.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
# Wrapper namespace module for a Say class
|
4
4
|
module Mac
|
5
|
-
# A class wrapper around the MacOS `say`
|
5
|
+
# A class wrapper around the MacOS `say` command
|
6
6
|
# Allows to use simple TTS on Mac right from Ruby scripts
|
7
7
|
class Say
|
8
8
|
# mac-say version
|
9
|
-
VERSION = '0.
|
9
|
+
VERSION = '0.2.2'
|
10
10
|
end
|
11
11
|
end
|