Files.AudioTags
---------------

Queries audio tags for audio file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Files](component_Files.md) | [9.4](newinversion94.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "Files.AudioTags"; FilePath { ; Flags } ) 

**MBS**( **"Files.AudioTags";** /\* Queries audio tags for audio file. \*/  
**$FilePath**; /\* The native file path to the audio file.e.g. "/Users/cs/Desktop/test.mp3" \*/   
**$Flags**) /\* Optional; Pass 1 to dump ID3v2Tags values.  
Default is 0 for no flags. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FilePath | The native file path to the audio file. | "/Users/cs/Desktop/test.mp3" |  |
| Flags | Pass 1 to dump ID3v2Tags values.   Default is 0 for no flags. |  | Optional      Added in version **15.0**. |

### 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](FilesAudioCoverArt.md) to get covert art.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) 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")  
<small>  
Example result:   
{ "AudioProperties" : { "length" : 282 , "bitrate" : 128 , "sampleRate" : 44100 , "channels" : 2 }, "Tags" : { "ARTIST" : "John Doe" , "COMMENT" : "test comment" , "TITLE" : "Hello World" } } </small>Read tags and show JSON in field:

 If \[ Length ( AudioTags::FilePath ) &gt; 0 \]   
 Set Variable \[ $r ; Value: MBS ("Files.AudioTags"; AudioTags::FilePath ) \]   
 If \[ MBS ("IsError") = 0 \]   
 Set Field \[ AudioTags::JSON ; MBS ("[JSON.Colorize](JSONColorize.md)"; MBS ("[JSON.Format](JSONFormat.md)"; $r )) \]   
 End If  
End If  
Colorize and format in Auto-Enter calculation:

 Let ( \[  
jsonFormatted = MBS ("[JSON.Format](JSONFormat.md)"; Self);  
jsonFormatFailed = MBS ("IsError");  
jsonText = If(jsonFormatFailed; Self; jsonFormatted);  
result = MBS ("[JSON.Colorize](JSONColorize.md)"; 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

- [Files.AudioCoverArt](FilesAudioCoverArt.md)
- [Files.SetAudioTags](FilesSetAudioTags.md)
- [IsError](IsError.md)
- [JSON.Colorize](JSONColorize.md)
- [JSON.Format](JSONFormat.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 15.0**
    - Added flags parameter for [Files.AudioTags](https://www.mbsplugins.eu/FilesAudioTags.shtml) to request dumping all ID3v2Tags.
- **Version 13.3**
    - Fixed [Files.AudioTags](https://www.mbsplugins.eu/FilesAudioTags.shtml) function for macARM target.
- **Version 9.4**
    - Added [Files.AudioTags](http://www.mbsplugins.eu/FilesAudioTags.shtml) to read ID tags from audio files.

### Example Databases

- [Files/Audio File Tags](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Files/Audio%20File%20Tags.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 14.6pr1](https://www.mbsplugins.de/archive/2024-12-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.3pr7](https://www.mbsplugins.de/archive/2023-07-12/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Neue Funktionen des MBS FileMaker Plugin 9.4](https://www.mbsplugins.de/archive/2019-10-05/Neue_Funktionen_des_MBS_FileMa/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 9.4, second release](https://www.mbsplugins.de/archive/2019-09-21/MBS_FileMaker_Plugin_94_second/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 9.4](https://www.mbsplugins.de/archive/2019-09-17/Neues_MBS_FileMaker_Plugin_94/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 9.4 - More than 5900 Functions In One Plugin](https://www.mbsplugins.de/archive/2019-09-17/MBS_FileMaker_Plugin_94_-_More/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.4pr8](https://www.mbsplugins.de/archive/2019-09-14/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [TagLib to read and write ID3v2 Tags in FileMaker](https://www.mbsplugins.de/archive/2019-09-12/TagLib_to_read_and_write_ID3v2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2020, Seite 34](https://filemaker-magazin.de/neuigkeit/4103-Appetithappen-FMM_202004)

This function checks for a license.

Created 12nd September 2019 , last changed 21st November 2024

  
[Files.AudioCoverArt](FilesAudioCoverArt.md) - [Files.BSDVolumeName](FilesBSDVolumeName.md)

[HTML Version](FilesAudioTags.shtml)