Stereo Channel Similarity Meter — User Guide
Measures the percentage of near-identical samples between the left and right channels of a stereo sound object, indicating mono compatibility.
What this does
This is an analysis tool that calculates the percentage of samples that are nearly identical in value between the left and right channels of a selected stereo Sound object. This measurement provides an indication of the stereo file's mono compatibility and the degree to which the audio in both channels is correlated.
The calculation is performed by iterating through the sound's samples at a defined step, comparing the values of the two channels at the same time point, and counting the instances where the difference is negligible.
Quick start
- Load a stereo Sound object into Praat.
- Select the Sound object in the Praat Objects window.
- Run the script: Praat → Run script… →
Stereo Channel Similarity Meter.praat(The usage is to Select a Sound object in Praat and run this script). - If the selected sound is not stereo, the script will exit and display an error message.
- The result, a percentage value labeled Similarity, will be printed to the Praat Info window.
Similarity: X.Y%, where X.Y is the calculated percentage of similar samples.
Implementation Details
Analysis Steps
The script's operation is split into three main phases: preparation, comparison, and final calculation.
- Preparation: The script first validates that the selected audio has exactly 2 channels. It then extracts the Left and Right channels into temporary objects and determines an optimized sampling step to speed up analysis (checking about 1,000 points across the file).
- Comparison: The script loops through the sound using the sampling step. At each point, it retrieves the sample value from both channels, calculates the absolute difference, and increments a similar samples counter if the difference is less than the internal threshold (meaning the samples are nearly identical).
- Calculation & Cleanup: The final Similarity Percentage is computed by dividing the count of similar samples by the total count of compared samples. The script finishes by removing the temporary channel objects it created.
Code Snippets
The core of the similarity check is in the conditional statement within the loop:
The script uses the formula to calculate the final percentage: