freesound-rs
A Rust client library for the Freesound API.
Note: this is a side project, so I should only implement search and get sound endpoints for now. But contributions are welcome!
Installation
Add this to your Cargo.toml
:
Usage
Basic setup
use ;
async
Searching sounds
// Simple search
let query = new
.query
.build;
let results = client.search.await?;
println!;
// Advanced search with filters and sorting
let query = new
.query
.filter // Guitar sounds between 1 and 10 seconds
.sort // Best rated first
.page
.page_size
.fields // Only return these fields
.build;
let results = client.search.await?;
// Process search results
for sound in results.results
Getting sound details
// Get basic sound information
let sound = client.get_sound.await?;
println!;
println!;
println!;
// Get sound with audio analysis descriptors
let sound = client
.get_sound
.await?;
// Access preview URLs
if let Some = sound.previews
Running tests
Obtain a Freesound API key:
- Register for an account at https://freesound.org/
- Visit https://freesound.org/apiv2/apply/ to create an API application
- After approval, you'll receive your API key
Create an .env
file with your key and run the tests:
# edit `.env` to add your FreeSound API key
License
This project is licensed under the GNU LGPL License - see the LICENSE file for details.