Dragonfly Audio
Wraps common audio-related tasks into Dragonfly analysers and processors.
Installation
Add this line to your application's Gemfile:
gem 'dragonfly_audio'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dragonfly_audio
Dependencies
This gem uses taglib-ruby to read and write meta data and properties of audio files.
Usage
Add the :audio
plugin to your Dragonfly config block:
Dragonfly.app.configure do
plugin :audio
end
Supported Formats
List of supported formats is available as:
DragonflyAudio::SUPPORTED_FORMATS # => ["aif", "aiff", …]
Analysers
audio_properties
Reads properties and tags of an audio file:
audio.audio_properties
# => {
# title: 'The Ship Was Sailing',
# artist: 'Vito Ricci',
# album: 'Music From Memory',
# year: '1985',
# track: 7
# genre: 'Ambient',
# comment: 'This Music was originally composed for "The Memory Theatre of Gulio Camillo" by Matthew Maguire. A Creation production premiered at La Mama Spring 1985 thanks to Bonnie for not laughing to Justin for laughing to Jon Gordron for electronic bondage produced by Jonathan Mann for Pangea Productions recorded 8/85 at Chiens Interdits Studio in a big cover production by Ann Rower cover design by Paul Leone * all compositions by Vito Ricci * play it loud',
# length: 345,
# length_in_seconds: 345,
# length_in_milliseconds: 345000,
# bitrate: 192,
# channels: 2,
# sample_rate: 44_100
# }
Processors
tag
Sets the file's meta information:
audio.tag(artist: 'Ariel Kalma', album: 'Le Temps Des Moissons', track: 'Bakafrika')
Permissible properties:
- album
- artist
- comment
- genre
- tag
- title
- track
- year
album_art
Sets the file's album art:
audio.album_art('path_to_file')
Note that this only works for mp3 files.
Contributing
- Fork it ( https://github.com/tomasc/dragonfly_audio/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request