sbire 0.0.2 → 0.0.3
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/README.md +1 -1
- data/lib/audio_converter.rb +4 -23
- data/lib/audio_recorder.rb +2 -1
- data/lib/sbire.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c3335ce18ab067308516df60def16e7c4c331c1
|
4
|
+
data.tar.gz: 90fbf28718ed3fa48dc57f20a77632ad90c1915b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c2dec5cec66f79ca36428829768b21b9968150ceb1b6334ddbfd092294bc9d7eecfc6f3c733d64a19e8ff61c54ba42d699554385825ba46127246f1331281eb
|
7
|
+
data.tar.gz: 72d4d5f937a50444b003212efe844a9cd67521b240d4010a96ecbfd795f1ea076437e1d34f3b0bf6291cf92633da602cc138a6425259ea27bff2960e6d6e09bb
|
data/README.md
CHANGED
data/lib/audio_converter.rb
CHANGED
@@ -1,34 +1,15 @@
|
|
1
1
|
require 'curb'
|
2
2
|
require 'json'
|
3
|
+
require 'speech'
|
3
4
|
|
4
5
|
class AudioConverter
|
5
|
-
attr_accessor :
|
6
|
+
attr_accessor :audio
|
6
7
|
|
7
8
|
def initialize(file_path)
|
8
|
-
@
|
9
|
+
@audio = Speech::AudioToText.new(file_path)
|
9
10
|
end
|
10
11
|
|
11
12
|
def results
|
12
|
-
|
13
|
-
read_response(http_request)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
def read_response(http_request)
|
18
|
-
data = JSON.parse(http_request.body)
|
19
|
-
data['hypotheses'].map {|ut| [ut['utterance'], ut['confidence']] }.first
|
20
|
-
end
|
21
|
-
|
22
|
-
def http_request
|
23
|
-
return @http_request if @http_request
|
24
|
-
http_request = Curl::Easy.new(url)
|
25
|
-
http_request.headers['Content-Type'] = "audio/x-flac; rate=22050"
|
26
|
-
http_request.post_body = "Content=#{file}"
|
27
|
-
@http_request = http_request
|
28
|
-
end
|
29
|
-
|
30
|
-
def url
|
31
|
-
lang = Sbire::CONFIG.lang
|
32
|
-
"https://www.google.com/speech-api/v1/recognize?lang=#{lang}"
|
13
|
+
[audio.to_text(1, Sbire::CONFIG.lang)]
|
33
14
|
end
|
34
15
|
end
|
data/lib/audio_recorder.rb
CHANGED
@@ -20,6 +20,7 @@ class AudioRecorder
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def record_audio
|
23
|
-
fork { exec "
|
23
|
+
fork { exec "ffmpeg -loglevel panic -f alsa -ac 2 -i pulse -y #{path} -r 22050 >/dev/null 2>&1" }
|
24
|
+
`ps aux | grep ffmpeg | grep Sl | grep -v grep | awk -F" " '{print $2}'`
|
24
25
|
end
|
25
26
|
end
|
data/lib/sbire.rb
CHANGED
@@ -9,7 +9,7 @@ require 'rest_client'
|
|
9
9
|
class Sbire
|
10
10
|
|
11
11
|
BASE_DIRECTORY = "#{Dir.home}/.sbire"
|
12
|
-
OUT_FILE = "#{BASE_DIRECTORY}/.audiofile.
|
12
|
+
OUT_FILE = "#{BASE_DIRECTORY}/.audiofile.wav"
|
13
13
|
PID_FILE = "#{BASE_DIRECTORY}/.pid"
|
14
14
|
TEXT_FILE = "#{BASE_DIRECTORY}/sbire.txt"
|
15
15
|
CONFIG_PATH = "#{BASE_DIRECTORY}/config.yml"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guirec Corbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: speech2text
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: Sbire is a command line tool that recognize your voice and execute commands
|
28
42
|
linked
|
29
43
|
email: guirec.corbel@gmail.com
|
@@ -42,7 +56,8 @@ files:
|
|
42
56
|
- lib/notifier.rb
|
43
57
|
- README.md
|
44
58
|
homepage: https://github.com/GCorbel/sbire
|
45
|
-
licenses:
|
59
|
+
licenses:
|
60
|
+
- license.md
|
46
61
|
metadata: {}
|
47
62
|
post_install_message:
|
48
63
|
rdoc_options: []
|