hanvox 0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module Hanvox
2
+ VERSION = "0.3"
3
+ end
data/lib/signatures.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "signatures/base"
2
+ require "signatures/dialtone"
3
+ require "signatures/fax"
4
+ require "signatures/modem"
5
+ require "signatures/voice"
6
+ require "signatures/voicemail"
7
+
8
+ module Signatures
9
+
10
+ end
@@ -0,0 +1,23 @@
1
+ module Signatures
2
+ class Base
3
+ attr_accessor :data, :processors
4
+
5
+ def initialize data
6
+ @processors = [Signatures::Modem, Signatures::Fax, Signatures::Dialtone, Signatures::Voicemail, Signatures::Voice]
7
+ @data = data
8
+
9
+ @data[:scnt] = 0
10
+ @data[:ecnt] = 0
11
+ end
12
+
13
+ def process
14
+ line_type = nil
15
+ @processors.each do |proc|
16
+ line_type = proc.process @data
17
+ break unless line_type.nil?
18
+ end
19
+
20
+ line_type.nil? ? 'unknown' : line_type
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ module Signatures
2
+ class Dialtone
3
+ def self.process data
4
+ #
5
+ # Dial tone detection (440hz + 350hz)
6
+ #
7
+ if(data[:fcnt][440] > 1.0 and data[:fcnt][350] > 1.0)
8
+ return 'dialtone'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ module Signatures
2
+ class Fax
3
+ def self.process data
4
+ fax_sum = 0
5
+ [
6
+ data[:fcnt][1625], data[:fcnt][1660], data[:fcnt][1825], data[:fcnt][2100],
7
+ data[:fcnt][600], data[:fcnt][1855], data[:fcnt][1100], data[:fcnt][2250],
8
+ data[:fcnt][2230], data[:fcnt][2220], data[:fcnt][1800], data[:fcnt][2095],
9
+ data[:fcnt][2105]
10
+ ].map{|x| fax_sum += [x,1.0].min }
11
+ if(fax_sum >= 2.0)
12
+ return 'fax'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module Signatures
2
+ class Modem
3
+ def self.process data
4
+ if( (data[:fcnt][2100] > 1.0 or data[:fcnt][2230] > 1.0) and data[:fcnt][2250] > 0.5)
5
+ return 'modem'
6
+ end
7
+
8
+ #
9
+ # Look for modems by detecting a peak frequency of 2250hz
10
+ #
11
+ if(data[:fcnt][2100] > 1.0 and (data[:maxf] > 2245.0 and data[:maxf] < 2255.0))
12
+ return 'modem'
13
+ end
14
+
15
+ #
16
+ # Look for modems by detecting a peak frequency of 3000hz
17
+ #
18
+ if(data[:fcnt][2100] > 1.0 and (data[:maxf] > 2995.0 and data[:maxf] < 3005.0))
19
+ return 'modem'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ module Signatures
2
+ class Voice
3
+ def self.process signatures
4
+ nil
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ module Signatures
2
+ class Voicemail
3
+ def self.process data
4
+ # Look for voice mail by detecting the 1000hz BEEP
5
+ # If the call length was too short to catch the beep,
6
+ # this signature can fail. For non-US numbers, the beep
7
+ # is often a different frequency entirely.
8
+ if(data[:fcnt][1000] >= 1.0)
9
+ return 'voicemail'
10
+ end
11
+
12
+ # Look for voicemail by detecting a peak frequency of
13
+ # 1000hz. Not as accurate, but thats why this is in
14
+ # the fallback script.
15
+ if(data[:maxf] > 995 and data[:maxf] < 1005)
16
+ return 'voicemail'
17
+ end
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hanvox
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.3"
6
+ platform: ruby
7
+ authors:
8
+ - Nathaniel Barnes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-10-23 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Hanvox is an audio processing library used to find specific signatures within audio. It was developed as part of the wardialer AT-5001, and is primarily used to analyze call audio
18
+ email:
19
+ - nathaniel.r.barnes@gmail.com
20
+ executables: []
21
+
22
+ extensions:
23
+ - ext/kissfft/extconf.rb
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - lib/hanvox/proc_audio.rb
28
+ - lib/hanvox/raw.rb
29
+ - lib/hanvox/version.rb
30
+ - lib/hanvox.rb
31
+ - lib/signatures/base.rb
32
+ - lib/signatures/dialtone.rb
33
+ - lib/signatures/fax.rb
34
+ - lib/signatures/modem.rb
35
+ - lib/signatures/voice.rb
36
+ - lib/signatures/voicemail.rb
37
+ - lib/signatures.rb
38
+ - ext/kissfft/_kiss_fft_guts.h
39
+ - ext/kissfft/extconf.rb
40
+ - ext/kissfft/kiss_fft.c
41
+ - ext/kissfft/kiss_fft.h
42
+ - ext/kissfft/kiss_fft.o
43
+ - ext/kissfft/kiss_fftr.c
44
+ - ext/kissfft/kiss_fftr.h
45
+ - ext/kissfft/kiss_fftr.o
46
+ - ext/kissfft/kissfft.bundle
47
+ - ext/kissfft/main.c
48
+ - ext/kissfft/main.o
49
+ - ext/kissfft/mkmf.log
50
+ - ext/kissfft/sample.data
51
+ - ext/kissfft/test_kissfft.rb
52
+ - LICENSE
53
+ - README
54
+ - ROADMAP
55
+ - CHANGELOG
56
+ has_rdoc: true
57
+ homepage: http://github.com/natebarnes/hanvox
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.6
77
+ requirements: []
78
+
79
+ rubyforge_project: hanvox
80
+ rubygems_version: 1.6.2
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: A signature audio procesing library
84
+ test_files: []
85
+