| Add a converter from raw to flac - warvox - VoIP based wardialing tool, forked … | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 1f8800ab3989180223c393dc3ae820f14319e295 | |
| parent 49da42535f1e1495e42047d6b74981fdb935d712 | |
| Author: HD Moore <[email protected]> | |
| Date: Sun, 1 May 2016 21:41:48 -0500 | |
| Add a converter from raw to flac | |
| Diffstat: | |
| A bin/audio_raw_to_flac.rb | 38 +++++++++++++++++++++++++++++… | |
| 1 file changed, 38 insertions(+), 0 deletions(-) | |
| --- | |
| diff --git a/bin/audio_raw_to_flac.rb b/bin/audio_raw_to_flac.rb | |
| @@ -0,0 +1,38 @@ | |
| +#!/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' | |
| + | |
| +def usage | |
| + $stderr.puts "Usage: #{$0} <input.raw> <output.flac>" | |
| + exit | |
| +end | |
| + | |
| +# | |
| +# Script | |
| +# | |
| + | |
| +inp = ARGV.shift | |
| +out = ARGV.shift | |
| + | |
| +if (inp and inp == "-h") or not inp | |
| + usage() | |
| +end | |
| + | |
| +raw = WarVOX::Audio::Raw.from_file(inp) | |
| +if out | |
| + ::File.open(out, "wb") do |fd| | |
| + fd.write(raw.to_flac) | |
| + end | |
| +else | |
| + $stdout.write(raw.to_flac) | |
| +end |