# Classical Metadata and the Grouping Field

In version 12.5 iTunes introduced support for classical metadata. Classical metadata refers to the fields: Work Name, Movement Name, Movement Number and Movement Count. In m4a files, Apple applications store the actual values in the files which is an optimal implementation. In other supported audio file types, mp3, aiff and wav, the implementation varies.

mp3
  Initially iTunes did not write any of the data to the actual files. Yate allows you to import from and export to Apple applications so that the metadata can be synchronized. Unfortunately in version 12.5.2, iTunes started to write the Work Name metadata to the low level ID3 frame typically used to store the Grouping field. As of iTunes 12.5.4, the Grouping metadata is once again written to files, but to a non standard frame named GRP1. More on this below.
  At some point iTunes also started writing Movement Name, Movement Number and Movement Count information to the files. Non standard low level ID3 frames MVNM and MVIN are used to store the data.
aiff
  iTunes will write the Grouping metadata as it does in mp3 files. All other classical fields are not written to the files.
wav
  iTunes and Music do not write any metadata to the actual files. Yate allows you to import from and export to Apple applications so that the metadata can be synchronized.

With the release of iTunes 12.5.2 many users found that their iTunes libraries had moved the Grouping metadata into the Work Name field. This only happened on mp3 and possibly on aiff files and was due to their decision to use the low level frame typically used to store the Grouping metadata. As many people used the Grouping field for alternate uses, this was not that great. This is not an easy scenario to work around as we have no control over what Apple applications do when they reads audio files.

In Yate v3.14.3 we released a workaround, which although not terribly aesthetic does let you get around the issue. Preferences-Apple Apps has an option called Maximum Grouping-Work Name Compatibility. This option only affects mp3 and aiff files and its implementation is described below.

First off, leave the option unchecked if any of the following holds:

- You don't use iTunes or Music
- You don't use Grouping or the Work Name fields.

When the option is not checked:

- Work Name is mapped to a low level UDTI named Work--Name. This is simply a convenient place to store the non standard field.
- Grouping is mapped to the TIT1 frame, which is used by virtually every audio application to store grouping metadata.
- Note that iTunes and Music will place the Grouping field data into its Work Name field.

When the option is checked:

- Work Name is mapped to the TIT1 frame. This ensures that iTunes and Music will not overwrite your Grouping metadata when it reads the audio file.
- Grouping is mapped to a non standard frame named GRP1 which iTunes writes as of v12.5.4. and is also written by Music

How does Yate know what's what in the files? Whenever Yate writes an mp3 or aiff file and the Maximum Grouping-Work Name Compatibility option is set, it also writes a UDTI named YiTG with a value of 1. The presence of this information tells Yate that the file is written using the alternate mappings. When the option is not set, Yate removes the UDTI named YiTG. Whenever mp3 and aiff files are read, Yate determines how to coerce the data in the files to the current value of the Maximum Grouping-Work Name Compatibility option based on the YiTG UDTI. Starting in Yate version 3.15.1, it will also assume the mode if a GRP1 frame is found. This handles the case of editing in iTunes or Music rather than in Yate.

As the classical metadata is largely not available in mp3, aiff and wav audio files, the metadata can be imported from and exported to iTunes and Music. This can be done in the UI and in actions. In mp3 and aiff files the grouping metadata is retained in the files as any other field. iTunes and Music write no metadata to WAV files and the grouping metadata is automatically synchronized with the applications as with any other field.

A consistant workflow will help you to ensure that your metadata is preserved and stays consistant. It is strongly suggested that you auto-export the classical metadata when your files are linked and saved. This can be configured in Preferences-Apple Apps.

Note that files are not modified according to the above methodology unless they are saved. This is fine if you are primarily going to be editing your metadata in Yate as opposed to in iTunes or Music. If you are going to edit the Work Name metadata in iTunes or Music, it is strongly suggested that you force the saving of all your mp3 and aiff files in Yate before you do the editing in iTunes or Music. If you don't you might be lose your Grouping metadata. This is entirely out of our control.

If you want to force the saving of all your potentially affected files, there is an action called Force Save All MP3 and AIFF Files in the Yate Resources area. The action will only save the appropriate files if they contain a non empty Grouping or Work Name field.

Warning: If you are not setting the Maximum Grouping-Work Name Compatibility option, you should not export (or auto-export) the classical metadata. Exporting the Work Name field under this condition will cause you to lose your Grouping metadata. For this reason it is a good idea to not enable the classical metadata options in Preferences - Apple Apps - Fields of Interest or Preferences - Apple Apps - Auto Export.

Note that when a linked file's Grouping field which previously contained data is emptied, the value in an Apple application will not be updated unless the Update Apple App on empty Grouping option in Preferences - iTunes - General is set. The same holds for Work Name and the Update Apple App on empty Work Name option. Both of these settings are ignored by MPEG-4 files.