FileDocCategorySizeDatePackage
FrameBodySYLT.javaAPI DocJaudiotagger 2.0.49355Wed Mar 30 16:12:04 BST 2011org.jaudiotagger.tag.id3.framebody

FrameBodySYLT

public class FrameBodySYLT extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
Synchronised lyrics/text frame.

This is another way of incorporating the words, said or sung lyrics, in the audio file as text, this time, however, in sync with the audio. It might also be used to describing events e.g. occurring on a stage or on the screen in sync with the audio. The header includes a content descriptor, represented with as terminated textstring. If no descriptor is entered, 'Content descriptor' is $00 (00) only.

<Header for 'Synchronised lyrics/text', ID: "SYLT">
Text encoding$xx
Language$xx xx xx
Time stamp format$xx
Content type$xx
Content descriptor<text string according to encoding> $00 (00)

Encoding:$00ISO-8859-1 character set is used => $00 is sync identifier.
$01Unicode character set is used => $00 00 is sync identifier.

Content type:$00is other
$01is lyrics
$02is text transcription
$03is movement/part name (e.g. "Adagio")
$04is events (e.g. "Don Quijote enters the stage")
$05is chord (e.g. "Bb F Fsus")
$06is trivia/'pop up' information

Time stamp format is:

$01 Absolute time, 32 bit sized, using MPEG frames as unit
$02 Absolute time, 32 bit sized, using milliseconds as unit

Abolute time means that every stamp contains the time from the beginning of the file.

The text that follows the frame header differs from that of the unsynchronised lyrics/text transcription in one major way. Each syllable (or whatever size of text is considered to be convenient by the encoder) is a null terminated string followed by a time stamp denoting where in the sound file it belongs. Each sync thus has the following structure:

Terminated text to be synced (typically a syllable)
Sync identifier (terminator to above string)$00 (00)
Time stamp$xx (xx ...)

The 'time stamp' is set to zero or the whole sync is omitted if located directly at the beginning of the sound. All time stamps should be sorted in chronological order. The sync can be considered as a validator of the subsequent string.

Newline ($0A) characters are allowed in all "SYLT" frames and should be used after every entry (name, event etc.) in a frame with the content type $03 - $04.

A few considerations regarding whitespace characters: Whitespace separating words should mark the beginning of a new word, thus occurring in front of the first syllable of a new word. This is also valid for new line characters. A syllable followed by a comma should not be broken apart with a sync (both the syllable and the comma should be before the sync).

An example: The "USLT" passage

"Strangers in the night" $0A "Exchanging glances"

would be "SYLT" encoded as:

"Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx xx "glan" $00 xx xx "ces" $00 xx xx

There may be more than one "SYLT" frame in each tag, but only one with the same language and content descriptor.

For more details, please refer to the ID3 specifications:

author
: Paul Taylor
author
: Eric Farng
version
$Id: FrameBodySYLT.java 832 2009-11-12 13:25:38Z paultaylor $

Fields Summary
Constructors Summary
public FrameBodySYLT()
Creates a new FrameBodySYLT datatype.


    
public FrameBodySYLT(FrameBodySYLT body)
Copy Constructor

param
body

        super(body);
    
public FrameBodySYLT(int textEncoding, String language, int timeStampFormat, int contentType, String description, byte[] lyrics)
Creates a new FrameBodySYLT datatype.

param
textEncoding
param
language
param
timeStampFormat
param
contentType
param
description
param
lyrics

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, textEncoding);
        setObjectValue(DataTypes.OBJ_LANGUAGE, language);
        setObjectValue(DataTypes.OBJ_TIME_STAMP_FORMAT, timeStampFormat);
        setObjectValue(DataTypes.OBJ_CONTENT_TYPE, contentType);
        setObjectValue(DataTypes.OBJ_DESCRIPTION, description);
        setObjectValue(DataTypes.OBJ_DATA, lyrics);
    
public FrameBodySYLT(ByteBuffer byteBuffer, int frameSize)
Creates a new FrameBodySYLT datatype.

param
byteBuffer
param
frameSize
throws
InvalidTagException if unable to create framebody from buffer

        super(byteBuffer, frameSize);
    
Methods Summary
public intgetContentType()

return
content type key

        return ((Number) getObjectValue(DataTypes.OBJ_CONTENT_TYPE)).intValue();
    
public java.lang.StringgetDescription()

return
description

        return (String) getObjectValue(DataTypes.OBJ_DESCRIPTION);
    
public java.lang.StringgetIdentifier()

return
frame identifier

        return ID3v24Frames.FRAME_ID_SYNC_LYRIC;
    
public java.lang.StringgetLanguage()

return
language code

        return (String) getObjectValue(DataTypes.OBJ_LANGUAGE);
    
public byte[]getLyrics()
Get lyrics

TODO:better format

return
lyrics

        return (byte[]) this.getObjectValue(DataTypes.OBJ_DATA);
    
public intgetTimeStampFormat()

return
timestamp format key

        return ((Number) getObjectValue(DataTypes.OBJ_TIME_STAMP_FORMAT)).intValue();
    
public voidsetLyrics(byte[] data)
Set lyrics

TODO:provide a more user friendly way of adding lyrics

param
data

        this.setObjectValue(DataTypes.OBJ_DATA, data);
    
protected voidsetupObjectList()
Setup Object List

        objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE));
        objectList.add(new StringHashMap(DataTypes.OBJ_LANGUAGE, this, Languages.LANGUAGE_FIELD_SIZE));
        objectList.add(new NumberHashMap(DataTypes.OBJ_TIME_STAMP_FORMAT, this, EventTimingTimestampTypes.TIMESTAMP_KEY_FIELD_SIZE));
        objectList.add(new NumberHashMap(DataTypes.OBJ_CONTENT_TYPE, this, SynchronisedLyricsContentType.CONTENT_KEY_FIELD_SIZE));
        objectList.add(new StringNullTerminated(DataTypes.OBJ_DESCRIPTION, this));

        //TODO:This hold the actual lyrics
        objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_DATA, this));