RubyMp3gain
RubyMP3Gain is an Mp3Gain wrapper written in Ruby. Works also with e.g. aacgain for Mac OSX.
Installation
from rubygems using
gem install mp3gain
or from the sources using
gem build mp3gain.gemspec
And then execute:
$ gem install mp3gain-1.0.0.gem
Usage
require 'mp3gain'
mp3gain = Mp3gain.init("path/to/MP3Gain/binary")
## optional target db and preserve timestamps
mp3gain = Mp3gain.init("aacgain", 100, preserve_timestamp: false)
# or use a chainable to
mp3gain =Mp3gain.path("path/to/MP3Gain/binary").with_target_db(100).do_preserve_timestamp(preserve: false)
# print current version
mp3gain.version
# analyze the gain of the given files
mp3gain.analyze_gain(['path/to/file1', 'path/to/file2'])
# delete stored tag infos of the given files
mp3gain.delete_stored_tag_info(['path/to/file1', 'path/to/file2'])
# apply track gain depending on the provided target DB
mp3gain.apply_track_gain(['path/to/file1', 'path/to/file2'])
# apply album gain depending on the provided target DB
mp3gain.apply_album_gain(['path/to/file1', 'path/to/file2'])
# apply the given gain
mp3gain.add_gain(['path/to/file1', 'path/to/file2'], 5)
License
The gem is available as open source under the terms of the MIT License.