title: Set Lyrics in MP3 ID3v2 Tag
body: <p>I want to write lyrics to an mp3 in an Android application.I have found a java library for reading <code>mp3</code> files and reading/manipulating the ID3 tags (ID3v1 and ID3v2.2 through ID3v2.4), named <a href="https://github.com/mpatric/mp3agic" rel="nofollow">mp3agic</a>. </p>
  
  <p>I modified <code>mp3agic</code> to write the lyric tag of the ID3v2 tag, writing the tag: <code>USLT</code>. Found in <a href="http://en.wikipedia.org/wiki/ID3#ID3v2_Frame_Specification_.28Version_2.3.29" rel="nofollow">Wikipedia</a></p>
  
  <p>In a sample Android app I modify the artist, album, title, genre, lyrics, and comment of an MP3. All tags are modified correct except for the lyrics. <code>PowerAMP</code> is used to verify the modified <code>MP3</code> file and <code>PowerAMP</code> cannot find the lyrics in the MP3. </p>
  
  <p>If anyone is familiar with this library here is my modified code from AbstractID3v2Tag.java:</p>
  
  <pre><code>//define lyric tag for id3v2
  public static final String ID_TEXT_LYRICS = "USLT";
  
  //get the lyrics from the tag
  public String getLyrics() {
      ID3v2TextFrameData frameData;
      if (obseleteFormat) return null;
      else frameData = extractTextFrameData(ID_TEXT_LYRICS);
      if (frameData != null &amp;&amp; frameData.getText() != null) 
          return frameData.getText().toString();
      return null;
  }
  
  //set the lyrics in the tag
  public void setLyrics(String lyrics) {
      if (lyrics != null &amp;&amp; lyrics.length() &gt; 0) {
          invalidateDataLength();
          ID3v2TextFrameData frameData = new ID3v2TextFrameData(useFrameUnsynchronisation(), new EncodedText(lyrics));
          addFrame(createFrame(ID_TEXT_LYRICS, frameData.toBytes()), true);
      }
  }
  </code></pre>
  
  <p>I set the lyrics on an <code>MP3</code> with a program in Windows and read the <code>USLT</code> tag with my app and <code>getLyrics()</code> returned the string <code>eng</code>.  <code>PowerAMP</code> did find these lyrics set by the Windows program. </p>
  
  <p>I have searched and found many posts pointing to MP3 ID3 tag modifier library's, that's where I found mp3agic. Which is the only library I could easily modify to incorporate changing of lyrics.</p>
  
  <p>One library I found was <a href="https://sites.google.com/site/eternalsandbox/myid3-for-android" rel="nofollow">MyID3_for_Android</a> which did not have a method to modify lyrics.</p>
  
  <p>I am looking for guidance on this.</p>