Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
462 stars 61 forks source link

Get the format from a Track #78

Closed babysnakes closed 3 years ago

babysnakes commented 3 years ago

Hi,

This is a question, not a problem (sorry if it's the wrong place to post it).

I'm not a C# developer - I'm trying to learn F#- and I couldn't figure out if there's a way to get the format of a Track (or directly out of a file) other than manually parsing the extension.

Is there a way?

Thanks in advance

Haim

Zeugma440 commented 3 years ago

That's an interesting question. The library has internal classes that document every supported format (see AudioDataIOFactory), but these haven't been publicly accessible as nobody ever asked for them.

I guess I can easily implement a new Track.AudioFormat field that contains an ATL.Format object. By calling Track.AudioFormat.Name you'll get things such as "MPEG Audio Layer", "OGG : Vorbis, Opus", "Musepack / MPEGplus", "MPEG-4 Part 14"

Would that be OK to you ?

babysnakes commented 3 years ago

Anything that I can pattern match on (or even plain if/else is ok) will be great. The use case is that applications that support non standard tags (like work and movement, credits, etc) sometimes look for different tags on different formats.

Zeugma440 commented 3 years ago

Oh, I see what you mean. Then I guess you also need to know which tagging format ATL is reading from (ID3v1, ID3v2, APE, the audio format's native tagging - e.g. WMA or MP4)

I'll find a way to publish that info easily and ping you when a new update is on the repo.

babysnakes commented 3 years ago

Great, Thanks :)

Zeugma440 commented 3 years ago

Hey there ! I've pushed new stuff on the main repo :

Each of these fields are ATL.Format objects, which should satisfy your needs.

Please keep me informed 😄

babysnakes commented 3 years ago

This is great 🎉. Really, it's amazing 😄 .

I don't really understand what the Track.MetadataFormats is (Running it on my m4a or flac samples I get List<Format>(1) { Format { "native" } } ) but the AudioFormat is exactly what I needed.

Once I have something working (which will probably take a while I'll send you a link.

Zeugma440 commented 3 years ago

I don't really understand what the Track.MetadataFormats is (Running it on my m4a or flac samples I get List(1) { Format { "native" } } )

"native" means m4a and flac are tagged with their own native metadata format. Id they were tagged with APE or ID3v2 you'd get "apetag vx" or "id3v2.x"

I'll close the issue and publish a new version of the library if you don't mind

babysnakes commented 3 years ago

Oh, I see.

Thanks again. Really.

Zeugma440 commented 3 years ago

Changes have been integrated into today's v3.15. Enjoy !