tags:

views:

69

answers:

3

I want to create a very simple piece of software in C# .NET that I can pass a folder's path to and detect all files with a frequency of below a given threshold. Any pointers on how I would do this?

+1  A: 

You can use UltraID3Lib to get mp3 metadata (bitrate, frequency)

MAKKAM
A: 

Check value of frequency bits in a file. There is some info about mp3 format.

tom3k
it is not enough, because usually ID3 comes before mp3 header and you need to handle it first.
Andrey
+3  A: 

You have to read mp3 files. To do that you have to find specifications for them.

Generally mp3 file is wrapped into ID3 tag, so that you have to read it, find its length and skip it. Let's take ID3v2.3 for example:

ID3v2/file identifier   "ID3" 
ID3v2 version           $03 00
ID3v2 flags             %abc00000
ID3v2 size              4 * %0xxxxxxx

so bytes 6,7,8,9 store header length in big-endian form. Here is sample of some file:

 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
49 44 33 03 00 00 00 00 07 76 54 43 4f 4e 00 00

07 76 - is the size. You need to shift left first byte so that actual size is 3F6. Then add 10 (A) to get the offset = 400. This is address of start of mp3 header.

Then you take description of mp3 header:

bits are: AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM, we need FF , sampling frequency and convert t to actual frequency:

bits    MPEG1   MPEG2   MPEG2.5
00  44100   22050   11025
01  48000   24000   12000
10  32000   16000   8000
11  reserv. reserv. reserv.
Andrey
Any snippets of code to support this at all? Then I'll mark as answer
Andi
@SocialAddict are you serious? it was interesting for me to dig into mp3 format to find out where do they store frequency, but i will not write code for you, because it is trivial. you should be able to do it by yourself, extensive information and links were given.
Andrey
I wasn't asking for a complete solution.
Andi