I have to distinguish between two types of MP3 files. Both are 'Joint-Stereo' and have two channels, but they were recorded differently. The recordings are from calls, one is filled with both sides and the other one only have the called party. I have to check which one is single-side and which is both-side.
I tried it in Java with JAudioTagger and then in C# with NAudio, but I can't get a clever way to get the information or to calculate the different channel size.
The audio files are only different in the way they were recorded. Imagine a phone call and both sides are recorded, but sometimes only for coaching purposes the side of the employee is the one recorded and the one is silence, but the employee part is on both channels. My job is now to find out which mp3 audio files is recorded with both sides of a conversation and which is only the employee. In Java I tried with the JAudioTagger
to get some information. MP3File(mp3File).getMP3AudioHeader()
, but every metadata that could be slightly different are the same on both recordings.
My thought were that maybe it's possible to divide the two channels of the 'Joint Stereo' files and check if both summed bytes for each side are similar or different.
__________________________________________________________________
I deleted much of my code, but that's was left.
In Java:
public static void checkMp3Sides(File mp3File) {
try {
MP3File mp3 = new MP3File(mp3File);
mp3.getAudioHeader().getChannels();
} catch (Exception e) {
e.printStackTrace();
}
}
In C#:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NAudio.Wave; namespace CheckAudioChannelsEquality { class Program { static void Main(string[] args) { string fileName = ""; Mp3FileReader file = new Mp3FileReader(fileName); int _Bytes = (int)file.Length; byte[] Buffer = new byte[_Bytes]; int leftSum = 0; int rightSum = 0; int read = file.Read(Buffer, 0, (int)_Bytes); for (int i = 0; i < read; i += 4) { Int16 leftSample = BitConverter.ToInt16(Buffer, i); Int16 rightSample = BitConverter.ToInt16(Buffer, i + 2); leftSum += leftSample; rightSum += rightSample; } Console.WriteLine("Left: " + leftSum + " | Right: " + rightSum); } } }