Bug 234166 - Amarok ignores the BPM tag
Summary: Amarok ignores the BPM tag
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.3.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-12 17:30 UTC by o_O_Tync
Modified: 2010-09-24 22:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description o_O_Tync 2010-04-12 17:30:41 UTC
Version:           2.3.0 (using KDE 4.4.2)
OS:                Linux
Installed from:    Ubuntu Packages

I've added the BPM tag to all mp3,ogg,flac files in my collection.
Here's the method I used to achieve this: http://superuser.com/questions/129041/any-beat-detection-software-for-linux/129157#129157

Amarok mostly ignores the new tag in collection (except for few tracks) and shows '0' in the BPM field.
However, when I move any of them out of the collection folder and drag&drop the file into the playlist, the 'edit track details' window shows the stored BPM.
I guess there's a bug somewhere in the collection scanner.
Comment 1 o_O_Tync 2010-04-12 17:36:20 UTC
Full collection rescan made the 'BPM' field available for MP3s and OGGs. FLACs do still have '0' there.
I have no APE tracks so no information available, sorry.
Comment 2 Myriam Schweingruber 2010-08-24 23:45:28 UTC
Is this still valid for Amarok 2.3.1 or 2.3.1 90 ?
Comment 3 Jeff Mitchell 2010-08-25 00:52:01 UTC
After looking at the code, I believe this should be working. Every step of the way along the scanning process it seems to process the BPM values. Reporter, if you could confirm whether or not this is still the case in 2.3.1 (or ideally 2.3.2 beta) that would be great. If it's still broken, if you can link me to a file with a BPM tag (I don't have any) for testing that would be even better. Thanks!
Comment 4 o_O_Tync 2010-08-25 03:38:12 UTC
I've found out that *.mp3 is ok but Amarok 2.3.0 ignores 'BPM' tag in flac & ogg.
Here's the track info:

$ metaflac 10*.flac --export-tags-to=-
TITLE=Стишок серединный
ARTIST=Пилот
ALBUM=Жывой концерррт
DATE=1998
TRACKNUMBER=10
GENRE=Рок
BPM=81

In ogg&flac, this tag is called 'BPM', not 'TBPM' like in ID3. Maybe, that's the clue?

Here's the file:
http://rapidshare.com/files/414966118/10-_________________________________.flac
Comment 5 o_O_Tync 2010-08-25 03:39:46 UTC
I'll re-check this with 2.3.1 ASAP
Comment 6 Jeff Mitchell 2010-08-25 13:39:25 UTC
Ah! No, it won't work right now for Ogg/FLAC. One problem is that the VorbisComment spec is very minimal...in fact it doesn't even specify *any* tags:

"Below is a proposed, minimal list of standard field names with a description of intended use. No single or group of field names is mandatory; a comment header may contain one, all or none of the names in this list."

So BPM wasn't put in the scanner for Ogg and FLAC simply because of not knowing if there was a commonly-used "standard" tag for it. I'll add this in now, and it will be in 2.3.2.
Comment 7 Jeff Mitchell 2010-08-25 13:43:22 UTC
Huh -- I didn't actually look at the code before making my earlier comment. It should already be looking for a BPM VorbisComment field. So if it's not working something is wrong. I'll have to test with the test file and get back to you.
Comment 8 o_O_Tync 2010-08-25 14:11:05 UTC
Thanks! There's no beat in the file actually, but the detection software said it's 81 :)
BTW I've just updated to 2.3.1 and 'BPM' is still '0' in track details.
Comment 9 Jeff Mitchell 2010-08-25 15:00:42 UTC
Unfortunately I have some not-so-good news for you.

I took a look at the file you provided and noticed that the BPM tag isn't reading 0, it's reading Q. As in the 17th letter in the English alphabet. So that's a totally invalid value. I tried reading it with eyeD3 as well, and it couldn't find a valid BPM value either.

Additionally, the tag on the file is not a vorbiscomment but rather a ID3 comment. From the FLAC site:

"What kinds of tags does FLAC support?

FLAC has it's own native tagging system which is identical to that of Vorbis. They are called alternately "FLAC tags" and "Vorbis comments". It is the only tagging system required and guaranteed to be supported by FLAC implementations.

Out of convenience, the reference decoder knows how to skip ID3 tags so that they don't interfere with decoding. But you should not expect any tags beside FLAC tags to be supported in applications; some implementations may not even be able to decode a FLAC file with ID3 tags."

So in other words, you have a FLAC file with an unsupported tag type whose tag also happens to be corrupted. Unfortunately, there's nothing we can do on the Amarok side to fix that -- the only thing that you can do is fix your tags.

Sorry for the bad news...
Comment 10 Lari Natri 2010-09-17 13:05:51 UTC
I seem to have the same problem: BPM tags are not displayed for flac files in the collection (reported as 0). If a flac file is added to the playlist from a directory outside the collection, BPM is displayed correctly. Deleting collection data and rescanning does not help. The tag works fine for ogg and mp3 (also in collection folders).

At the moment i'm using Amarok 2.3.2 and libtag1 1.6.3 on Kubuntu Maverick 10.10 beta, but the problem existed with previous versions also. My files are, to all appearances, using Vorbis comments fields, and without id3 tags.

An output of metaflac for a file with the problem:
 METADATA block #2
   type: 4 (VORBIS_COMMENT)
   is last: false
   length: 259
   vendor string: reference libFLAC 1.2.1 20070917
   comments: 9
     comment[0]: ALBUM=Ineffable Mysteries from Shpongleland
     comment[1]: ARTIST=Shpongle
     comment[2]: COMPOSER=Simon Posford & Raja Ram
     comment[3]: DATE=2009
     comment[4]: DESCRIPTION=Released on 2.11.2009
     comment[5]: GENRE=psyish
     comment[6]: TITLE=Electroplasm
     comment[7]: TRACKNUMBER=1
     comment[8]: BPM=107
Comment 11 Jeff Mitchell 2010-09-17 14:06:34 UTC
Lari, please make one of those files available to me (you can send me a link in a private email if you like, although please don't mail me the file) so I can take a look.

Thanks.
Comment 12 Lari Natri 2010-09-17 17:25:23 UTC
Jeff: i mailed you a link to an example file.
Comment 13 Jeff Mitchell 2010-09-17 18:59:50 UTC
commit ce57e4264d0395b15e7253e3cdef48e36a8b129c
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Fri Sep 17 13:02:38 2010 -0400

    FLAC BPM tags could be read in incorrectly.
    
    BUG: 234166

diff --git a/ChangeLog b/ChangeLog
index 73b3334..edd0bfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@ Amarok ChangeLog
 ================
 (C) 2002-2010 the Amarok authors.
 
+VERSION NEXT
+  FEATURES:
+
+  CHANGES:
+
+  BUGFIXES:
+    * FLAC BPM tags could be read incorrectly. (BR 234166)
+
 
 VERSION 2.3.2
   FEATURES:
diff --git a/utilities/collectionscanner/CollectionScanner.cpp b/utilities/collectionscanner/CollectionScanner.cpp
index a9d6755..0a23a53 100644
--- a/utilities/collectionscanner/CollectionScanner.cpp
+++ b/utilities/collectionscanner/CollectionScanner.cpp
@@ -701,7 +701,7 @@ CollectionScanner::readTags( const QString &path, TagLib::AudioProperties::ReadS
                     attributes["composer"] = TStringToQString( file->xiphComment()->fieldListMap()["COMPOSER"].front() ).trimmed();
 
                 if ( !file->xiphComment()->fieldListMap()[ "BPM" ].isEmpty() )
-                    attributes["bpm"] = TStringToQString( file->xiphComment()->fieldListMap()["BPM"].front() ).trimmed().toFloat();
+                    attributes["bpm"] = TStringToQString( file->xiphComment()->fieldListMap()["BPM"].front() ).trimmed();
 
                 if ( !file->xiphComment()->fieldListMap()[ "DISCNUMBER" ].isEmpty() )
                     disc = TStringToQString( file->xiphComment()->fieldListMap()["DISCNUMBER"].front() ).trimmed();
Comment 14 Jeff Mitchell 2010-09-17 19:02:16 UTC
Hi Lari,

I've fixed this. We just tagged 2.3.2, so I'm going to send the patch to packagers and ask them to please apply this to the 2.3.2 tarball, else it might be a while before you see this in a release. If this is still broken in 2.3.2 when the package becomes available in your distro, please ask your packager to get the patch from the amarok-packagers mailing list.

Thanks!
Comment 15 Lari Natri 2010-09-19 20:59:54 UTC
Nice one! Thank you.
Comment 16 o_O_Tync 2010-09-23 04:23:57 UTC
Now there's another strange issue in 2.3.2: I have a FLAC file in the collection with both ID3v2 & VorbisComment metadata, each having a 'BPM' tag. When I open its details in the playlist, it shows me 'BPM: 0'.

However, when I copy the file to /tmp and drag it into the playlist (so Amarok can't find it in the collection) — it displays BPM value at last!

I believe there's an issue with the collection scanner. After i re-tagged everything with BPMs — not 'update' nor 'fully rescan' made the value available in details and 'bpm:>0' search term.
Comment 17 Myriam Schweingruber 2010-09-23 16:03:43 UTC
Did you see comment #14?
Comment 18 o_O_Tync 2010-09-24 01:13:29 UTC
Yes, but still I'm not sure whether the magic patch was included in KUbuntu packages :) Okay, let's close the bug for now.
Comment 19 Myriam Schweingruber 2010-09-24 22:13:48 UTC
It sure was yesterday.