using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string _FileName = "C:\\Enya.mp3";
byte[] p;
p=File.ReadAllBytes(_FileName);
byte[] Stm = StereoToMono(p);
}
public byte[] StereoToMono(byte[] input)
{
byte[] output = new byte[input.Length / 2];
int outputIndex = 0;
for (int n = 0; n < input.Length; n += 4)
{
// copy in the first 16 bit sample
output[outputIndex++] = input[n];
output[outputIndex++] = input[n + 1];
}
return output;
}
}
}
I now wish this program to run but it shows an error in this line " byte[] Stm = StereoToMono(p);"
Mahesh AllePosted Dec 27, 2013, 10:03 AM
Just see the below one and it will work for you.
VulpesPosted Dec 27, 2013, 10:03 AM
Also I'm not sure you can treat an mp3 file as a raw byte stream for this purpose but, ignoring this for the moment, the modified code to deal with the first point would be:
Rahul ChoudharyPosted Dec 27, 2013, 9:46 AM
I am a newbie.
what can i do to resolve it.
VulpesPosted Dec 27, 2013, 9:28 AM
You might also have a problem in accessing a file on the root directory of C: drive unless you're running with administrative privileges.