fest 1.1.10 → 1.2.10
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/.gitignore +2 -0
- data/.travis.yml +12 -0
- data/Gemfile +1 -1
- data/README.md +96 -0
- data/Rakefile +14 -0
- data/changelog.org +4 -0
- data/fest.gemspec +18 -13
- data/lib/fest/conditions.rb +19 -0
- data/lib/fest/params.rb +32 -0
- data/lib/fest/volume.rb +45 -0
- data/lib/fest.rb +26 -82
- data/spec/custom_params_spec.rb +41 -0
- data/spec/default_params_spec.rb +42 -0
- data/spec/spec_helper.rb +6 -0
- metadata +50 -9
- data/README.org +0 -88
- /data/{MIT-license.org → License.org} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d50c7542a471b18e485824b82e1b2bb9167a731
|
|
4
|
+
data.tar.gz: dba013463a29ac9cc600d8a5409cbb31ae9b2a41
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5b23bba2ab84449c1d0f39fc860e42ebdc6cd44d07b6e970ee404e953a012e803af17448e4325b3e1ac8def3ab080b57aa816d61a2b3602e038f4ad2f3b7fb4
|
|
7
|
+
data.tar.gz: f986e9e00655b709cf5cb7fba4c82599be713bfba578c80ed4729f54a4bdc8dc86c2d2532c43d7e0dc3a8230f5a0938799b123e88f3446927c7025b3b98b37e3
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
## FEST
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/fest)
|
|
4
|
+
[](https://travis-ci.org/AfsmNGhr/fest)
|
|
5
|
+
[](https://coveralls.io/r/AfsmNGhr/fest?branch=master)
|
|
6
|
+
[](https://github.com/AfsmNGhr/fest)
|
|
7
|
+
|
|
8
|
+
Ruby wrapper use [Festival](https://wiki.archlinux.org/index.php/Festival_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29) for speak of the text and scripts ...
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- *nix* or OS X ...
|
|
13
|
+
- [Festival](https://wiki.archlinux.org/index.php/Festival_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29) and necessary languages ...
|
|
14
|
+
- [Pulseaudio](https://wiki.archlinux.org/index.php/PulseAudio_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29)
|
|
15
|
+
- xbacklight ([backlight](https://wiki.archlinux.org/index.php/Backlight_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29))
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```.ruby
|
|
20
|
+
# Gemfile
|
|
21
|
+
gem 'fest'
|
|
22
|
+
```
|
|
23
|
+
or
|
|
24
|
+
```.ruby
|
|
25
|
+
$ gem install fest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Used
|
|
29
|
+
### Call methods
|
|
30
|
+
```.ruby
|
|
31
|
+
require 'fest'
|
|
32
|
+
|
|
33
|
+
@fest = Fest.new
|
|
34
|
+
@fest.say("Пример")
|
|
35
|
+
# => Say "Пример"
|
|
36
|
+
|
|
37
|
+
# Expanded option
|
|
38
|
+
@fest.params = {:language => "cmu_us_slt_arctic_hts"}
|
|
39
|
+
@fest.say("This is an example")
|
|
40
|
+
# => Say "This is an example"
|
|
41
|
+
|
|
42
|
+
# All options
|
|
43
|
+
# params || default value
|
|
44
|
+
params[:path] || "/tmp"
|
|
45
|
+
params[:min_volume] || 20
|
|
46
|
+
params[:max_volume] || 60
|
|
47
|
+
params[:step] || 4
|
|
48
|
+
params[:backlight] || nil # disable check backlight
|
|
49
|
+
params[:language] || "voice_msu_ru_nsh_clunits"
|
|
50
|
+
|
|
51
|
+
# Declension
|
|
52
|
+
text = @fest.pluraform(2, %w(Сообщение Сообщения Сообщений))
|
|
53
|
+
puts text
|
|
54
|
+
# => "Сообщения"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Сustomization
|
|
58
|
+
|
|
59
|
+
```.ruby
|
|
60
|
+
@fest.init(params)
|
|
61
|
+
# check @current_volume
|
|
62
|
+
# @path, @index, @min_volume, @max_volume ...
|
|
63
|
+
|
|
64
|
+
@fest.check_conditions
|
|
65
|
+
# @fest.check_say_wav
|
|
66
|
+
# check_light и check_home_theater
|
|
67
|
+
|
|
68
|
+
@fest.check_light # (with xbacklight)
|
|
69
|
+
# exit if backlight equal 0
|
|
70
|
+
|
|
71
|
+
@fest.check_home_theater
|
|
72
|
+
# exit if run (vlc, kodi(xbmc))
|
|
73
|
+
|
|
74
|
+
@fest.make_wav(text)
|
|
75
|
+
|
|
76
|
+
@fest.expect_if_paplay_now
|
|
77
|
+
# wait if paplay active ...
|
|
78
|
+
|
|
79
|
+
@fest.play_wav
|
|
80
|
+
# @fest.check_optimal_volume (optimize min_volume and max_volume)
|
|
81
|
+
# @fest.turn_down_volume (with @step)
|
|
82
|
+
# @volume = @current_volume - @current_volume / 10 * @step
|
|
83
|
+
# play wav ... with @optimize_volume
|
|
84
|
+
# @fest.return_current_volume (with @step)
|
|
85
|
+
# delete_wav
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Issues
|
|
89
|
+
### Level of loudness doesn't dump after an exit
|
|
90
|
+
|
|
91
|
+
```.bash
|
|
92
|
+
#!/bin/bash
|
|
93
|
+
|
|
94
|
+
vlc.run --play-and-exit $*
|
|
95
|
+
amixer set Master 30% > /dev/null 2>&1
|
|
96
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
Bundler.setup(:default, :development)
|
|
6
|
+
rescue Bundler::BundlerError => e
|
|
7
|
+
$stderr.puts e.message
|
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
9
|
+
exit e.status_code
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require 'rspec/core/rake_task'
|
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
14
|
+
task :default => :spec
|
data/changelog.org
CHANGED
data/fest.gemspec
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
Gem::Specification.new do |
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
Gem::Specification.new do |gem|
|
|
2
|
+
gem.name = 'fest'
|
|
3
|
+
gem.version = '1.2.10'
|
|
4
|
+
gem.authors = 'Alexsey Ermolaev'
|
|
5
|
+
gem.email = 'afay.zangetsu@gmail.com'
|
|
6
|
+
gem.homepage = 'https://github.com/AfsmNGhr/fest'
|
|
7
|
+
gem.description = 'Ruby wrapper for festival scripts'
|
|
8
|
+
gem.summary = 'Ruby wrapper for festival speech engine'
|
|
9
|
+
gem.license = 'MIT'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
gem.add_development_dependency 'rake', '~> 0'
|
|
12
|
+
gem.add_development_dependency 'rspec', '3.2.0'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
|
15
|
+
gem.require_paths = ['lib']
|
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
17
|
+
|
|
18
|
+
gem.extra_rdoc_files = ['License.org', 'README.md']
|
|
19
|
+
gem.requirements = ['*nix* or OS X', 'Pulseaudio sound server',
|
|
20
|
+
'Festival snpeech engine', 'xbacklight']
|
|
16
21
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
#
|
|
3
|
+
module Conditions
|
|
4
|
+
def check_conditions
|
|
5
|
+
check_light
|
|
6
|
+
check_home_theater
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def check_light
|
|
10
|
+
exit if @params[:backlight].nil? && `xbacklight`.to_i == 0
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def check_home_theater
|
|
14
|
+
xbmc = `ps -el | grep xbmc | wc -l`.to_i
|
|
15
|
+
vlc = `ps -el | grep vlc | wc -l`.to_i
|
|
16
|
+
kodi = `ps -el | grep kodi | wc -l`.to_i
|
|
17
|
+
exit if xbmc > 0 || vlc > 0 || kodi > 0
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/fest/params.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
#
|
|
3
|
+
module Params
|
|
4
|
+
def path
|
|
5
|
+
@path = @params[:path] || '/tmp'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def current_volume
|
|
9
|
+
@current_volume = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def index
|
|
13
|
+
@index = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
|
14
|
+
@index > 0 ? @index += 1 : @index = 1
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def min_volume
|
|
18
|
+
@min_volume = @params[:min_volume] || 20
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def max_volume
|
|
22
|
+
@max_volume = @params[:max_volume] || 60
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def step
|
|
26
|
+
@step = @params[:step] || 4
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def language
|
|
30
|
+
@language = @params[:language] || 'voice_msu_ru_nsh_clunits'
|
|
31
|
+
end
|
|
32
|
+
end
|
data/lib/fest/volume.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
#
|
|
3
|
+
module Volume
|
|
4
|
+
def check_optimal_volume
|
|
5
|
+
@volume = @current_volume - @current_volume / 10 * @step
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def optimize_volume
|
|
9
|
+
@optimize_volume = (
|
|
10
|
+
if @current_volume > @max_volume
|
|
11
|
+
@max_volume
|
|
12
|
+
elsif @current_volume < @min_volume
|
|
13
|
+
@min_volume
|
|
14
|
+
else
|
|
15
|
+
@current_volume
|
|
16
|
+
end
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def inputs
|
|
21
|
+
@inputs = `pactl list sink-inputs | grep № | grep -o '[0-9]*'`.split("\n")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def turn_down_volume
|
|
25
|
+
@inputs.each do |input|
|
|
26
|
+
volume = @current_volume
|
|
27
|
+
loop do
|
|
28
|
+
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
|
29
|
+
volume -= @step
|
|
30
|
+
break if volume < @volume
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def return_current_volume
|
|
36
|
+
@inputs.each do |input|
|
|
37
|
+
volume = @volume
|
|
38
|
+
loop do
|
|
39
|
+
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
|
40
|
+
volume += @step
|
|
41
|
+
break if volume > @current_volume
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/fest.rb
CHANGED
|
@@ -1,71 +1,39 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
|
+
# Ruby wrapper for Festival speech engine
|
|
3
|
+
# author Alexsey Ermolaev afay.zangetsu@gmail.com
|
|
4
|
+
|
|
5
|
+
require_relative './fest/params'
|
|
6
|
+
require_relative './fest/volume'
|
|
7
|
+
require_relative './fest/conditions'
|
|
2
8
|
#
|
|
3
9
|
class Fest
|
|
4
|
-
|
|
5
|
-
|
|
10
|
+
include Params
|
|
11
|
+
include Volume
|
|
12
|
+
include Conditions
|
|
13
|
+
attr_accessor :params
|
|
14
|
+
|
|
15
|
+
def say(string)
|
|
16
|
+
init
|
|
6
17
|
check_conditions
|
|
7
18
|
make_wav(string)
|
|
8
19
|
expect_if_paplay_now
|
|
9
|
-
check_optimal_volume
|
|
10
20
|
play_wav
|
|
11
21
|
end
|
|
12
22
|
|
|
13
|
-
def init
|
|
14
|
-
@params
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def check_optimal_volume
|
|
24
|
-
@volume = @current_volume - @current_volume / 10 * @step
|
|
25
|
-
optimize_min_and_max_volume
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def optimize_min_and_max_volume
|
|
29
|
-
@optimize_volume = (
|
|
30
|
-
if @current_volume > @max_volume
|
|
31
|
-
@max_volume
|
|
32
|
-
elsif @current_volume < @min_volume
|
|
33
|
-
@min_volume
|
|
34
|
-
else
|
|
35
|
-
@current_volume
|
|
36
|
-
end
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def check_conditions
|
|
41
|
-
check_light
|
|
42
|
-
check_home_theater
|
|
43
|
-
check_say_wav
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def check_light
|
|
47
|
-
exit if @params[:backlight].nil? && `xbacklight`.to_i == 0
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def check_home_theater
|
|
51
|
-
xbmc = `ps -el | grep xbmc | wc -l`.to_i
|
|
52
|
-
vlc = `ps -el | grep vlc | wc -l`.to_i
|
|
53
|
-
kodi = `ps -el | grep kodi | wc -l`.to_i
|
|
54
|
-
exit if xbmc > 0 || vlc > 0 || kodi > 0
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def check_say_wav
|
|
58
|
-
@index > 0 ? @index += 1 : @index = 1
|
|
23
|
+
def init
|
|
24
|
+
@params ||= {}
|
|
25
|
+
current_volume
|
|
26
|
+
min_volume
|
|
27
|
+
max_volume
|
|
28
|
+
language
|
|
29
|
+
index
|
|
30
|
+
path
|
|
31
|
+
step
|
|
59
32
|
end
|
|
60
33
|
|
|
61
34
|
def make_wav(string)
|
|
62
35
|
system("echo '#{string}' | text2wave -o #{@path}/say_#{@index}.wav \
|
|
63
|
-
-eval '(#{@
|
|
64
|
-
> /dev/null 2>&1")
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def change_volume(volume)
|
|
68
|
-
system("amixer set Master #{volume}% > /dev/null 2>&1")
|
|
36
|
+
-eval '(#{@language})' > /dev/null 2>&1")
|
|
69
37
|
end
|
|
70
38
|
|
|
71
39
|
def expect_if_paplay_now
|
|
@@ -75,38 +43,14 @@ class Fest
|
|
|
75
43
|
end
|
|
76
44
|
end
|
|
77
45
|
|
|
78
|
-
def turn_down_volume
|
|
79
|
-
@inputs = `pactl list sink-inputs | grep № | grep -o '[0-9]*'`.split("\n")
|
|
80
|
-
@inputs.each do |input|
|
|
81
|
-
volume = @current_volume
|
|
82
|
-
loop do
|
|
83
|
-
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
|
84
|
-
volume -= @step
|
|
85
|
-
break if volume < @volume
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
46
|
def play_wav
|
|
47
|
+
check_optimal_volume
|
|
48
|
+
optimize_volume
|
|
49
|
+
inputs
|
|
91
50
|
turn_down_volume
|
|
92
51
|
system("paplay #{@path}/say_#{@index}.wav \
|
|
93
52
|
--volume='#{@optimize_volume * 655}' > /dev/null 2>&1")
|
|
94
53
|
return_current_volume
|
|
95
|
-
delete_wav
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def return_current_volume
|
|
99
|
-
@inputs.each do |input|
|
|
100
|
-
volume = @volume
|
|
101
|
-
loop do
|
|
102
|
-
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
|
103
|
-
volume += @step
|
|
104
|
-
break if volume > @current_volume
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def delete_wav
|
|
110
54
|
system("rm -f #{@path}/say_#{@index}.wav")
|
|
111
55
|
end
|
|
112
56
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Fest do
|
|
4
|
+
before(:each) do
|
|
5
|
+
@fest = Fest.new
|
|
6
|
+
@fest.params = {:language => 'cmu_us_slt_arctic_hts',
|
|
7
|
+
:min_volume => 30,
|
|
8
|
+
:max_volume => 70,
|
|
9
|
+
:step => 3,
|
|
10
|
+
:path => '~/'}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'check custom params' do
|
|
14
|
+
params = {:language => 'cmu_us_slt_arctic_hts',
|
|
15
|
+
:min_volume => 30,
|
|
16
|
+
:max_volume => 70,
|
|
17
|
+
:step => 3,
|
|
18
|
+
:path => '~/'}
|
|
19
|
+
expect(@fest.params).to eq(params)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'check custom path in params' do
|
|
23
|
+
expect(@fest.path).to eq('~/')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'check custom min volume' do
|
|
27
|
+
expect(@fest.min_volume).to eq(30)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'check custom max volume' do
|
|
31
|
+
expect(@fest.max_volume).to eq(70)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'check custom step' do
|
|
35
|
+
expect(@fest.step).to eq(3)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'check custom language' do
|
|
39
|
+
expect(@fest.language).to eq('cmu_us_slt_arctic_hts')
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Fest do
|
|
4
|
+
before(:each) do
|
|
5
|
+
@fest = Fest.new
|
|
6
|
+
@fest.params = {}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'check default params' do
|
|
10
|
+
expect(@fest.params).to eq({})
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'check default path' do
|
|
14
|
+
expect(@fest.path).to eq('/tmp')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'check current volume' do
|
|
18
|
+
vol = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
|
19
|
+
expect(@fest.current_volume).to eq(vol)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'check index' do
|
|
23
|
+
i = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
|
24
|
+
expect(@fest.index).not_to eq(i)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'check default min volume' do
|
|
28
|
+
expect(@fest.min_volume).to eq(20)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'check default max volume' do
|
|
32
|
+
expect(@fest.max_volume).to eq(60)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'check default step' do
|
|
36
|
+
expect(@fest.step).to eq(4)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'check default language' do
|
|
40
|
+
expect(@fest.language).to eq('voice_msu_ru_nsh_clunits')
|
|
41
|
+
end
|
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
|
@@ -1,28 +1,66 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexsey Ermolaev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rake
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 3.2.0
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 3.2.0
|
|
13
41
|
description: Ruby wrapper for festival scripts
|
|
14
42
|
email: afay.zangetsu@gmail.com
|
|
15
43
|
executables: []
|
|
16
44
|
extensions: []
|
|
17
|
-
extra_rdoc_files:
|
|
45
|
+
extra_rdoc_files:
|
|
46
|
+
- License.org
|
|
47
|
+
- README.md
|
|
18
48
|
files:
|
|
19
49
|
- ".gitignore"
|
|
50
|
+
- ".travis.yml"
|
|
20
51
|
- Gemfile
|
|
21
|
-
-
|
|
22
|
-
- README.
|
|
52
|
+
- License.org
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
23
55
|
- changelog.org
|
|
24
56
|
- fest.gemspec
|
|
25
57
|
- lib/fest.rb
|
|
58
|
+
- lib/fest/conditions.rb
|
|
59
|
+
- lib/fest/params.rb
|
|
60
|
+
- lib/fest/volume.rb
|
|
61
|
+
- spec/custom_params_spec.rb
|
|
62
|
+
- spec/default_params_spec.rb
|
|
63
|
+
- spec/spec_helper.rb
|
|
26
64
|
homepage: https://github.com/AfsmNGhr/fest
|
|
27
65
|
licenses:
|
|
28
66
|
- MIT
|
|
@@ -44,12 +82,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
44
82
|
requirements:
|
|
45
83
|
- "*nix* or OS X"
|
|
46
84
|
- Pulseaudio sound server
|
|
47
|
-
- Festival
|
|
85
|
+
- Festival snpeech engine
|
|
48
86
|
- xbacklight
|
|
49
87
|
rubyforge_project:
|
|
50
|
-
rubygems_version: 2.4.
|
|
88
|
+
rubygems_version: 2.4.6
|
|
51
89
|
signing_key:
|
|
52
90
|
specification_version: 4
|
|
53
91
|
summary: Ruby wrapper for festival speech engine
|
|
54
|
-
test_files:
|
|
92
|
+
test_files:
|
|
93
|
+
- spec/custom_params_spec.rb
|
|
94
|
+
- spec/default_params_spec.rb
|
|
95
|
+
- spec/spec_helper.rb
|
|
55
96
|
has_rdoc:
|
data/README.org
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
** FEST
|
|
2
|
-
Ruby wrapper use [[https://wiki.archlinux.org/index.php/Festival_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29][Festival]] for speak of the text and scripts ...
|
|
3
|
-
** Requirements
|
|
4
|
-
- *nix* or OS X ...
|
|
5
|
-
- [[https://wiki.archlinux.org/index.php/Festival_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29][Festival]] and necessary languages ...
|
|
6
|
-
- [[https://wiki.archlinux.org/index.php/PulseAudio_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29][Pulseaudio]]
|
|
7
|
-
- xbacklight ([[https://wiki.archlinux.org/index.php/Backlight_%28%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9%29][backlight]])
|
|
8
|
-
** Установка
|
|
9
|
-
#+begin_src ruby
|
|
10
|
-
# Gemfile
|
|
11
|
-
gem 'fest'
|
|
12
|
-
#+end_src
|
|
13
|
-
or
|
|
14
|
-
#+begin_src ruby
|
|
15
|
-
$ gem install fest
|
|
16
|
-
#+end_src
|
|
17
|
-
** Used
|
|
18
|
-
***** Call methods
|
|
19
|
-
#+begin_src ruby
|
|
20
|
-
require 'fest'
|
|
21
|
-
|
|
22
|
-
@fest = Fest.new
|
|
23
|
-
text = "Пример"
|
|
24
|
-
@fest.say(text)
|
|
25
|
-
# => Say "Пример"
|
|
26
|
-
|
|
27
|
-
# Expanded option
|
|
28
|
-
params = {:language => "cmu_us_slt_arctic_hts"}
|
|
29
|
-
text = "This is an example"
|
|
30
|
-
@fest.say(text, params)
|
|
31
|
-
# => Say "This is an example" ...
|
|
32
|
-
|
|
33
|
-
# All options
|
|
34
|
-
# params || default value
|
|
35
|
-
params[:path] || "/tmp"
|
|
36
|
-
params[:down_volume] || [20,60,4] # [min, max, step]
|
|
37
|
-
params[:backlight] || nil # disable check backlight
|
|
38
|
-
params[:language] || "voice_msu_ru_nsh_clunits"
|
|
39
|
-
|
|
40
|
-
# Declension
|
|
41
|
-
text = @fest.pluraform(2, %w(Сообщение Сообщения Сообщений))
|
|
42
|
-
puts text
|
|
43
|
-
# => "Сообщения"
|
|
44
|
-
#+end_src
|
|
45
|
-
|
|
46
|
-
** Сustomization
|
|
47
|
-
#+begin_src ruby
|
|
48
|
-
@fest.init(params)
|
|
49
|
-
# check @current_volume
|
|
50
|
-
# @path, @index, @min_volume, @max_volume ...
|
|
51
|
-
|
|
52
|
-
@fest.check_optimal_volume
|
|
53
|
-
# @volume = @current_volume - @down_volume
|
|
54
|
-
|
|
55
|
-
@fest.optimize_min_and_max_volume(min_volume, max_volume)
|
|
56
|
-
|
|
57
|
-
@fest.check_conditions
|
|
58
|
-
# @fest.check_say_wav
|
|
59
|
-
# check_light и check_home_theater
|
|
60
|
-
|
|
61
|
-
@fest.check_light # (with xbacklight)
|
|
62
|
-
# exit if backlight equal 0
|
|
63
|
-
|
|
64
|
-
@fest.check_home_theater
|
|
65
|
-
# exit if run (vlc, kodi(xbmc))
|
|
66
|
-
|
|
67
|
-
@fest.make_wav(text)
|
|
68
|
-
|
|
69
|
-
@fest.change_volume(volume)
|
|
70
|
-
|
|
71
|
-
@fest.expect_if_paplay_now
|
|
72
|
-
# wait if paplay active ...
|
|
73
|
-
|
|
74
|
-
@fest.play_wav
|
|
75
|
-
# @fest.turn_down_volume (with @step)
|
|
76
|
-
# @volume = @current_volume - @current_volume / 10 * @step
|
|
77
|
-
# play wav ... with @optimize_volume
|
|
78
|
-
# @fest.return_current_volume (with @step)
|
|
79
|
-
# @fest.delete_wav
|
|
80
|
-
#+end_src
|
|
81
|
-
** Issues
|
|
82
|
-
***** Level of loudness doesn't dump after an exit
|
|
83
|
-
#+begin_src bash
|
|
84
|
-
#!/bin/bash
|
|
85
|
-
|
|
86
|
-
vlc.run --play-and-exit $*
|
|
87
|
-
amixer set Master 30% > /dev/null 2>&1
|
|
88
|
-
#+end_src
|
|
File without changes
|