Can't use those AcousticID Tags? (Queries involving non-integer ranges)

I’ve recently upgraded from Beets 1.3.8 (on my Debian Stable machine) to 1.4.3 primarily to use the AcousticId metadata. The upgrade went seamlessly. I see all these flexible attributes have now been defined if I run beet fields. I’m halfway through pulling down the new AcousticId tags (things like danceability, mood_*, etc.), and am ready to create playlists using this new data.

For the new AcousticId text type fields (e.g. instrumental or vocal), a beet list query works as expected. The same works for things the real-valued fields for mood_* and danceability if I provide an exact value.
For instance:
beet list danceable:0.5
gets me songs that have a danceable attribute of 0.51, 0.59, 0.533121, etc. Great!

The problem is if I want to query a range of values, for danceability, for instance, from 0.4 - 0.9. At first I tried specifying ranges as suggested in the docs, such as

beet list danceable:0.4..0.9.

This returns nothing. I figure that’s because most number ranges in beets are >> 1 even if they’re real values (1999, 160, etc). And such ranges work for dates, bpm, etc. using A…B. But most of the awesome new AcousticId data are a real value that range from 0 to 1.

I’ve also tried to use use regex to little avail, e.g.:
beet list 'danceable:0.[0-4]'
Plus any number of minor variations (that probably shouldn’t work anyway).

Has anyone else tried querying a range of non-integer custom fields?

Hi! Do you mean the AcousticBrainz plugin?

Beets’ range query syntax does work with non-integers, but it looks like the AB plugin isn’t declaring its fields as numeric. (Beets uses a “types” system to decide how to query different fields; without specific instructions, everything is treated as strings.)

In the short term, you can use the types plugin to declare a numeric type for the fields you’re interested. For a real solution, would you mind filing a GitHub issue requesting that the AB plugin declare types for its fields, like the old Echo Nest plugin did?

Thanks @adrian! Yes, I did mean AcousticBrainz (not AcousticId, whoops). I defined the appropriate type using the types plugin, like

config.yaml
...
types:
    danceable: float
    mood_aggressive: float
    mood_happy: float
    chords_number_rate: float
    chords_scale: float
    key_strength: float
    average_loudness: float
    chords_changes_rate: float
    mood_electronic: float
    mood_sad: float
    mood_acoustic: float
    mood_party: float
    danceable: float
    mood_relaxed: float
    tonal: float

And beets now treats these as float numbers (and ranges work now). Thanks for the quick response. I’ll post a issue for this at github.

1 Like