google_speech 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google_speech/transcriber.rb +2 -2
- data/lib/google_speech/utility.rb +2 -1
- data/lib/google_speech/version.rb +1 -1
- data/spec/transcriber_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec2a81e64decb108511c6e41e180634d3c5e2fb0
|
4
|
+
data.tar.gz: 547610e9ebb2c7c8f881a952eb089ec4f2ccd0fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33efc21a61cf1bce77e10ca55c5df5c545da5638e56e12cb1598388360e3d539c9f75e720ad4349bf8d0323fe410d2019042b25081715e54fe242a9044e8567f
|
7
|
+
data.tar.gz: 7658ba2000a389388bcc58d35ad120a375f6365634f0b9ffe16e5b399cb5cd94af83250091a40fd5ce3d588b364fc14e223ef3aae81bc86946002d532a371178
|
@@ -13,7 +13,7 @@ module GoogleSpeech
|
|
13
13
|
# :client => SecureRandom.hex,
|
14
14
|
:key => 'AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw',
|
15
15
|
:client => 'chrome',
|
16
|
-
:audio_type => 'audio/
|
16
|
+
:audio_type => 'audio/x-flac',
|
17
17
|
:rate => 8000,
|
18
18
|
:language => 'en-us',
|
19
19
|
:chunk_duration => 4.0,
|
@@ -21,7 +21,7 @@ module GoogleSpeech
|
|
21
21
|
:max_results => 1,
|
22
22
|
:request_pause => 0.1,
|
23
23
|
:profanity_filter => true,
|
24
|
-
:retry_max =>
|
24
|
+
:retry_max => 2
|
25
25
|
}
|
26
26
|
|
27
27
|
def initialize(original_file, options=nil)
|
@@ -22,7 +22,8 @@ module GoogleSpeech
|
|
22
22
|
def trim_and_encode(wav_path, flac_path, start, length, rate)
|
23
23
|
check_local_file(wav_path)
|
24
24
|
|
25
|
-
command = "sox -t wav '#{wav_path}' -t
|
25
|
+
command = "sox -t wav '#{wav_path}' -r 8000 -c 1 -t flac '#{flac_path}' trim #{start} #{length} compand .5,2 -80,-80,-75,-50,-30,-15,0,0 norm -0.1"
|
26
|
+
# command = "sox -t wav '#{wav_path}' -t wav '#{flac_path}' norm channels 1 rate #{rate} trim #{start} #{length} compand .5,2 -80,-80,-75,-50,-30,-15,0,0"
|
26
27
|
out, err = run_command(command)
|
27
28
|
response = out + err
|
28
29
|
response.split("\n").each{ |l| raise("trim_and_encode: error cmd: '#{command}'\nout: '#{response}'") if l =~ SOX_ERROR_RE }
|
data/spec/transcriber_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
describe GoogleSpeech::Transcriber do
|
6
6
|
|
7
7
|
it 'transcribes a file' do
|
8
|
-
f = File.open(File.join(File.dirname(__FILE__), '
|
8
|
+
f = File.open(File.join(File.dirname(__FILE__), 'test.wav'))
|
9
9
|
|
10
10
|
transcriber = GoogleSpeech::Transcriber.new(f)
|
11
11
|
t = transcriber.transcribe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kuklewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|