sbooth / SFBAudioEngine

A powerhouse of audio functionality for macOS, iOS, and tvOS
https://sbooth.github.io/SFBAudioEngine/
MIT License
572 stars 86 forks source link

Read "comments" tag for FLAC audio file #370

Open blezin2205 opened 3 weeks ago

blezin2205 commented 3 weeks ago

Hello, I'm working on a sample project to read FLAC audio tags and I'm encountering an issue with the "comments" tag. Despite there being comments in the FLAC files, tags.metadata.comment is returning nil. I would really appreciate your insights or any suggestions you might have on how to resolve this issue. Thank you so much for your help!

Example project: https://drive.google.com/file/d/1k6jun1LG_WM_tDefBiBl4YN9l9xiyUzY/view?usp=sharing

sbooth commented 3 weeks ago

The issue is that the file contains a field named COMMENT while the canonical name for a comment in a Vorbis comment field is DESCRIPTION. Perhaps it would be better to look for a COMMENT field if a DESCRIPTION field is absent but you can access the other fields via the additionalMetadata dictionary.

sbooth commented 3 weeks ago

It also seems that Picard uses COMMENT so perhaps DESCRIPTION is outdated despite what the spec says.

Volodymyr-13 commented 3 weeks ago

The issue is that the file contains a field named COMMENT while the canonical name for a comment in a Vorbis comment field is DESCRIPTION. Perhaps it would be better to look for a COMMENT field if a DESCRIPTION field is absent but you can access the other fields via the additionalMetadata dictionary.

I just wondering why TagLib reads this... so logically its wrapper in this repo should too, but it's not. Maybe as fallback?

Anyway, users reported me this problem, telling me that some files missing that comments filed, but other audio apps reads it.

sbooth commented 3 weeks ago

It's somewhat a question of mapping. The higher-level TagLib accessor for Xiph comments use DESCRIPTION if found, COMMENT next, or "" if neither are present, joining multiple fields with the same name using /. I use the raw fields directly and follow the Xiph spec with regard to naming.

Volodymyr-13 commented 1 week ago

It's somewhat a question of mapping. The higher-level TagLib accessor for Xiph comments use DESCRIPTION if found, COMMENT next, or "" if neither are present, joining multiple fields with the same name using /. I use the raw fields directly and follow the Xiph spec with regard to naming.

Hey @sbooth, will this issue be resolved anytime soon?

sbooth commented 1 week ago

I suppose I need to be convinced this is an actual issue first.

In the meantime it's simple enough to test if the format is FLAC, and if so, check the additional metadata for the COMMENT field if the DESCRIPTION field is empty.