How do I check bit combinations in .mp3 and .flac files?

edited September 2016 in Library Questions

I'm doing some research, and I'm particularly interested in the way bit combinations work in .mp3 and .flac files, can I find common bit combinations in .mp3 files, can I do that with .flac files, can i compare both of them? That kind of stuff.

In the experiment I will be checking 4 types of playlists of different artist and genres. The former will be provided both in .mp3 format and also .flac. The playlists song contents will be analyzed with decoders and the number of bit combination occurrences collected. Due to the number of songs in the playlist and the bitrate of them varying (at least I assume that) I will divide the collected results, firstly, by number of songs and, secondly - bitrate. All off this would be repeated for all the other playlists. The given results should then show if common bit combinations exist and whether .mp3 and .flac formats share them.

Can anyone of you tell me what i can use with processing to find this out or any other alternatives?

Tagged:

Answers

  • By "bit combinations" do you mean bytes -- as in, the number of times a unique string of 8 bits occurs? In other words, you want to keep a count the number of times that the unique numbers 0-255 (or with 16bits 0-65535) occur in each file audio?

    Unless you are planning on then visualizing or sonifying this information I am not sure that Processing is a good environment for binary processing of this kind. You can read a file byte by byte in Java, which means you can do it in Processing.

    Still, I suspect you task is easier to do in a scripting language. For example, looping over bytes in Python:

    with open("myfile", "rb") as f:
        byte = f.read(1)
        while byte:
            # Do stuff with byte.
            byte = f.read(1)
    
Sign In or Register to comment.