org.farng.mp3.id3
Class FrameBodySYLT

java.lang.Object
  extended byorg.farng.mp3.AbstractMP3FileItem
      extended byorg.farng.mp3.AbstractMP3FragmentBody
          extended byorg.farng.mp3.id3.AbstractID3v2FrameBody
              extended byorg.farng.mp3.id3.FrameBodySYLT

public class FrameBodySYLT
extends AbstractID3v2FrameBody

4.9.   Synchronised lyrics/text

   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 text string. 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)

   Content type:   $00 is other

                   $01 is lyrics
                   $02 is text transcription
                   $03 is movement/part name (e.g. "Adagio")

                   $04 is events (e.g. "Don Quijote enters the stage")
                   $05 is chord (e.g. "Bb F Fsus")
                   $06 is trivia/'pop up' information

                   $07 is URLs to webpages
                   $08 is URLs to images

   Time stamp format:

     $01  Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit

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

   Absolute 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 characters are allowed in all "SYLT" frames and MUST 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.

Version:
$Revision: 1.5 $
Author:
Eric Farng

Constructor Summary
FrameBodySYLT()
          Creates a new FrameBodySYLT object.
FrameBodySYLT(byte textEncoding, java.lang.String language, byte timeStampFormat, byte contentType, java.lang.String description)
          Creates a new FrameBodySYLT object.
FrameBodySYLT(FrameBodySYLT copyObject)
          Creates a new FrameBodySYLT object.
FrameBodySYLT(java.io.RandomAccessFile file)
          Creates a new FrameBodySYLT object.
 
Method Summary
 void addLyric(int timeStamp, java.lang.String text)
           
 void addLyric(ObjectLyrics3Line line)
           
 void equals()
          This method is not yet supported.
 byte getContentType()
           
 java.lang.String getDescription()
          This method calls toString for all it's objects and appends them.
 java.lang.String getIdentifier()
          ID string that usually corresponds to the class name, but can be displayed to the user.
 java.lang.String getLanguage()
           
 java.lang.String getLyric()
           
 int getSize()
          Returns the estimated size in bytes of this object if it was to be written to file.
 byte getTextEncoding()
           
 byte getTimeStampFormat()
           
 java.util.Iterator iterator()
          Returns an iterator of the MP3Object object list.
 void read(java.io.RandomAccessFile file)
          Read the data from the given file into this object.
 void readByteArray(byte[] arr)
           
protected  void setupObjectList()
          Create the order of MP3Object objects that this body expects.
 java.lang.String toString()
          Calls toString for all MP3Object objects and creates a string with a new line character.
 void write(java.io.RandomAccessFile file)
          Write the contents of this object to the file at the position it is currently at.
 byte[] writeByteArray()
           
 
Methods inherited from class org.farng.mp3.id3.AbstractID3v2FrameBody
equals, readHeader, writeHeader
 
Methods inherited from class org.farng.mp3.AbstractMP3FragmentBody
appendToObjectList, getBriefDescription, getObject, getObjectListIterator, has6ByteHeader, isSubsetOf, setObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FrameBodySYLT

public FrameBodySYLT()
Creates a new FrameBodySYLT object.


FrameBodySYLT

public FrameBodySYLT(FrameBodySYLT copyObject)
Creates a new FrameBodySYLT object.


FrameBodySYLT

public FrameBodySYLT(byte textEncoding,
                     java.lang.String language,
                     byte timeStampFormat,
                     byte contentType,
                     java.lang.String description)
Creates a new FrameBodySYLT object.


FrameBodySYLT

public FrameBodySYLT(java.io.RandomAccessFile file)
              throws java.io.IOException,
                     InvalidTagException
Creates a new FrameBodySYLT object.

Method Detail

getContentType

public byte getContentType()

getDescription

public java.lang.String getDescription()
Description copied from class: AbstractMP3FragmentBody
This method calls toString for all it's objects and appends them. It contains new line characters and is more suited for display purposes

Overrides:
getDescription in class AbstractMP3FragmentBody
Returns:
formatted description string

getIdentifier

public java.lang.String getIdentifier()
Description copied from class: AbstractMP3FileItem
ID string that usually corresponds to the class name, but can be displayed to the user. It is not indended to identify each individual instance.

Specified by:
getIdentifier in class AbstractMP3FileItem
Returns:
ID string

getLanguage

public java.lang.String getLanguage()

getLyric

public java.lang.String getLyric()

getSize

public int getSize()
Description copied from class: AbstractMP3FragmentBody
Returns the estimated size in bytes of this object if it was to be written to file. This is not guaranteed to be accurate 100% of the time.

Overrides:
getSize in class AbstractMP3FragmentBody
Returns:
estimated size in bytes of this object

getTextEncoding

public byte getTextEncoding()

getTimeStampFormat

public byte getTimeStampFormat()

addLyric

public void addLyric(int timeStamp,
                     java.lang.String text)

addLyric

public void addLyric(ObjectLyrics3Line line)

equals

public void equals()
This method is not yet supported.

Throws:
java.lang.UnsupportedOperationException - This method is not yet supported

iterator

public java.util.Iterator iterator()
Description copied from class: AbstractMP3FragmentBody
Returns an iterator of the MP3Object object list.

Overrides:
iterator in class AbstractMP3FragmentBody
Returns:
iterator of the MP3Object object list.

setupObjectList

protected void setupObjectList()
Description copied from class: AbstractMP3FragmentBody
Create the order of MP3Object objects that this body expects. This method needs to be overwritten.

Specified by:
setupObjectList in class AbstractMP3FragmentBody

read

public void read(java.io.RandomAccessFile file)
          throws java.io.IOException,
                 InvalidTagException
Description copied from class: AbstractMP3FragmentBody
Read the data from the given file into this object. The file needs to have its file pointer in the correct location.

Overrides:
read in class AbstractMP3FragmentBody
Parameters:
file - file to read from
Throws:
InvalidTagException - if there is any error in the data format.
java.io.IOException - on any I/O error

readByteArray

public void readByteArray(byte[] arr)

toString

public java.lang.String toString()
Description copied from class: AbstractMP3FragmentBody
Calls toString for all MP3Object objects and creates a string with a new line character.

Overrides:
toString in class AbstractMP3FragmentBody
Returns:
description string

write

public void write(java.io.RandomAccessFile file)
           throws java.io.IOException
Description copied from class: AbstractMP3FragmentBody
Write the contents of this object to the file at the position it is currently at.

Overrides:
write in class AbstractMP3FragmentBody
Parameters:
file - destination file
Throws:
java.io.IOException - on any I/O error

writeByteArray

public byte[] writeByteArray()


Copyright (c) 2004 Eric Farng