Last Updated: February 25, 2016
·
1.029K
· 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.