Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace ConsoleApplication2
- {
- class Program
- {
- public static void Main(string[] args)
- {
- string _FileName = "D:\\Uczelnia\\Technologie multimedialne\\LAB2\\audio.mp3";
- byte[] p;
- p = File.ReadAllBytes(_FileName);
- byte[] Stm = StereoToMono(p);
- for (int i = 0; i < Stm.Length; i++)
- {
- Console.Out.WriteLine(Stm[i]);
- }
- Console.ReadKey();
- }
- public static byte[] StereoToMono(byte[] input)
- {
- byte[] output = new byte[input.Length / 2];
- int outputIndex = 0;
- try
- {
- for (int n = 0; n < input.Length; n += 4)
- {
- output[outputIndex++] = input[n];
- output[outputIndex++] = input[n + 1];
- }
- }
- catch (Exception e)
- {
- return output;
- }
- return output;
- }
- private byte[] MonoToStereo(byte[] input)
- {
- byte[] output = new byte[input.Length * 2];
- int outputIndex = 0;
- try
- {
- for (int n = 0; n < input.Length; n += 2)
- {
- output[outputIndex++] = input[n];
- output[outputIndex++] = input[n + 1];
- output[outputIndex++] = input[n];
- output[outputIndex++] = input[n + 1];
- }
- }
- catch (Exception e)
- {
- return output;
- y}
- return output;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement