Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Files.AudioTags

Queries audio tags for audio file.

Component Version macOS Windows Linux Server iOS SDK
Files 9.4 ✅ Yes ✅ Yes ❌ No ✅ Yes, on macOS and Windows ❌ No
MBS( "Files.AudioTags"; FilePath )   More

Parameters

Parameter Description Example
FilePath The native file path to the audio file. "/Users/cs/Desktop/test.mp3"

Result

Returns JSON or error.

Description

Queries audio tags for audio file.
Returns JSON object with usual two sub objects. One is AudioProperties with length (in seconds), bitrate (in bits per second), sampleRate (in Hz) and channels as numbers.
The Properties object contains all the properties with various tags. Values are texts for the given keys.

Uses TagLib, an open source library to read metadata from audio files, e.g. ID3 tags.
Currently it supports both ID3v1 and ID3v2 for MP3 files, Ogg Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF files.

List of ID3v2 tag names:
ALBUM, ALBUMARTIST, ALBUMARTISTSORT, ALBUMSORT, ARTIST, ARTISTSORT, ARTISTWEBPAGE, AUDIOSOURCEWEBPAGE, BPM, COMMENT, COMPOSER, CONDUCTOR, CONTENTGROUP, COPYRIGHT, COPYRIGHTURL, DATE, DISCNUMBER, ENCODEDBY, ENCODING, ENCODINGTIME, FILETYPE, FILEWEBPAGE, GENRE, INITIALKEY, INVOLVEDPEOPLE, ISRC, LABEL, LANGUAGE, LENGTH, LYRICIST, LYRICS, MEDIA, MOOD, MUSICIANCREDITS, ORIGINALALBUM, ORIGINALARTIST, ORIGINALDATE, ORIGINALFILENAME, ORIGINALLYRICIST, OWNER, PAYMENTWEBPAGE, PLAYLISTDELAY, PODCAST, PODCASTCATEGORY, PODCASTDESC, PODCASTID, PODCASTURL, PRODUCEDNOTICE, PUBLISHERWEBPAGE, RADIOSTATION, RADIOSTATIONOWNER, RADIOSTATIONWEBPAGE, RELEASEDATE, REMIXER, SUBTITLE, TAGGINGDATE, TITLE, TITLESORT, TRACKNUMBER, URL.

See Files.AudioCoverArt to get covert art.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Query MP3 tags:

MBS("Files.AudioTags"; "/Users/cs/Desktop/test.mp3")

Example result:
{ "AudioProperties": { "length": 282, "bitrate": 128, "sampleRate": 44100, "channels": 2 }, "Tags": { "ARTIST": "John Doe", "COMMENT": "test comment", "TITLE": "Hello World" } }

Read tags and show JSON in field:

If [ Length ( AudioTags::FilePath ) > 0 ]
    Set Variable [ $r ; Value: MBS("Files.AudioTags"; AudioTags::FilePath) ]
    If [ MBS("IsError") = 0 ]
        Set Field [ AudioTags::JSON ; MBS("JSON.Colorize"; MBS("JSON.Format"; $r)) ]
    End If
End If

Colorize and format in Auto-Enter calculation:

Let ( [
jsonFormatted = MBS("JSON.Format"; Self);
jsonFormatFailed = MBS("IsError");
jsonText = If(jsonFormatFailed; Self; jsonFormatted);
result = MBS("JSON.Colorize"; jsonText)
]; result )

// put this calculation into a field, so the field gets formated and colorized whenever the field is changed and the record gets commited.

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 12nd September 2019, last changed 16th July 2022


Files.AudioCoverArt - Files.CanOpenFile