Introduction
Introduction Statistics Contact Development Disclaimer Help
Quick tool for comparing two audio files - warvox - VoIP based wardialing tool,…
Log
Files
Refs
README
---
commit 0aacd504ef564bfaa03d42fd90e5081684065760
parent 9ceb178733fe1a400d2f27d293a199f85dae8325
Author: HD Moore <[email protected]>
Date: Wed, 2 Mar 2016 15:53:16 -0600
Quick tool for comparing two audio files
Diffstat:
A bin/audio_compare.rb | 48 +++++++++++++++++++++++++++++…
1 file changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/bin/audio_compare.rb b/bin/audio_compare.rb
@@ -0,0 +1,48 @@
+#!/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 'pry'
+
+def usage
+ $stderr.puts "Usage: #{$0} <inputA.raw> <inputB.raw>"
+ exit
+end
+
+def log(m)
+ $stderr.puts "[*] #{m}"
+end
+
+def score(a,b)
+ (a & b).length / [a,b].max.length.to_f
+end
+
+#
+# Script
+#
+
+inp1 = ARGV.shift
+inp2 = ARGV.shift
+
+if [inp1, inp2].include?("-h") or not (inp1 && inp2)
+ usage()
+end
+
+# log("Processing #{inp1}...")
+raw1 = WarVOX::Audio::Raw.from_file(inp1)
+sig1 = raw1.to_freq_sig
+
+# log("Processing #{inp2}...")
+raw2 = WarVOX::Audio::Raw.from_file(inp2)
+sig2 = raw2.to_freq_sig
+
+puts "Score: #{score(sig1, sig2)}"
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.