Skip to content

Instantly share code, notes, and snippets.

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