Tagging WAV files

Scott Wheeler wheeler at kde.org
Wed Aug 24 20:39:27 UTC 2011

On Aug 24, 2011, at 10:11 PM, patrick machielse wrote:

> I need to support tagging (read/write) .wav files. I've looked at the TagLib sources, and there is a generic rifffile (base) class and a specific wavfile (sub) class that seem useful.

There's no actual standard on this, so when I was writing the code, I basically just did the same thing in WAV that is done to AIFF in iTunes (since they're such closely related formats).

> In my program I need to support tags created by two programs specifically: Serato and Traktor. Experimentation seems to indicate that each app tags .wav files differently:
> - Serato adds a complete ID3v2 tag to a RIFF chunk.
> - Traktor stores raw metadata directly in specific RIFF chunks.

That would surprise me since TagLib's WAV support was added specifically for Traktor and Traktor uses TagLib for reading / writing tags.  (I used to work for Native Instruments.)

> The wavfile module appeared to be what I needed to support Serato. However, Serato stores the tag in a chunk named 'id3' (lowercase) and wavfile expects it to be in 'ID3'. Editing the wav file results in a file with two ID3 tags in two separate chunks. (QTKit on Mac will refuse to play some of these files).

TagLib by default writes to "ID3 " but will read both "id3 " and "ID3 ".  Does Serato not read "ID3 " chunks?

> As far as I can tell there is no direct (public) support for writing to custom RIFF chunks.

setChunkData is protected, so it's fairly straightforward to use from a subclass.

> My analysis so far is that I will need to create a custom subclass of rifffile -- probably starting with the wavfile code. Is that correct, or is there an easier approach?

Really you'd just need to subclass File::RIFF::WAV and override save() -- which should be about 5 lines of code.  But I'd be interested to see what Serato does to see if it'd be possible to get something that works in all cases out of the box.


More information about the taglib-devel mailing list