Author Topic: Tags Library  (Read 63359 times)

TCount

  • Posts: 30
Re: NEW: Tags Library
« Reply #75 on: 17 Jan '15 - 15:11 »
Hi!
How to get information from the tag "WXXX"?
I'm using Delphi.

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #76 on: 17 Jan '15 - 20:03 »
Something like this:

Code: [Select]
var
    URL: Strings;
    Description: String;
    Index: Integer;
begin
    Index := ID3v2Tag.FrameExists('WXXX');
    URL := ID3v2Tag.GetUnicodeUserDefinedURLLink(Index, Description);
    ....
end;

TCount

  • Posts: 30
Re: NEW: Tags Library
« Reply #77 on: 18 Jan '15 - 08:55 »
Something like this:
Thanks for the reply! and how to use the TagsLib?
I get tags like this:
Code: [Select]
procedure GetTags(const Pot: HSTREAM;I: PSoundData;var Png: TPngimage);
var BTags: HTags;ExT: TExtTag;
begin
InitTagsLibrary;
IF TagsLibraryLoaded THEN BEGIN
 BTags:=TagsLibrary_Create;
 if TagsLibrary_LoadFromBASS(BTags,Pot)=0 then begin
  I.Artist:=TagsLibrary_GetTag(BTags,PChar('ARTIST'),ttAutomatic);
  I.Title:=TagsLibrary_GetTag(BTags,PChar('TITLE'),ttAutomatic);
  I.Album:=TagsLibrary_GetTag(BTags,PChar('ALBUM'),ttAutomatic);
  I.AlbumAvtor:=TagsLibrary_GetTag(BTags,PChar('ALBUMARTIST'),ttAutomatic);
  I.Genre:=TagsLibrary_GetTag(BTags,PChar('GENRE'),ttAutomatic);
   if I.Genre>'' then if I.Genre[1]='(' then begin Delete(I.Genre,1,1);Delete(I.Genre,I.Genre.Length,1);end;
  I.Year:=TagsLibrary_GetTag(BTags,PChar('YEAR'),ttAutomatic);
  I.Compositor:=TagsLibrary_GetTag(BTags,PChar('COMPOSER'),ttAutomatic);
  I.AvtPrava:=TagsLibrary_GetTag(BTags,PChar('COPYRIGHT'),ttAutomatic);
  I.Comment:=TagsLibrary_GetTag(BTags,PChar('COMMENT'),ttAutomatic);
  I.Track:=TagsLibrary_GetTag(BTags,PChar('TRACKNUMBER'),ttAutomatic);
  I.Disc:=TagsLibrary_GetTag(BTags,PChar('DISCNUMBER'),ttAutomatic);
  I.Izdatel:=TagsLibrary_GetTag(BTags,PChar('PUBLISHER'),ttAutomatic);
  I.Lyrics:=TagsLibrary_GetTag(BTags,PChar('LYRICS'),ttAutomatic);
  I.Encode:=TagsLibrary_GetTag(BTags,PChar('ENCODEDBY'),ttAutomatic);
  ....
  TagsLibrary_GetTagEx(BTags,PChar('WXXX'),ttAutomatic,@ExT);
  ///what to do next???
  ....
 end;
 GetCover(BTags,PNG);
 TagsLibrary_Free(BTags);
END;
FreeTagsLibrary;
end;

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #78 on: 18 Jan '15 - 16:45 »
Try something like:

Code: [Select]
var
    ID3v2TagEx: TID3v2TagEx;
begin
    ...
    if TagsLibrary_GetTagEx(BTags, PChar('WXXX'), ttID3v2, @ID3v2TagEx) then begin
        Showmessage(ID3v2TagEx.Description + #13#10 + ID3v2TagEx.Value);
    end;
    ...

TCount

  • Posts: 30
Re: NEW: Tags Library
« Reply #79 on: 18 Jan '15 - 18:23 »
Try something like:

Code: [Select]
var
    ID3v2TagEx: TID3v2TagEx;
begin
    ...
    if TagsLibrary_GetTagEx(BTags, PChar('WXXX'), ttID3v2, @ID3v2TagEx) then begin
        Showmessage(ID3v2TagEx.Description + #13#10 + ID3v2TagEx.Value);
    end;
    ...

Thank you, it works! but with Latin fonts ...
With Cyrillic returns something like:
xn--b1aghcal4aiv

And more:
1. Why does not work?
TagsLibrary_SetTag(HTags,PChar('COMMENT'),PChar('Co'),ttAutomatic);
2. How to install the tag using "TagsLibrary_SetTagEx"?
3. How to set Unicode tag "COMMENT"?
« Last Edit: 18 Jan '15 - 21:21 by TCount »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #80 on: 20 Jan '15 - 00:33 »
Sorry, there was a typo, please try this update, COMMENT setting should be fixed: TagsLib.zip

Regarding Cyrillic WXXX, could you please provide a download link of a such file?
The library does not do any conversion when extracting the WXXX URL so I'm unsure what the problem is.

TagsLibrary_SetTagEx() expects a specific structure in 'ExtTag', as written in the docs:

              'TagType' values need a specific 'ExtTag' pointer to different structures:
                 ttAutomatic: 'ExtTag'  needs to point to a 'TExtTag' structure.
      ttAPEv2: 'ExtTag'  needs to point to a 'TSimpleTag' structure.
      ttFlac: 'ExtTag'  needs to point to a 'TSimpleTag' structure.
      ttID3v1: 'ExtTag'  needs to point to a 'TSimpleTag' structure.
      ttID3v2: 'ExtTag'  needs to point to a 'TID3v2TagEx' structure.
      ttMP4: 'ExtTag'  needs to point to a 'TMP4TagEx' structure.
      ttOpusVorbis: 'ExtTag'  needs to point to a 'TSimpleTag' structure.
      ttWAV: 'ExtTag'  needs to point to a 'TSimpleTag' structure.
      ttWMA: 'ExtTag'  needs to point to a 'TSimpleTag' structure.

Is this the problem?

About unicode comment: the library always uses unicode strings so comment or any other tag in ID3v2 should be set as unicode.

TCount

  • Posts: 30
Re: NEW: Tags Library
« Reply #81 on: 20 Jan '15 - 10:11 »
TagsLibrary_SetTag with "COMMENT" now works! :)
Here is a link to a file:
https://yadi.sk/d/ygiDDJ1ue7JU4
Value Tag "WXXX" ("URL") in file:
http:\\google.com (привет)
TagsLibrary_GetTagEx return:
http:\\google.xn--com ()-mofyz3el1a

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #82 on: 20 Jan '15 - 18:47 »
Please try this update: TagsLib.zip

Now StringOf() is used which uses the system default locale to convert the string.

BTW. mp3tag shows the URL exactly like you posted, so I'm not sure it will work. You can always use the TagsLibrary_GetTagData() to get the raw data and you can process it as you wish if you are not satisfied with the current result.

TCount

  • Posts: 30
Re: NEW: Tags Library
« Reply #83 on: 21 Jan '15 - 09:39 »
I watched a program like MP3Tag ...
This is a mistake of the program, with which I have worked with tags.
 :)

invoker

  • Posts: 7
Re: NEW: Tags Library
« Reply #84 on: 3 Feb '15 - 06:35 »
Is here any support for iOS?
I got a static library in www.un4seen.com/stuff/tags-ios.zip

and there is no header file, so I download a fullversion,
check the file "TagsLibraryDefs.h"  in [Tags Library 1.0.32.55]

-----init code-------
BOOL InitTagsLibrary()
{
#ifdef _WIN32
   TagsLibraryDLLHandle = LoadLibrary(FILENAME_DLL_TAGS_LIBRARY);
#else //* OSX
   TagsLibraryDLLHandle = dlopen(FILENAME_DLL_TAGS_LIBRARY, RTLD_NOW);
#endif
-----init code-------

-----free code-------
BOOL FreeTagsLibrary()
{
   if (NULL != TagsLibraryDLLHandle)
   {
#ifdef _WIN32
      TagsLibraryDLLLoaded = !FreeLibrary(TagsLibraryDLLHandle);
#else //* OSX
      TagsLibraryDLLLoaded = dlclose(TagsLibraryDLLHandle);
#endif
   }
   return !TagsLibraryDLLLoaded;
}
-----free code-------

not for iOS?

or there is another header file for the static library for ios

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #85 on: 3 Feb '15 - 20:37 »
Sorry, but no iOS version is possible yet, the library is developed in Delphi and I'm afraid it's not yet possible to build an iOS version of the .dll in Delphi yet. But I'm not sure it's possible at all, as I recall there's no dynamic linking available in iOS.
iOS is supported by the Delphi class, which can be compiled for any target Delphi supports.

The package has been updated to version 1.0.32.55:

  • Added functions for getting/setting MP4 list tags (TIPL, TMCL)
  • Fixed setting ID3v2 COMMENT tag
  • Fixed TagsLibrary_GetTagData() function
  • Added parsing of MP4 play time (TMP4Tag.Playtime)
  • Added parsing of MP4 audio attributes
  • Fixed MP4 atom data delete function
  • Added tag reading and writing support for Ogg Theora video files (experimental)
  • Fixed issues related to WMA tag stream indexes

Download link in the first post.

invoker

  • Posts: 7
Re: NEW: Tags Library
« Reply #86 on: 4 Feb '15 - 02:57 »
thanks,I gotta try

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #87 on: 7 Feb '15 - 14:33 »
Having trouble with Tags Library in VB6. I have had the wrapper corrected by Bonnie West at VBforums and attached it for anyone who would like it.

To test I am reading a Wavpack lossless file and then simply converting and saving the data again to any of flac, ogg, mp3, mpc, m4a files. All the files are perfect, including cover art, except m4a. It is lacking any tags at all in mp3tag, foobar2000. However dbPowerAmp can see the album art and some of the data. If I convert the Wavpack file with dbPoweramp then all data shows in FB2K and mp3tag.

       
Code: [Select]
Dim Tags as long
        Tags = TagsLibrary_Create
        TagsLibrary_Load Tags, StrPtr(Inp$), ttAutomatic, True
        TagsLibrary_Save Tags, StrPtr(Out$), ttAutomatic

I am probably doing something wrong and I would be grateful for a push in the right direction.

I cannot seem to get the syntax right to discover things like bitrate etc.

Regards - Steve.

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #88 on: 7 Feb '15 - 20:42 »
Please try this update: TagsLib.zip

There was a bug that if a tag was unknown for MP4 the library would write an atom with name $000000, which seems that confuses other tagger.

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #89 on: 7 Feb '15 - 22:25 »
Hi, almost there! It now shows in mp3tag but no Year, Track, Replaygain or other extended info that does get transfered to other formats.

Can you please help me with the syntax for GetAudioAttributes. I have tried loads of different things and the closest I have got is;

   
Code: [Select]
Dim Tags As Long, Atts As TAudioAttributes
    Tags = TagsLibrary_Create
    TagsLibrary_Load Tags, StrPtr("C:\CD1Track01.wv"), ttAutomatic, True
    TagsLibrary_GetAudioAttributes Tags, atAutomatic, Atts
    MsgBox Atts.Bitrate
    TagsLibrary_Free Tags

But I either get syntax errors or the above gives a 'ByRef argument type mismatch'.

I feel we are so close now - Best Steve.

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #90 on: 7 Feb '15 - 23:18 »
Not all data is transfered, because various tagging standards use various tag names with various data. If you tell me what input (load) tag and it's data format is (how to convert it and save to other format) then I can add this functionality. :)

TagsLibrary_GetAudioAttributes() expects a pointer to the TAudioAttributes structure. I don't know VB so please try to use a pointer for the function.

I updated the package (download in the first post) with the MP4 bug removed (hopefuly) and added loading/converting/saving of TIPL and TMCL data for all the tagging formats.
And also swapped the VB header to the one provided in the previous post.

EDIT: BTW. you can send me (or post a download link) the source file and the converted one, and I can compare the tags, and see what can be done to convert as many tags as possible.
« Last Edit: 8 Feb '15 - 05:51 by 3delite »

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #91 on: 8 Feb '15 - 08:26 »
Ok I will try to find out the way to use a pointer for the Attributes structure. I am so pleased so far with the library that I am not going to abandon it just because of my lack of knowledge.

3 'short' files in zip.

1. Original wavpack file.
2. m4a converted from 1 by dbPoweramp
3. m4a converted from 1 by fdk aac and tagged by 3delite.

https://dl.dropboxusercontent.com/s/tmxgtbbr9t3a5ge/C.zip?dl=1

Best - Steve.
« Last Edit: 8 Feb '15 - 10:58 by Steve Grant »

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #92 on: 9 Feb '15 - 23:30 »
Ok, please try this update: TagsLib.zip

There are some tags that seems are added by dbPoweramp:

  • Encoder
  • Encoder Settings
  • iTunSMPB

You can add these tags manually (for example you know the Encoder that you use for the conversion, same for Encoder Settings) (Delphi):

Code: [Select]
    TagsLibrary_SetTag(Tags, PWideChar('Encoder'), PWideChar('FDK v0.1.3'), ttAutomatic);

Also changed the code, now supports upper and lower case tag names too.

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #93 on: 10 Feb '15 - 10:40 »
OK - Now mp3Tag can see all the data EXCEPT album art. Also if you view 'Extended Tags' you see 'Track' twice.

We are not getting anywhere with the getattributes function. http://www.vbforums.com/showthread.php?787927-Need-help-getting-a-pointer-to-UDT

The Declare has been modified again to;

Code: [Select]
Public Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByVal Attributes As Long) As Long
and the call is

Code: [Select]
Dim TagAtts As TAudioAttributes - TagsLibrary_GetAudioAttributes Tags, atAutomatic, VarPtr(TagAtts)The call does not fail, but there is nothing in the members of the TagAtts structure. In your text you say that the return from the Declare is a pointer - a pointer to what?

If I change from atautomatic to say TagAtts As TMP4AudioAttributes then I do get some really big numbers (2675431894^28) back in PlayTime but nothing else. So could there be a small problem with AtAutomatic?

I know you are a Delphi person but your library is the best thing to come along for Visual Basic since AudioGenie and is much better. There are a lot of VB6 users using Bass so somehow we need to find a way to get this working in VB. I will carry out any tests you require and as quickly as I can - you only have to ask.

Regards - Steve.

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #94 on: 10 Feb '15 - 14:41 »
Here's a test app. for the audio attributes: TutorialDLLAudioAttributes.zip

You can check if a particular file is working at all with the lib. then check your code with the particular file.

The code in Delphi is like this:

Code: [Select]
var
    AudioAttributes: TAudioAttributes;
begin
    Memo1.Clear;
    TagsLibrary_Load(Tags, PWideChar(Edit1.Text), ttAutomatic, True);
    //* Get audio attributes
    TagsLibrary_GetAudioAttributes(Tags, atAutomatic, @AudioAttributes);
    Memo1.Lines.Append('Channels: ' + IntToStr(AudioAttributes.Channels));
    Memo1.Lines.Append('SamplesPerSec: ' + IntToStr(AudioAttributes.SamplesPerSec));
    Memo1.Lines.Append('BitsPerSample: ' + IntToStr(AudioAttributes.BitsPerSample));
    Memo1.Lines.Append('PlayTime: ' + FloatToStr(AudioAttributes.PlayTime));
    Memo1.Lines.Append('SampleCount: ' + IntToStr(AudioAttributes.SampleCount));
    Memo1.Lines.Append('BitRate: ' + IntToStr(AudioAttributes.BitRate));

A little explanation: You have to have a TAudioAttributes structure in memory. Then you have to pass a pointer to this structure. TagsLibrary_GetAudioAttributes() fills this structure and returns.
If you want more detailed info for a particular file format (eg. MP3) then you have to have a TMPEGAudioAttributes structure and pass a pointer to it for the function and specify atMPEG for AudioType.

A quick test with cover art here works. Please send a download link, like before, for the particular file that's failing the conversion with cover art.

Regarding the track number, I check that later tonight.

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #95 on: 10 Feb '15 - 16:08 »

https://dl.dropboxusercontent.com/s/nxqfcke1pvsrq2i/CD2Track08.m4a?dl=1

Your .exe certainly works ok. Although the samplecount=0.

From your explanation I believe that is what I am doing:

 
Code: [Select]
Dim tags As Long, TagAtts As TAudioAttributes (Is this the equivalent of AudioAttributes: TAudioAttributes;? Does it put it in memory?
    tags = TagsLibrary_Create
    TagsLibrary_Load tags, StrPtr(FileName), ttAutomatic, True
    TagsLibrary_GetAudioAttributes Tags, atAutomatic, VarPtr(TagAtts) is this the correct pointer to the memory location?
    MsgBox Cstr(TagAtts.PlayTime)

Works but returns with a huge number. See attached. I will try to find out my equivalent of IntToStr etc is.

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #96 on: 10 Feb '15 - 20:14 »
Hmmm... that does seem right to me. And the function declaration is:

Code: [Select]
Public Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByVal Attributes As Long) As Long

right? If so I'm sorry but no other idea. If doesn't work, find someone who knows VB, it can't be that difficult to make it work...

Regarding the sample count: is not available for all audio file formats, it will work for Ogg Vorbis, Flac I think... I suggest using BASS_ChannelGetInfo() for getting audio attributes.

I updated the package, with that duplicate tag bug fixed, available from the first post.

  • Converting tags to MP4 now transfers all unknown fields to '----' atoms
  • Added functions for managing MP4 tag '----' atoms (Delphi class)
  • Fixed field names managing is now case insensitive

3delite

  • Posts: 907
Re: NEW: Tags Library
« Reply #97 on: 10 Feb '15 - 20:50 »
One idea: if still not working, try to hard code the TAudioAttributes type into the library call:

Code: [Select]
Public Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByRef Attributes As TAudioAttributes) As Long

It should work.

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #98 on: 10 Feb '15 - 22:24 »
We have moved on a little, here is where we are at now:

If you change the Declare from ByVal to ByRef

Code: [Select]
Public Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByRef Attributes As Long) As Long
and run the code in a totally new programme with the Call as in the post of 16:08 then you can get Playtimes etc. As soon as I try to get results from within my programme I get zero's. This made me think that perhaps all the declares being Public was the cause of the problems. I changed them all to Private, but with the same results. I had already done this morning your suggestion of using Bass for the attributes and it seems to work well. So that is what I am going to do.

The DLL. We have taken a serious step backwards with the DLL. It is now not copying any Album Art at all! The call couldn't be simpler TagsLibrary_GetTag Input$ : TagsLibrary_Save Output$.

I will try your suggestion above in the morning, but think I did with no results.

All the Best - Steve.

Steve Grant

  • Posts: 148
Re: NEW: Tags Library
« Reply #99 on: 10 Feb '15 - 23:19 »
I've given you a lot of bad news, I wanted to give you some good. The programme I mentioned above that worked was a highly stripped down version of the wrapper. I thought that as I wouldn't be able to use your code for attributes, I may as well strip all that code out. Well you know what it is like, I got carried away and all I have left is this;

Code: [Select]
Private Const TagsLibraryName As String = "TagsLib.dll"

Private Enum TTagType
    ttNone
    ttAutomatic
    ttAPEv2
    ttFlac
    ttID3v1
    ttID3v2
    ttMP4
    ttOpusVorbis
    ttWAV
    ttWMA
End Enum


Private Enum TTagPictureFormat
    tpfUnknown
    tpfJPEG
    tpfPNG
    tpfBMP
    tpfGIF
End Enum

Private Type TTagPriority
    Values(0 To 8) As TTagType
End Type

Private Type TCoverArtData
    name              As Long
    data              As Long
    DataSize          As Currency
    Description       As Long
    CoverType         As Long
    MIMEType          As Long
    PictureFormat     As TTagPictureFormat
    Width             As Long
    Height            As Long
    ColorDepth        As Long
    NoOfColors        As Long
    ID3v2TextEncoding As Long
    Index             As Long
End Type

Private Enum TAudioType
    atAutomatic
    atFlac
    atMPEG
    atDSDDSF
    atWAV
    atAIFF
    atMP4
    atOpus
    atVorbis
    atWMA
End Enum

Private Type TAudioAttributes
    Channels      As Long                   ' number of channels (i.e. mono, stereo, etc.)
    SamplesPerSec As Long                   ' sample rate
    BitsPerSample As Long                   ' number of bits per sample of mono data
    PlayTime      As Double                 ' duration in seconds
    SampleCount   As Currency               ' number of total samples
    bitrate       As Long
End Type

Public Type AudioTags
    AUDIOAlbum As String
    AUDIOArtist As String
    AUDIOComment As String
    AUDIOGenre As String
    AUDIOReplayGain As String
    AUDIOTitle As String
    AUDIOTrack As Long
    AUDIOYear As String
    AUDIOGetBitrate As String
    AUDIOGetBitDepth As String
    AUDIOGetChannels As Long
    AUDIOGetFileSize As Long
    AUDIOGetDuration As Single
    AUDIOGetPicture As StdPicture
    AUDIOGetSampleRate As Long
End Type

Public ATags As AudioTags
Private Declare Function TagsLibrary_Create Lib "TagsLib.dll" () As Long
Private Declare Function TagsLibrary_Free Lib "TagsLib.dll" (ByVal Tags As Long) As Long
Private Declare Function TagsLibrary_Load Lib "TagsLib.dll" (ByVal Tags As Long, ByVal FileName As Long, ByVal TagType As TTagType, ByVal ParseTags As Long) As Long
Private Declare Function TagsLibrary_LoadFromBASS Lib "TagsLib.dll" (ByVal Tags As Long, ByVal channel As Long) As Long
Private Declare Function TagsLibrary_Save Lib "TagsLib.dll" (ByVal Tags As Long, ByVal FileName As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_FreeSaveHandle Lib "TagsLib.dll" (ByRef SaveHandle As Long) As Long
Private Declare Function TagsLibrary_RemoveTag Lib "TagsLib.dll" (FileName As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_RemoveTagFromMemory Lib "TagsLib.dll" (ByVal MemoryAddress As Long, ByVal Size As Currency, ByVal TagType As TTagType, ByRef SavedAddress As Long, ByRef SavedSize As Currency, ByRef SaveHandle As Long) As Long
Private Declare Function TagsLibrary_GetTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_Loaded Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal Value As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_AddTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal Value As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_TagCount Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_DeleteTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_CoverArtCount Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long, ByRef CoverArt As TCoverArtData) As Long
Private Declare Function TagsLibrary_DeleteCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long) As Long
Private Declare Function TagsLibrary_SetCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long, ByRef CoverArt As TCoverArtData) As Long
Private Declare Function TagsLibrary_AddCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal CoverArt_Name As Long, ByVal CoverArt_Data As Long, ByVal CoverArt_DataSize As Currency, ByVal CoverArt_Description As Long, ByVal CoverArt_CoverType As Long, ByVal CoverArt_MIMEType As Long, ByVal CoverArt_PictureFormat As TTagPictureFormat, ByVal CoverArt_Width As Long, ByVal CoverArt_Height As Long, ByVal CoverArt_ColorDepth As Long, ByVal CoverArt_NoOfColors As Long, ByVal CoverArt_ID3v2TextEncoding As Long, ByVal CoverArt_Index As Long) As Long
Private Declare Function TagsLibrary_SetTagLoadPriority Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagPriorities0 As TTagType, ByVal TagPriorities1 As TTagType, ByVal TagPriorities2 As TTagType, ByVal TagPriorities3 As TTagType, ByVal TagPriorities4 As TTagType, ByVal TagPriorities5 As TTagType, ByVal TagPriorities6 As TTagType, ByVal TagPriorities7 As TTagType, ByVal TagPriorities8 As TTagType) As Long
Private Declare Function TagsLibrary_GetConfig Lib "TagsLib.dll" (ByVal Tags As Long, ByVal nOption As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetConfig Lib "TagsLib.dll" (ByVal Tags As Long, ByVal Value As Long, ByVal nOption As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetVendor Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetVendor Lib "TagsLib.dll" (ByVal Tags As Long, ByVal vendor As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByRef Attributes As Long) As Long

'"Reallocates a previously allocated string to be the size of a second string and copies the second string into the reallocated memory."
Private Declare Function SysReAllocString Lib "oleaut32.dll" (ByVal pBSTR As Long, Optional ByVal pszStrPtr As Long) As Long

You won't believe this but it all works now! There are some small errors e.g. SamplesPerSec is actually bitdepth (ie 16). The Bitrate is low by 1 on the very quick test I did on the m4a sample you already have. Calculated it comes to 153.467kbps and you show 152. Bass shows 153. (There are 6,175,176 samples).

Have I left enough in to eventually get the cover art out into a picture box? Could I remove some more?

Kind Regards - Steve.