katyo / aubio-rs

Rust bindings for Aubio library
37 stars 7 forks source link

Add various utils functions to `aubio-rs` #4

Closed Polochon-street closed 4 years ago

Polochon-street commented 4 years ago

I needed some stuff from https://aubio.org/doc/latest/musicutils_8h.html, so added it.

Not sure whether we should use self::utils::*, though (cause then we can directly do aubio_rs::utils_function(), which seems a bit messy.

Also not sure about making silence_detection's return value boolean, as it can be misleading?

katyo commented 4 years ago

Looks good to me.

Polochon-street commented 4 years ago

Thx for the review! However I think we should wait for https://github.com/aubio/aubio/pull/286 to be merged maybe? As I'm not sure what's should be true / false for silence_detection

katyo commented 4 years ago

Aubio library seems to be very passively maintained for now.

As I see retval == 1 means level under threshold i.e. silence: https://github.com/aubio/aubio/blob/2eb52bd821788405d5e380c71249ac91d58d22ed/src/mathutils.c#L614-L618

Since this function called silence_detection so true should means silence I think.

0 != unsafe { ffi::aubio_silence_detection(input.as_ptr(), threshold) }
Polochon-street commented 4 years ago

Oh, I see.

I've changed it, and also added on note on the comment. Thanks for looking into it!