Audio Werkzeuge Bibliothek (AWB)
A collection of classes to view audiodata and edit metadata in many different audio formats. The goal was to organise the basic usage ("show data") as simple as possible, without limiting the usability for more complex jobs ("create a new uber-tagger").
Note: "Audio Werkzeuge Bibliothek" translates to "Audio Tools Library", which is a collection of classes with the same purpose. Although the AWB uses some parts of the ATL, this is not an official successor.
The following code is sufficient to display all established audio information. It doesn't matter, whether you have a mp3-file with ID3v1- or v2-Tag, or an Ogg-Vorbis-file, Flac, Monkeys Audio, WMA, ore exotic files like OptimFrog or TrueAudio with Apev2Tag.
procedure TForm1.ShowFileData(aFilename: String); var MainAudioFile: TGeneralAudioFile; begin MainAudioFile := TAudioFile.Create(aFilename); try EdtTitle.Text := MainAudioFile.Title; EdtArtist.Text := MainAudioFile.Artist; EdtAlbum.Text := MainAudioFile.Album; EdtGenre.Text := MainAudioFile.Genre; EdtYear.Text := MainAudioFile.Year; EdtTrack.Text := MainAudioFile.Track; Memo1.Clear; Memo1.Lines.Add(Format('Type: %s', [MainAudioFile.FileTypeName] )); Memo1.Lines.Add(Format('FileSize %d Bytes', [MainAudioFile.FileSize] )); Memo1.Lines.Add(Format('Duration %d sec', [MainAudioFile.Duration] )); Memo1.Lines.Add(Format('Btrate %d kBit/s',[MainAudioFile.Bitrate div 1000])); Memo1.Lines.Add(Format('Samplerate %d Hz', [MainAudioFile.Samplerate] )); Memo1.Lines.Add(Format('Channels: %d', [MainAudioFile.Channels] )); finally MainAudioFile.Free; end; end;
For a deeper access to the specific metadata structures you can evaluate the property FileType:
case AudioFile.FileType of at_Mp3: begin MemoSpecific.Lines.Add(Format('ID3v1 : %d Bytes', [AudioFile.MP3File.ID3v1TagSize])); MemoSpecific.Lines.Add(Format('ID3v2 : %d Bytes', [AudioFile.MP3File.ID3v2TagSize])); end; at_Ogg: AudioFile.OggFile.GetAllFields(listboxKeys.Items); at_Monkey, at_WavPack, at_MusePack, at_OptimFrog, at_TrueAudio: AudioFile.BaseApeFile.GetAllFrames(listboxKeys.Items); // ... end;
- Read and write ID3-Tags (all versions, i.e. v1, v1.1, v2.2, v2.3, v2.4)
- Read and write Ogg-Vorbis-Comments (as in *.ogg and *.flac files)
- Read and write Apev2Tags (as in *.ape files and others)
- Read and write cover art in ID3v2, Apev2, Flac
- Read metadata from Windows Media Audio (*.wma)
- Detect duration, samplerate, bitrate and channels in the following file types:
Mp3, Ogg-Vorbis (*.ogg), Flac (*.flac), Monkeys Audio (*.ape), Musepack (*.mpc), Wavpack (*.wv), OptimFrog (*.ofr), True Audio (*.tta), Windows Media Audio (*.wma), Wave files (*.wav)
- Full Uniode support (in Delphi 2007 and earlier TNT Unicode Controls are needed for Unicode filenames, see config.inc)
- Wide Tag support, e.g. Lyrics and "Private Frames" in ID3v2, direct access to ID3v2-Frames, access to arbitrary values in Ogg-Vorbis and Apev2. If you want to store a mp3-file inside the Apev2tag of an OptimFrog-file, you can do it with the methods in these classes. It is probably not a good idea, but it is possible...
LGPL or MPL.
The Audio Werkzeuge Bibliothek (AWB) contains parts of the Audio Tools Library (ATL). This is covered only under the terms of the LGPL. As I personally want to allow the usage of the AWB in closed source software, I tried to contact the developers of the ATL for permission to relicense this under a dual license scheme. I've got no answer.
As the ATL project seems to be dead for a couple of years, the used parts from the ATL are not that large (mostly getting audio data from the more exotic formats), I decided to distribute the AWB under my preferred dual license scheme without expicit permission from the ATL team. Dear ATL-developers: I hope, this is OK for you...