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?
A:
Check value of frequency bits in a file. There is some info about mp3 format.
tom3k
2010-09-30 10:02:32
it is not enough, because usually ID3 comes before mp3 header and you need to handle it first.
Andrey
2010-09-30 10:10:24
+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
2010-09-30 10:09:39
@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
2010-10-12 13:35:45