Last Updated: February 25, 2016
·
1.259K
· sashich

Using guard and lame to convert wav to mp3.

Using guard and lame to convert wav to mp3.

# Gemfile:
gem 'guard'
gem 'guard-shell'

# Guardfile:
guard :shell do
  SOURCE = "/var/records/source"
  DESTINATION = "/var/records/dest"
  watch %r{^(.*)\.wav$} do |m|
    "lame -b 32 --resample 8 -a #{SOURCE}/#{m[1]}.wav #{DESTINATION}/#{m[1]}.mp3"
  end
  ignore %r{^in-(.*)\.wav$}, %r{^out-(.*)\.wav$} 
end

Shell command:

bundle exec guard --watchdir #{GUARD_WATCH_DIR} --guardfile #{GUARD_CONFIG_FILE}

Upytime 2 months.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

Guarding a web app includes the code that arrives in the browser, not only the code in source control. Tags and dependencies can change in production between deploys.

Security insights from Cside