Skip to content

Instantly share code, notes, and snippets.

@dtinth
Last active September 26, 2019 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtinth/c4c7e6ec24a89df43065f26b741f26e5 to your computer and use it in GitHub Desktop.
Save dtinth/c4c7e6ec24a89df43065f26b741f26e5 to your computer and use it in GitHub Desktop.
file_list = Dir['original/*.wav']
file_list.each_with_index do |original_wav, index|
basename = File.basename(original_wav)
target_wav = "processed/#{basename}"
gain = case basename
when /^piano/; 4
else; 0
end
puts "[#{index + 1}/#{file_list.length}] #{basename} (#{gain})"
system "sox", original_wav, target_wav, "gain", "#{gain}" or raise "Cannot convert"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment