Audio File Tags

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Audio File Tags

JoeJoeTV
Hi there!

Is it possible to read audio file tags like "Track" "Disc" and also arbitrary fields from FLAC files using uos?

Thanks in Advance!
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello JoeJoe.

> is it possible to read audio file tags like "Track" "Disc" and also arbitrary fields from FLAC files using uos?

Hum, the "default" like name, album, title, comment, genre without doubt but for the custom I never try.

FLAC files are managed by libsndfile library, maybe check in uos_libsndfile.pas if other tags are possible.

If it is the case, yes, uos can/will do it.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Re-hello.

I think the best and easy way is to use metaflac

https://xiph.org/flac/documentation_tools_metaflac.html

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Hmm,

I looked into the uos_libsndfile and uos_mpg123 files and in the reference of libsndfile and I can see that both atleast support the track number tag, but it's not available using the uos_flat functions directly and as far as I can read from the code it also isn't stored in the Data record of the Stream. Is there a specific reason for this?

fredvs wrote
Re-hello.

I think the best and easy way is to use metaflac

https://xiph.org/flac/documentation_tools_metaflac.html

Fre;D
I'd rather use a library than to use a command line application, since I want to create a media player of sorts, but if I need to read other vorbis comments then I need it probably, since I couldn't find the functionality in libsndfile.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello.

Sorry but I dont find how to get the " track number tag" with libsndfile...
Could you show me where you found it?

 
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
The sf_get_string function should be able to get the track number tag aswell as the album tag as listed here: https://libsndfile.github.io/libsndfile/api.html#string.

If I'm not mistaken.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Ooops, indeed, there is:

Name Value Description
SF_STR_TITLE 0x01 Title.
SF_STR_COPYRIGHT 0x02 Copyright.
SF_STR_SOFTWARE 0x03 Software.
SF_STR_ARTIST 0x04 Artist.
SF_STR_COMMENT 0x05 Comment.
SF_STR_DATE 0x06 Date.
SF_STR_ALBUM 0x07 Album.
SF_STR_LICENSE 0x08 License.
SF_STR_TRACKNUMBER 0x09 Track number.
SF_STR_GENRE 0x10 Genre.

OK, I will update uos (asap).

Thanks to note it.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Im also saw that this code is commented out for mpg123:

            {// problems with mpg123 library
            mpg123_id3(StreamIn[x].Data.HandleSt, mpid3v1, @mpid3v2);
        // to do : add id2v2
            if (mpid3v1 <> nil) and  (mpid3v1^ <> nil)  then begin
               refmpid3v1 := mpid3v1^^;
               StreamIn[x].Data.title := trim(refmpid3v1.title);
               StreamIn[x].Data.artist := refmpid3v1.artist;
               StreamIn[x].Data.album := refmpid3v1.album;
               StreamIn[x].Data.date := refmpid3v1.year;
               StreamIn[x].Data.comment := refmpid3v1.comment;
               StreamIn[x].Data.tag := refmpid3v1.tag;
               StreamIn[x].Data.genre := refmpid3v1.genre;
            end;
            }
                

Does UOS even read ID3 tags from mp3 files currently? I haven't tried it.

EDIT: Just saw that I was in the wrong function and this is only commented out in the AddfromMemoryStream function.

EDIT2: Ah, but the custom ID3 code also doesn't read the track number tag. Now, I'm not sure, if this tag has some different structure to it than the other tags.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hum, indeed...

I had problems with tag and mpg123 and I use now:
https://github.com/varianus/ovoplayer/tree/master/src/ovotag

Anyway, I will re-enable reading tag with mpg123 library maybe the last binary has fixed it.

Write you later.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Is ovotag also used in uos?


EDIT: It seems ovotag can also read the extra fields from flac files, so maybe i will give that a try.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello.

OK should be fixed in last uos commit: 58b943d

Added:
      function InputGetTagTrack(InputIndex: cint32): pchar;
      function InputGetTagGenre(InputIndex: cint32): pchar;

Also was re-enabled mp3 Tag V1(note that track tag does not exist with mp3 tag V1).

Hope all is ok.

Fre;D


Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Thanks!

Is the ID3 V2 reading broken with mpg123, because from what I saw it should be possible.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Hi again,

I also noticed, that uos isn't storing the album tag, when reading a file using libsndfile. Is this intentional? It sould also work using sf_get_string.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello.

>Is the ID3 V2 reading broken with mpg123, because from what I saw it should be possible.

It is not broken but I was not able to understand how to deal with mpg123 V2 tag.
I did not find a example to help me, sorry for that.
Of course any patch is welcome.

> I also noticed, that uos isn't storing the album tag, when reading a file using libsndfile. Is this intentional?

Hum, It is declared line 736 of uos.pas:
StreamIn[x].Data.album := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ALBUM);
         
Anyway, I will recheck this, thank to note it.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
This post was updated on .
Re-hello.

> > I also noticed, that uos isn't storing the album tag, when reading a file using libsndfile. Is this intentional?

Ooops, indeed, it was not declared everywhere.
I will fix it tonight.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
In reply to this post by JoeJoeTV
Hello.

OK, fixed in commit 6226e94.
Note that tag 'Album', 'Track' and 'Genre' were missing too (and added in last commit).

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
Hey, thanks for fixing these issues!

Also, you said that you are now using ovotag, right?
Can I just use that library in other projects, if they are open source?
I'm sometimes a bit confused when it comes to licenses.
But if this question is not fitting here, that's no problem, I will look elsewhere.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello.

> Also, you said that you are now using ovotag, right?

Yes, for some of my projects that need to read mp3 id3v2.
For example, in Strumpract project it uses a "custom" ovotag compatible with mseide-msegui widgetset:

https://github.com/fredvs/strumpract/blob/main/src/mse_ovotag_id3v2.pas

The big advantage of ovotag is that it does not need any library and is fast for list of song for example.

> Can I just use that library in other projects, if they are open source?

https://github.com/varianus/ovoplayer/blob/master/LICENSE.txt
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

JoeJoeTV
I saw that Ovoplayer and thus Ovotag is Licensed under GPL v2, but I wasn't sure how I need to represent that in my Project. Do I just have to link to the project, or do I also have to put the License of Ovotag somewhere. I guess this goes for UOS too.
Reply | Threaded
Open this post in threaded view
|

Re: Audio File Tags

fredvs
Administrator
Hello.

uos (and all the libraries used) is modified LGPL, so way more free than GPL.

https://github.com/fredvs/uos/blob/main/modifiedLGPL.txt

Hum, about ovotag license.
It is the reason why it is not part of uos.

The GPL license is for the complete ovoplayer project.
Maybe you could ask to Varianus if the same license is applied for ovotag too.

And maybe ask if he would agree to re-license ovotag into modified LGPL...

Good luck.

Fre;D
12