Skip to content

Instantly share code, notes, and snippets.

@chrisjmendez
Created May 1, 2017 23:59
Show Gist options
  • Save chrisjmendez/86130966b83744cd080e2267cb97f22a to your computer and use it in GitHub Desktop.
Save chrisjmendez/86130966b83744cd080e2267cb97f22a to your computer and use it in GitHub Desktop.
Converting a WAV file to FLAC with customization. https://superuser.com/a/1145254
namespace :convert do
# https://superuser.com/a/1145254
desc %Q{ ›› Convert from WAC to FLAC to 16-bit and 44.1 kHz. }
task :low_res, [:wav, :flac] do |task, args|
wav = args.wav
flac = args.flac
bit_rate = 16
sample_rate = 44100
sh %{ ffmpeg -i #{wav} -af aformat=s#{bit_rate}:#{sample_rate} #{flac} }
end
desc %Q{ ›› Convert from WAC to FLAC to 32-bit and 176,000 kHz. }
task :high_res, [:wav, :flac] do |task, args|
wav = args.wav
flac = args.flac
bit_rate = 32
sample_rate = 176000
sh %{ ffmpeg -i #{wav} -af aformat=s#{bit_rate}:#{sample_rate} #{flac} }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment