Created
May 21, 2014 08:20
-
-
Save lucaswilric/011e4e3b94ccf59b9368 to your computer and use it in GitHub Desktop.
Use SoX to amplify all WAV files in the current directory as much as possible without clipping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# PVC: Easy as shell pipes | |
# https://rubygems.org/gems/pvc | |
require 'pvc' | |
# SoX: Sound eXchange | |
# http://sox.sourceforge.net/ | |
destination_dir = 'amplified' | |
Dir.mkdir destination_dir unless Dir.exists? destination_dir | |
Dir.glob('./*.wav').each do |f| | |
ratio_db = PVC.new("sox", f, "-n", "stat", "-v").run.stderr.chomp | |
PVC.new("sox", "-v", ratio_db, f, "amplified/#{f}").run | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment