0

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);
        }
    }
}

  • Are the employee & the caller on different stereo channels (ie the stereo recording is actually two mono recordings) - if so then you only need to check if one channel is silent. If both employee & caller are stereo recordings, then you could look for long silences in the recording for employee only. In either case, it is unlikely you will find useful information in the MP3 header file, it is the actual recording you will need to examine. If the recordings are true stereo, then comparing left & right channels is highly likely to show differences (that is the entire point of stereo recording) – PaulF Mar 22 '23 at 09:30
  • Audio and Images have ASCII header in the file. You can see the headers if you open with a text editor. The META Data contains the ASCII Header. The type is obtains from the header. – jdweng Mar 22 '23 at 09:55
  • @PaulF: 'If the recordings are true stereo, then comparing left & right channels is highly likely to show differences' How can i do that? Both recordings are stereo and yes I thought about scanning for long silences, but we have some recording where the employee talks 99% and the customer only say yes.. – JustNeedHelp123 Mar 22 '23 at 10:40
  • @jdweng you mean I could check the ASCII-Header if it's mono or stereo? With the Java code 'mp3.getAudioHeader().getChannels()' I get the answer 'Joint Stereo' – JustNeedHelp123 Mar 22 '23 at 10:42
  • Can't tell if the data is from ascii header or a digital header after the ascii header. See : https://en.wikipedia.org/wiki/MP3?force_isolation=true – jdweng Mar 22 '23 at 11:07
  • @JustNeedHelp123: what I meant was if the recording is true stereo then it is likely there will naturally be left/right differences - so comparing left & right will not tell you anything. – PaulF Mar 22 '23 at 11:39

0 Answers0