0

I have pre recorded 5 mp3 files at 320 kbps. In C# I am using this code to merge/join them together in one mp3:

private void MergeMP3(List<string> inputFiles, FileStream output)
{
    foreach (string file in inputFiles)
    {
       Mp3FileReader reader = new Mp3FileReader(file);
       if ((output.Position == 0) && (reader.Id3v2Tag != null))
       {
          output.Write(reader.Id3v2Tag.RawData, 0,    reader.Id3v2Tag.RawData.Length);
       }
       Mp3Frame frame;
       {
          output.Write(frame.RawData, 0, frame.RawData.Length);
       }
    }
}

The output mp3 file I save on my disk has bitrate 291 kbps. What should I do to have 320 kbps on the output file?

EDIT 1:

The way I call function from above (MergeMP3) from Main:

    //paths to files I want to merge
    List<string> paths = new List<string>();
    paths.Add(@"C:\Users\user\Desktop\1.mp3");
    paths.Add(@"C:\Users\user\Desktop\2.mp3");
    paths.Add(@"C:\Users\user\Desktop\3.mp3");
    paths.Add(@"C:\Users\user\Desktop\4.mp3");
    paths.Add(@"C:\Users\user\Desktop\5.mp3");

   //Merge mp3
   FileStream output = File.Open(@"C:\Users\user\Desktop\AllTogether.mp3", FileMode.Create);
   MergeMP3(paths, output);

EDIT 2: I am using NAudio.dll

knowkeen
  • 11
  • 5

0 Answers0