Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System.Web;
  2. using System.Web.UI;
  3. using System.Web.UI.WebControls;
  4. using NAudio;
  5. using System.IO;
  6.  
  7. public partial class _Default : System.Web.UI.Page
  8. {
  9. protected void Page_Load(object sender, EventArgs e)
  10. {
  11. MP3toWAV(MapPath("~/Music/UctfnI6yUPM.mp3"), MapPath("~/Music/UctfnI6yUPM.wav"));
  12. Strip(MapPath("~/Music/UctfnI6yUPM.wav"));
  13. }
  14. public void MP3toWAV(string file,string output)
  15. {
  16. using (NAudio.Wave.Mp3FileReader reader = new NAudio.Wave.Mp3FileReader(file))
  17. {
  18. NAudio.Wave.WaveFileWriter.CreateWaveFile(output, reader);
  19. }
  20. }
  21. public void Strip(string path)
  22. {
  23. NAudio.Wave.WaveChannel32 wave = new NAudio.Wave.WaveChannel32(new NAudio.Wave.WaveFileReader(path));
  24. byte[] buffer = new byte[8192];
  25. int read = 0;
  26. StreamWriter writer = new StreamWriter(MapPath("~/Result.txt"));
  27. while (wave.Position < wave.Length)
  28. {
  29. read = wave.Read(buffer, 0, 8192);
  30. for (int i = 0; i < read / 4; i++)
  31. {
  32. writer.Write(BitConverter.ToSingle(buffer, i * 4));
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement