Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.