Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using NAudio;
- using System.IO;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- MP3toWAV(MapPath("~/Music/UctfnI6yUPM.mp3"), MapPath("~/Music/UctfnI6yUPM.wav"));
- Strip(MapPath("~/Music/UctfnI6yUPM.wav"));
- }
- public void MP3toWAV(string file,string output)
- {
- using (NAudio.Wave.Mp3FileReader reader = new NAudio.Wave.Mp3FileReader(file))
- {
- NAudio.Wave.WaveFileWriter.CreateWaveFile(output, reader);
- }
- }
- public void Strip(string path)
- {
- NAudio.Wave.WaveChannel32 wave = new NAudio.Wave.WaveChannel32(new NAudio.Wave.WaveFileReader(path));
- byte[] buffer = new byte[8192];
- int read = 0;
- StreamWriter writer = new StreamWriter(MapPath("~/Result.txt"));
- while (wave.Position < wave.Length)
- {
- read = wave.Read(buffer, 0, 8192);
- for (int i = 0; i < read / 4; i++)
- {
- writer.Write(BitConverter.ToSingle(buffer, i * 4));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement