Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how to get frequency per second in file mp3 in C#
Posted
Comments
[no name] 8-Dec-12 22:58pm    
What is your scenario ? Elaborate your question...

Though your problem is not clear, I can only help you with this :
http://stackoverflow.com/questions/10833529/get-frequency-and-amplitude-from-wave-file[^]
 
Share this answer
 
 
Share this answer
 
You need to find Mpeg Header (it may goes after little offset from file beginning and after ID3V2 Tag in mp3 file)
After you should read the header - 4 bytes Header[4]
C#
byte _version = (byte)((Header[1] & 0x18) >> 3); // Mpeg Version
byte _layer = (byte)((Header[1] & 0x06) >> 1); // Mpeg Layer
byte _freqIndex = (byte)((Header[2] & 0x0C) >> 2); // Frequency Index

You got Frequency index _freqIndex and Mpeg Version _version which you can use according next table to get rate in Hz.
Sampling rate frequency index (values are in Hz)
bits MPEG1 MPEG2 MPEG2.5
00 44100 22050 11025
01 48000 24000 12000
10 32000 16000 8000
11 reserv. reserv. reserv.
For more information see information abt Mpeg3 header format next articles will helps you:
MPEG Audio Frame Header[^]
http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html[^]

Regards,
Maxim.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900