[aubio-user] Onset detection in Python

Paul Brossier piem at piem.org
Wed Mar 19 19:40:38 CET 2014

On 03/19/2014 10:47 AM, Lukasz Tracewski wrote:
>> Interesting, I just made some tests, and even with a 45 minutes
>> long, scipy is still 3 or 4 times slower. wow, memory is cheap
>> nowadays, and file access is slow. still, loading the entire file
>> in memory is usually *not* the best approach, at least not the one
>>  i prefer. :-)
> Sure, scipy is slower with loading files. What is faster in my case
> is when I load a file into memory and then do scipy filtering on a
> whole sample - and not on frames. I have yet to try the filtering
> that is in aubio, had no clue that such thing existed. Even if I get
>  high-pass filtering working your way, I still need to get whole
> sample into memory I am afraid for other reasons.

Sorry, I meant to write 'aubio is slower'! not easy for me to write that :)

> One of crucial steps in my case is noise reduction by spectral
> subtraction. I use aubio onsets to find potential animals' calls.
> Once they are identified, I can also tell which regions are
> noise-only, analyse their spectral content and then subtract the
> noise from the whole sample. As you can see in this case having
> complete file in memory cannot be avoided (or rather trying to do so
>  would increase complexity and reduce effectiveness of the method -
> what if noise-only region is only at the end of the sample?).

makes perfect sense.

>> why do you need this hstack line? you could use
>> aubio.digital_filter and use the highpassed_samples directly.
> The hstack is to get complete sample into memory by concatenating
> frames read by "source". Reason for this I have just explained above.
> Is there a smarter way of doing this?

no, but as you already figured out, loading the entire file once is the
most efficient in your case.

> Anyway, thanks for the tip with using filters! Indeed an example in
> Python would be welcomed to make people more aware of this nice
> feature. The filter coefficients can be easily produced by
> scipy.signal module.

i'll add some simple examples to compute common filter types
coefficients too.

>> that's great, i love thinking these lines of code can help a bit!
> The project is to support efforts in kiwi protection, famous
> flightless bird from New Zealand. We count their calls (and also
> determine gender) in each file and use this information to understand
> ecosystem health and how well protection efforts are working. As you
> can imagine finding that there is *something* worth interest in a
> recording is crucial: if there are too many false positives, then
> noise reduction by spectral subtraction becomes inefficient. The
> other way risk is even greater: if bird call goes undetected, then it
> will be included in noise-only regions and then subtracted from a
> whole sample, effectively eliminating many possible candidates.
> Processing time becomes important when there are truly many sample.
> As mentioned before, there are 10000 hours of recordings. To get them
> identified we will probably buy time on Amazon Web Services EC2
> compute-optimized instance (something with 32 virtual CPUs). Time is
> money in this case, so keeping it short is crucial.

This is fascinating. Would you mind if I prepare some short post to
publish on aubio's blog?

Best, Paul

> Thanks!!! Lucas
> _______________________________________________ aubio-user mailing
> list aubio-user at aubio.org
> https://lists.aubio.org/listinfo/aubio-user

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: OpenPGP digital signature
URL: <http://lists.aubio.org/pipermail/aubio-user/attachments/20140319/8808841d/attachment.sig>

More information about the aubio-user mailing list