Introduction
Introduction Statistics Contact Development Disclaimer Help
Tone detection - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
Log
Files
Refs
README
---
commit ef8638d44b9365d3f3f3f841ccf950f676d48d36
parent 426612920e87183e4d8580d4cb8b385e47ddb330
Author: HD Moore <[email protected]>
Date: Sun, 22 Feb 2009 19:45:14 +0000
Tone detection
Diffstat:
A bin/search_tones.rb | 54 +++++++++++++++++++++++++++++…
1 file changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/bin/search_tones.rb b/bin/search_tones.rb
@@ -0,0 +1,54 @@
+#!/usr/bin/env ruby
+###################
+
+#
+# Load the library path
+#
+base = __FILE__
+while File.symlink?(base)
+ base = File.expand_path(File.readlink(base), File.dirname(base))
+end
+$:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib'))
+require 'warvox'
+require "kissfft"
+
+#
+# Script
+#
+
+def usage
+ $stderr.puts "#{$0} [audio.raw] <min-power>"
+ exit
+end
+
+raw = WarVOX::Audio::Raw.from_file(ARGV.shift || usage)
+min = (ARGV.shift || 1).to_f
+res = KissFFT.fftr(4096, 8000, 1, raw.samples)
+
+tones = {}
+res.each do |x|
+ mf = 0
+ mp = 0
+ x.each do |o|
+ if(o[1] > mp)
+ mp = o[1]
+ mf = o[0]
+ end
+ end
+ if(mp > min)
+ tones[mf.to_i] ||= []
+ tones[mf.to_i] << [mf, mp]
+ end
+ # puts "#{mf.to_i}hz @ #{mp.to_i}"
+end
+
+tones.keys.sort.each do |t|
+ puts "#{t}hz"
+ tones[t].each do |x|
+ puts "\t#{x[0]}hz @ #{x[1]}"
+ end
+end
+
+
+
+
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.