Beats-Per-Minute Provider¶

Overview¶

This provider is able to analyze an audio file path in order to find the average beats-per-minute rate.

Usage Example:

>>> from munin.provider import BPMProvider
>>> p = BPMProvider()
>>> p.do_process('/tmp/some_file.mp3')
(123.456, )  # beats per minute


The potential Information you can get from this is: Songs of different genre often have differente tempi, therefore are less similar. This is no rule of course.

Problems to consider:

• Noisy Live-data often gets high BPM counts
• Speed-Metal (as an example) ranges in the same

Prerequisites:

To function properly this poorly implemented provider needs two external utils:

Reference¶

class munin.provider.bpm.BPMProvider(compress=False)[source]

A Beats-per-minute provider.

Currently, this is stupidly implemented as a call to an external util:

\$ sox -v 1.0 path -t raw -r 44100 -e float -c 1 - | bpm -m 60 -x 350


Create a new Provider with the following attributes:

Parameters: compress – Deduplicate data?
class munin.provider.bpm.BPMCachedProvider(cache_invalid=False, **kwargs)[source]

Same as BPMProvider, but adds a caching layer.

A .bpm file with the calculated value will be stored along the audio file, and the same place will be checked before actually calculating it.

Parameters: cache_invalid – Also cache invalid results of failed calculations?