Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yeah, MP3 files are very different from WAV files. WAV files contain raw audio data in the form of samples from beginning to end to paint the waveform of the output, the same way a bitmap file contains raw data about pixels from left to right, top to bottom. You can think of a WAV file as a bitmap picture of sound waves -- but rather than pixel colors, it stores audio intensities, typically 44,100 of them per second, for two channels if it's stereo, and 2 bytes per channel.</p> <p>(Knowing this you can actually calculate the file size of a WAV file -- to store 1 minute of audio, you'd need 60 seconds * 44100 samples * 2 channels * 2 bytes = 10.09MB.)</p> <p>MP3 files contain a mathematically modified version of this image and discards audio that humans can't hear. It works similarly to how jpeg images work to compress images.</p> <p>Just as video cards ultimately need bitmaps to work with, sound cards ultimately need WAV data to work with -- so yes, you need a decoder.</p> <p>At the beginning of Mp3 files is a block of data called an ID3 tag, which contains a bunch of basic information about the file -- artist names, track length, album names, stuff like that. You can use something like <a href="http://sourceforge.net/projects/csid3lib/" rel="noreferrer">C# ID3</a> to read/write ID3 tags in C#.</p> <p>As for audio itself, I'm not sure there are Mp3 decoders written entirely in C#. Technically there's no reason that it can't be done (it should be fine performance wise too), but the standard is pretty loose and the math is intense so people tend to just use things like FFMpeg to decode. Some ideas in this <a href="http://www.google.com/search?hl=en&amp;source=hp&amp;q=c%23+ffmpeg&amp;btnG=Google+Search&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=" rel="noreferrer">Google search</a>.</p> <p>If you don't need to do any special processing and you just want to play the audio, you can use the WPF/Silverlight <a href="https://login.live.com/login.srf?wa=wsignin1.0&amp;rpsnv=11&amp;checkda=1&amp;ct=1281235729&amp;rver=6.0.5276.0&amp;wp=MCLBI&amp;wlcxt=msdn$msdn$msdn&amp;wreply=http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.aspx&amp;lc=1033&amp;cb=&amp;id=254354" rel="noreferrer">Media</a> element.</p> <p>You can probably get some hints out of <a href="http://joshsmithonwpf.wordpress.com/2008/01/06/introducing-podder-the-wpf-podcast-player/" rel="noreferrer">Josh Smith's Podder</a> app.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload