AlsaBackup

DESCRIPTION:

ALSA client to perform continuous recording

FEATURES/PROBLEMS:

  • configurable file name strategy

SYNOPSIS:

By using the default settings :

alsa-backup

will record in record.wav the default alsa device

By using command line arguments :

alsa-backup --directory=/tmp --file=test.wav --length=2

will record 2 seconds in /tmp/test.wav

By loading a configuration :

alsa-backup --config=/path/to/config

will load the specified configuration

CONFIGURATION:

The configuration file is a Ruby file. This piece of code can configurate the AlsaBacup recorder :

AlsaBackup.config do |recorder|
  # configure recorder here :
  recorder.file = "record.wav"
end

Recorder File

The recorder file can be specified as a simple string :

recorder.file = "record.wav"

The recorder file can be specified by a Proc which returns the string :

recorder.file = Proc.new {
  Time.now.strftime("%Y/%m-%b/%d-%a/%Hh.wav")
}

will use the current time to create file names like these :

2009/05-May/17-Sun/19h.wav
2009/05-May/17-Sun/20h.wav

To use different files every 15 minutes :

recorder.file = Proc.new {
  Time.now.floor(:min, 15).strftime("%Y/%m-%b/%d-%a/%Hh%M.wav")
}

will create files like these :

2009/05-May/17-Sun/19h00.wav
2009/05-May/17-Sun/19h15.wav

See config.sample.

REQUIREMENTS:

INSTALL:

sudo apt-get install libasound2 libsndfile1
sudo gem install --source http://gems.github.com albanpeignier-alsa-backup

LICENSE:

(The MIT License)

Copyright © 2009 Alban Peignier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.