Freesound Ruby
Consume the Freesound.org API with Ruby.
Installation
Add this line to your application's Gemfile:
gem 'freesound_ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install freesound_ruby
Usage
You will need an API key to use the Freesound gem:
require 'freesound'
Freesound.api_key = "your_api_key"
And a client object:
client = Freesound::Client.new
Freesound exposes three resources: sounds, users, and packs. You can request them directly from the client:
sound = client.sound(17185)
user = client.user("alexgenco")
pack = client.pack(5107)
Resources will respond to any attributes returned by the API:
sound.bitrate # => 1411
user.username # => "alexgenco"
pack.name # => "Iceland"
You can also search for sounds:
client.search("kick") # => (many sounds)
The Freesound API also supports pagination and robust search filters, but this library doesn't support them quite yet.
More features to come!
Contributing
- Fork it
- 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 new Pull Request
You will need a Freesound.org API key to run the integration tests. Get one here and assign it to the FREESOUND_KEY environment variable.