Author Topic: Trying to retrieve artist from music file  (Read 206 times)

scarboni

  • Posts: 32
Trying to retrieve artist from music file
« on: 17 Nov '20 - 16:07 »
Hello !

I am trying to retrieve the artist data from a music file. I already know how to retrieve the music duration, that I have to create a channel just for it, and I think it is similar to get metadata such as author. However, I'm not sure what to do to retrieve the author other than that, I found an incomplete example

Code: [Select]
decoder = BASS_StreamCreateFile(false, filename, 0, 0, BASS_STREAM_DECODE); // create a decoder for a file
duration = BASS_ChannelBytes2Second(decoder, BASS_ChannelGetLength(decoder, BASS_POS_BYTE)); // get its duration
tags = BASS_ChannelGetTags(decoder, ...); // get tags from it
...
BASS_StreamFree(decoder); // free the decoder

But I couldn't manage to find how to go from there, to get the artist. Can you please help me?

Ian @ un4seen

  • Administrator
  • Posts: 23311
Re: Trying to retrieve artist from music file
« Reply #1 on: 17 Nov '20 - 18:06 »
Different file formats will have different tag types, so it may need quite a lot of code if you want to handle them all. You can avoid that with the TAGS add-on. For example, you can get the artist like this:

Code: [Select]
char *artist = TAGS_Read(handle, "%ARTI");

Please see the "readme" file included in the TAGS package for details.

scarboni

  • Posts: 32
Re: Trying to retrieve artist from music file
« Reply #2 on: 19 Nov '20 - 16:03 »
It worked like a charm thank you !
I'm adding support for this lib in my wrapper then !
I didn't find any particular license, I guess the Ian mentionned in the Readme is you? So don't hesitate to let me know if there is any licence I need to add too ! :)

I wish you a nice day !

Ian @ un4seen

  • Administrator
  • Posts: 23311
Re: Trying to retrieve artist from music file
« Reply #3 on: 20 Nov '20 - 13:10 »
The TAGS add-on is public domain, so you are free to do what you like with it :)

scarboni

  • Posts: 32
Re: Trying to retrieve artist from music file
« Reply #4 on: 27 Nov '20 - 14:34 »
Perfect, thank you for clarifying that ! :)