I am trying to pass an MWArray of byts to a function. The byte array get data from an mp3 file.
Now I want to assign byte array to MWArray.
My code like this
string lSongFilePath = ConfigurationManager.AppSettings["SongFilePath"].ToString();
lSongFilePath += "\\" + "Grand Piano - Fazioli - major A.wav";
FileStream fs = File.OpenRead(lSongFilePath);
try
{
byte[] bytes = new byte[fs.Length];
var read = (fs.Read(bytes, 0, Convert.ToInt32(fs.Length)));
MWArray[] in_Arr = new MWArray[(int)read];
MWArray[] out_Arr = null;// = new MWArray[15];
ChordRecognizer hj = new ChordRecognizer();
hj.estimateTuning(4,ref out_Arr, in_Arr);
fs.Close();
}
catch(Exception ex)
{
string s = ex.Message;
}
This line just mention the size of array while I want to assign data to array too. please help
MWArray[] in_Arr = new MWArray[(int)read];
Not required, but FWIW, when combining a directory path and filename to get a full file path, you should use Path.Combine
Since you want to read the whole file into a byte array, you can use File.ReadAllBytes
I'm having trouble finding a place that documents what MWArray would look like in C# code - specifically creating it from the byte array. If you have a pointer to how to construct it for a single byte value, we can figure it out from there.