MP3 header reading

Hi.
I am making a simple music player and would like to be able to read the header of the MP3 file. I have searched somewhat on the internet but I have found no solution, yet. I found articles about getting the MP3 file into a byte[] and then read the bits inside each byte. I need a little help on that since I don't know how to (doh :) ). I found this code on the internet:
    private static long length = 0;
// Returns the contents of the file in a byte array.
    public static byte[] getBytesFromFile(File file) throws IOException {
        InputStream is = new FileInputStream(file);
        // Get the size of the file
         length = file.length();
        // You cannot create an array using a long type.
        // It needs to be an int type.
        // Before converting to an int type, check
        // to ensure that file is not larger than Integer.MAX_VALUE.
        if (length > Integer.MAX_VALUE) {
            // File is too large
        // Create the byte array to hold the data
        byte[] bytes = new byte[(int)length];
        // Read in the bytes
        int offset = 0;
        int numRead = 0;
        while (offset < bytes.length
               && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
            offset += numRead;
        // Ensure all the bytes have been read in
        if (offset < bytes.length) {
            throw new IOException("Could not completely read file "+file.getName());
        // Close the input stream and return bytes
        is.close();
        return bytes;
    }This gives me an byte array of the file but now I need to find the bytes that contain information about the header AND I need to look at each byte individually AND divide them into bits.
Help...
Thanks
Simmi

First think I'd say is that it's pretty pointless reading the whole file, when all you want is the first few dozen bytes. MP3 files tend to be quite large.
I don't know the details of the various formats you'll have to interpret, but you might be best to use a DataInputStream, or you might want to get fancy and use a mapped byte buffer. To do that you open the MP3 as a RandomAccessFile and get the FileChanel. From the FileChanel you can get a mapped ByteBuffer, from which you can read a variety of binary data formats. You can also specify whether multi-byte numbers are little-endian or big-endian.
With the differences in formats it's probably not for the faint-hearted.

Similar Messages

  • Reading MP3 header information from file

    Hi,
    Im currently using the JMF bean to play a specified location. Such as a media player would do. Now I would like to read the ehader information of MP3 files - if provided as a source. How can I access this data ?
    thanks,
    detlef

    You need to read about the .DWG file format somewhere. Use some binary file editor like Ultraedit and try to understand the file's layout.
    Hint: if it is a binary format, do not use "readLine". Read the raw bytes and try to get the structure of the file piecewise.

  • When following a link, some sited do not display and the heading reads "clk (GIF Image, 1 x 1 pixels)"

    When following some links, the displayed page is blank and the header shows "clk (GIF Image, 1 x 1 pixels)". These are usually links from advertising sites or email promotions. I suspect that they are paid for links and somehow the logging info is causing this problem. It has only recently started to happen, so I suspect that a recent update has caused it.

    Some firewalls like Kaspersky can block content and send a 1x1 GIF image instead.
    Kaspersky: Protection > Firewall > Filtration system: disable the "Banner Ad Blocker"
    See:
    * [[Configuring Kaspersky Internet Security]]
    * [[Firewalls]]

  • Can't insert widget as document head read only

    When I try to insert my LIghtbox Gallery widget into my web page in CS5.5 I get the message
    "This widget requires code that must be inserted into the head of the doucment. Insertion cannot happen as the head of this document is read only"
    How do i turn read only off? Or is there any other way to insert it?
    Many Thanks

    Hello Jenny,
    if I understand you correctly, you should only call the widget you need and click "code wiew"
    From there you have to copy the entire source code into an empty DW file. So you can see how that works.
    You can add only the needed code into your file or you can do it all in reverse, by adding your website contents into the widget source code.
    Hans-Günter

  • Custom header reading of bounce mail

    Hi,
    When I send a mail to invalid mail address on gmail server, form the bounce mail able to read the custom headers using javax.mail api.
    But when I send mail to invalid user on MS Exchange server, from the bounce mail I got, not able to read the custom headers using javax.mail. But the outlook shows (by looking at the option) the custom header is present. I think I may be missing some configuration while reading the mail from mail server using javax.mail. and not reading all the headers. (but its working with other email servers like gmail)

    First, you need to understand that it's up to the
    destination server what it returns, if anything, when
    you send a message to an invalid address.
    In this case, if sounds like the destination server has
    returned a message that includes all the headers
    you want to see, but you can only see them using
    Outlook and not when using JavaMail.
    Note that Outlook typically uses a Microsoft proprietary
    protocol to talk to Exchange, so it's possible for it to
    see and do things that are not possible using the
    standard internet protocols that JavaMail uses.
    You'll probably need to consult an Exchange expert
    to see if there are configuration options that control
    what information it makes available to internet
    protocol clients in this case.

  • Itunes Mp3 tag read

    Is there anyway to get Itunes to not read the tag information in an mp3 and only read the file name? Alternatively is there a way for it to not read genre, album, year etc. etc. and only read the artist and song title. I dislike thumbing through every collab project or album an artist has done just to get to a song.

    Why are you going thru all the artists and compilations?
    Why not type the name of the song?
    Or use the Search box?

  • Windows media Player suddenly can't read some of my MP3, and only with one user account !!!

    Hi!
    here is my problem:
    I have a lot of MP3 in my W7 personnal computer at home. I read MP3 everyday with WMP and all was working fine, until some days ago. Some of my MP3 can't be read by WMP. I've looked at their properties, but there is nothing wrong, compared to others
    MP3 that I can read.
    The "unreadable" files are correctly read by VLC. So they are not corrupted.
    When I swtich to an other user, the same MP3 are read correctly with WMP. (Both usersd are admins)
    My MP3 are présents on two computers at home. When I connect from my second computer with a
    \\computername\c$, I can read these files. So the files are definitivly OK. But when I connect from my first computer to the second one, I can't read the MPS that have the same name! it's absolutely strange!
    I've tried to uninstall WMP, to delete all files related to WMP in my Appdata folder, I have even tried the FixIt from Microsoft, but any of these steps were helpful.
    I've copied the "unreadable" files from the Music folder to my desktop, allways the same issue.
    I've disabled my Antivirus, but without any results. I've tried the system restore, idem.
    My computer is running W7 32 bits, SP1, all updates installed regularly.
    Please help me, I want to understand what has happened!!! :)

    Hi Yolanda,
    the error message is inside a popup: (French trnaslation) "Windows media Player encountered an error and will close." I have the choice beetween "CLOSE" and "HELP ON THE WEB".
    Of course the "help" is totally useless....
    I don't see any troublshooter related to "media player". The only troubleshooter where I can choose Media player is for the "compatibility mode", so it's not helpful. On the "audio and devices" troubleshooter I see "read
    a DVD with Windows Media Player", but that's not my case.
    I've already done the last step. I copy the MP3 from my second computer to the "problematic" one, and I can't read my file. But, on the second computer, i can read this MP3 so the issue is ONLY when I try to read this file with my Windows session.
    (in the same computer, with the administrator session, I can read all the files).
    To put it in a nutshell:
    on computer A logged as CEDRIC i can not read the mp3 called SUPERSONG (it's an example lol)
    on computer A logged as administrator, I can read the SUPERSONG
    on computer B logged as CEDRIC (other local account but same name) I can read the SUPERSONG mp3 that is present in the music Library (that is not the same file, but it's a file with the same name, and of crouse this is the same song). (all my MP3 are copied
    from computer A to computer B in case of failure on one of the computers)
    on computer A logged as CEDRIC, if I do a
    \\computerB\c$\...\SUPERSONG I can not read it.
    I know this is complicated to explain, but if I ask to the Microsoft community that is because I don't know what to do ;) ;) ;) 

  • Read information from mp3-file

    hi,
    I want to extract information regarding the album, artist, title, year and genre from a mp3-file.
    Does there exist an efficient solution for java to get to this information?
    pat

    Google will help here. In case you're missing the keywords to search for: Those informations are stored in the so-called ID3-Tags in the MP3 files.

  • Burning Mp3

    Whenever I choose let's say 80 songs for an MP3 cd, itunes will only burn some songs. One time I chose 80 and itunes only burned 4.
    Why?
    Why does it burn some and not all?
    What's the difference between one song and the other?

    It's probably not an mp3 music file. When your looking at your library right click on a song and select get info (or highlight and hold 'command' and press 'i'). In the window that pops up, click summary on the top. Look at bottom of the window next to the heading "where: probably followed by something long" look at the end of that line. If it doesn't say .mp3 at the end, then it's not an mp3 file and it won't burn to an mp3 disk.
    FYI - the songs you buy from itunes are not mp3 and unless you have the setting in your itunes preferences to import cd's to mp3 then those files won't be mp3 either.

  • How to Add Header and Footer in Flat file

    HI All,
    I am using ODI 11g.
    MY interface is populating data from joining to 2 tables through sql query and Loads in to Flat file.
    But i need to add Header and Footer in the Flat file.
    In the below 3 lines
    The 1st line is header ....2nd line is Data ....3rd line is Footer.
    Any ideas how to work on this.
    HSB9KT.KTPRTO.EBSDATA.D0000000 20120626020636
    CFFE00263 SOLGSR014991340000527894536058173880207SOLNE06242012072420120000009048382650000247MRS
    T00000000000000000000
    Thanks,
    Lony

    Hi Drieux,
    i am able to add Header and Footer in this.
    But i want the header like Its like HSB9KT.KTPRTO.EBSDATA.D0000000 || SYSDATE (YYYYMMDDHHMMSS)
    In my Out put i only see header as HSB9KT.KTPRTO.EBSDATA.D0000000 .
    I have added a Variable where i am using SELECT to_char(sysdate,'YYYYMMDDHHMMSS') FROM DUAL query.
    create header (HSB9KT.KTPRTO.EBSDATA.D0000000 #v_DATE)
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=FFT_SOLSNP$CRLOAD_FILE=/home/tarak/FFT_SOL.datSNP$CRFILE_FORMAT=FSNP$CRFILE_SEP_FIELD=0x0009SNP$CRFILE_SEP_LINE=0x000ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=descrSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=1SNP$CRLENGTH=994SNP$CRPRECISION=994SNP$CR$$SNPS_END_KEY*/
    Any idea why this sysdate part is not showing in Header.

  • Aia:isLogTraceMessage returns null in header

    Hi:
    I want to see the trace message in the log . First I have checked wherther the aia:isTraceLoggingEnabled() fuction is returning true for loglevel = 'FINEST' or not . If it is returning true , then I am calling the function aia:logTraceMessage() to write the trace message in the log.
    I have used the following finction
    1. In a switch case in BPEL , I am checking aia:isTraceLoggingEnabled('FINEST','ValidateBOMBPEL')='true' . This is returining true.
    2. If true , I am assigning the following expression in a temp variable
    aia:logTraceMessage('FINEST',bpws:getVariableData('inputVariable','payload','/ns1:CreateBillOfMaterialsEBM/ns2:EBMHeader'),'Logging Trace Message From ValidateBOMBPEL Process')
    3. In the log <AIA/HOME>/Logs/Trace - log.xml , I can see the trace message , but the header information is populated as NULL like EBM Name , EBO Name etc. However , I can see those values present in the input through by BPEL Console (Audit Flow)
    The sample trace message is :
    <MESSAGE>
    <HEADER>
    <TSTZ_ORIGINATING>2009-05-29T12:19:46.293+05:30</TSTZ_ORIGINATING>
    <COMPONENT_ID>aia</COMPONENT_ID>
    <MSG_TYPE TYPE="TRACE"></MSG_TYPE>
    <MSG_LEVEL>32</MSG_LEVEL>
    <HOST_ID>01hw158283</HOST_ID>
    <HOST_NWADDR>192.168.15.64</HOST_NWADDR>
    <MODULE_ID>logging.trace</MODULE_ID>
    <THREAD_ID>14</THREAD_ID>
    <USER_ID>SYSTEM</USER_ID>
    <SUPPL_ATTRS>
    <ATTR NAME="SENDER_ID"></ATTR>
    <ATTR NAME="SENDER_MESSAGE_ID"></ATTR>
    <ATTR NAME="EBM_NAME"></ATTR>
    <ATTR NAME="EBO_NAME"></ATTR>
    <ATTR NAME="EBM_ID"></ATTR>
    <ATTR NAME="SENDER_TRANSACTION_CODE"></ATTR>
    <ATTR NAME="VERB_CODE"></ATTR>
    </SUPPL_ATTRS>
    </HEADER>
    <CORRELATION_DATA>
    <EXEC_CONTEXT_ID><UNIQUE_ID>192.168.15.64:94602:1243579784481:4</UNIQUE_ID><SEQ>0</SEQ></EXEC_CONTEXT_ID>
    </CORRELATION_DATA>
    <PAYLOAD>
    <MSG_TEXT>Logging Trace Message From ValidateBOMBPEL Process</MSG_TEXT>
    </PAYLOAD>
    </MESSAGE>
    Can anyone tell me where I am going wrong ...

    Facing the same issue The log message is getting inserte the trace\log.xml . All the headers show null.
    Please tell me how to poplute the EBM header.

  • Print head alignment keeps on getting worse and worse the more I try to "fix" it

    First off, I know that this question doesn't really belong in the mbp section, but since I am printing from one, I thought this would be the closest match.
    I have an Epson NX420 printer which came with my 2011 mbp 13in for free (err... $100 off the original $95ish to be exact). It will turn 3 years old in less than a month.
    This past week, I have had troubles printing "good" images, so I did the print head alignment on Epson Printer Utility 4, following the written directions. I printed something out, and it was still disgustingly off, so I repeated the process two more times, each time printing something different. The vertical alignment is fine, but the horizontal alignment seems to get worse and worse. One thin line will be split into two in some places, and one will be dotted while the other solid, and in the case of color, the two bands are different colors. Solids come out grainy.
    I don't want to waste any more paper and expensive ink for something that is not fixing itself. Since my mbp is still under Applecare warrenty, will Apple fix or trade my current printer for another one for free, or does Apple have nothing to do with printers other than its sale? If not, are there alternative ways to fix this problem? I am sure I am choosing the box without any bands at all and if there is I choose the lightest band-in-a-box and click realignment.
    Here is the recent printout of random lines and text, after three unsuccesful trials of print head alignment.

    This is a printer issue and it's only covered under the Epson Warranty Program, which is 1 year.  AppleCare has nothing to do with that.
    You'll probably have to replace the printer if the print heads cannot be replaced.  That's the issue when you buy an inkjet that has print heads that aren't part of the ink cartriges... when they go bad, they go bad and you're hosed.  If the issue persists after a print cartridge change, then it's definitely the heads.

  • How can I copy my iTunes library over to my MP3 player?

    I have all of my songs saved in my iTunes library and on my iPad.  How am I able to get this transferred over to my Sony MP3 player?

    Read the diresctions for your mp3 player.

  • How do I join multiple mp3 files into one mp3 file?

    Hello,
    I have multiple mp3 files that I would like to join into one mp3 file and to use it as an audio book. This explains how to do it, but in iTunes 12, I do not see an option called "Part of a Compilation" option.
    Is there a way to do it in iTunes without installing a new app?
    Thank you.

    Eugene,
    Those instructions, if I read them correctly, are about how to collect several MP3s into a single audiobook.  They will not create a single continuous MP3.
    iTunes does not have the ability to combine multiple MP3s into a single MP3.  The best it can do is if you burn them to audio CD and then rip back with "Join Tracks" enabled.  The better way is to use an audio editor such as Audacity, or a special purpose combing tool such as MP3 Joiner.

  • Mp3 and Memory

    Hi
    i need to put in the movie about 5 mp3 files each is 4mintues
    (150kb size) and the files should be in seprated playes
    i mean after finishing the first mp3 flash should unload it
    from memory and start the next one
    so i added eachone to frame
    but when testing on mobile memory error
    i tryed to put mp3 in a separated scenes and same problem
    occured (Stream and event both make the problem)
    so how tell flash to load first mp3 play it then unload it
    and load the next one ???????

    put each mp3 inside its own SWF.
    make a player swf
    use loadMovie() to load the mp3 swf into a movie clip or
    level of player SWF
    when _currentframe = _totalframes (playhead finished playing
    mp3) call loadMovie to load the next mp3 swf.

Maybe you are looking for

  • Access document which locks up computer unable to exit document

    Receive document on Email save to file. Open file to print. Computer locked up, Unable to edit using mouse or Keyboard Only able to remove from screen by restart computer.Did send in a requested fault report days ago but no reply.

  • Sub- Archiving billing document

    HI everybody, 1 clarification--am facing 1 issue see ,we ve created 1 invoice in vf01-and the inv no is 700----we ve done some mistake in that inv no 700.... we want to cancel it.......but because of some obligations we want the same invoice no.700??

  • Strange apache2 error_log entry

    Every few seconds an entry "/var/empty/server-status" appears in the apache2 error_log (Mac OS X Server 10.6.7). What is the meaning of this? Also, I do not know what instance is writing to this log since each website writes to its own error log. Is

  • Redo log backup failing with BR253E errno 2:

    Hi all, I am able to take online as well as offline backup through sapdba , but unfortunately from last 7 days my redo log backup is failing after online backup is complete with below mentioned error. I also tried to start redo log backup seperately

  • Firefox 3.6.6 released

    The many problems caused by the new Firefox 3.6.4 "hang detector" facility that led to Flash Player crashes has led Mozilla to release Firefox 3.6.6 with a higher timeout value. For details see http://support.mozilla.com/en-US/kb/The+Adobe+Flash+plug