Results 1 to 1 of 1
  1. #1
    justinserg is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Exclamation Work with mp3 on JLayer

    Sorry, but I bad know English. I write the program on Java. I need to write audio editor. But I do not know as correctly to write header of mp3 frame. Its my code:
    Java Code:
    FileOutputStream output = new FileOutputStream("tmp.mp3");
    Params param = Decoder.getDefaultParams();
    Decoder decode = new Decoder(param);
    Bitstream bStream = new Bitstream(in);
    Header head = bStream.readFrame();
    SampleBuffer sBuffer = (SampleBuffer) decode.decodeFrame(head, bStream);
    output.write(head.getSyncHeader());
    output.write(head.version());
    output.write(head.layer());
    output.write((head.checksums()) ? 1 : 0);
    output.write(head.bitrate_index());
    output.write(head.frequency());
    output.write((head.padding()) ? 1 : 0);
    output.write(head.mode());
    output.write(head.mode_extension());
    output.write((head.copyright()) ? 1 : 0);
    output.write((head.original()) ? 1 : 0);
    output.write((head.vbr()) ? 1 : 0);	
    output.write(head.checksum);
    for (int i = 0; i < sBuffer.getBufferLength(); i++)
    {
    	output.write(sBuffer.getBuffer()[i]);
    }
    output.close();
    mp3 specification

    Thank for the help.
    Last edited by justinserg; 05-03-2011 at 09:27 AM.

Similar Threads

  1. Getting SWT app to work on a different OS
    By Ravioli in forum SWT / JFace
    Replies: 0
    Last Post: 02-20-2011, 09:35 AM
  2. Cant seem to get this to work
    By nivekeleets in forum Java 2D
    Replies: 4
    Last Post: 11-13-2010, 07:09 PM
  3. why this doesn't work?
    By hitesh_public in forum New To Java
    Replies: 5
    Last Post: 08-09-2010, 08:07 AM
  4. Why doesn't this work?
    By Corder10 in forum New To Java
    Replies: 1
    Last Post: 07-04-2009, 10:33 PM
  5. how would i get this to work...?
    By deeadeed in forum New To Java
    Replies: 6
    Last Post: 12-06-2007, 02:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •