Correlation analysis tool

Discussion in 'Software' started by 6ixcore, Nov 19, 2024 at 5:57 AM.

  1. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    196
    Likes Received:
    93
    Does anyone know a tool (vst or stand alone app) that analyses the whole file and show something similar to this real time analysis from Ozone Imager?
     

    Attached Files:

  2.  
  3. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,427
    Likes Received:
    3,268
    Izotope Insight, both 1 and 2; also show a very similar amount of information. You can put it on buses, or you can use insert Relay plugins to individual audio channels. It's almost completely a reader/viewer. It's also realtime. If it wasn't, what would you be expecting to do with it?
     
  4. justwannadownload

    justwannadownload Audiosexual

    Joined:
    Jan 13, 2019
    Messages:
    1,310
    Likes Received:
    849
    Location:
    Central Asia
    A whole file specifically?
    Mastering The Mix Expose
     
  5. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    196
    Likes Received:
    93
    Hey guys thanks for the suggestions! Unfortunately none of those analyse full tracks and show a full history from start to finish, i have multiple files to analyse and real time is a pain as i have to listen from start to finish to see the analysis.
     
  6. dondada

    dondada Audiosexual

    Joined:
    Jan 2, 2015
    Messages:
    1,058
    Likes Received:
    508
    have a look at NuGen & Blue Cat
    Besides them, there are non Plugin Apps that do that
     
  7. alexbart

    alexbart Producer

    Joined:
    Mar 17, 2013
    Messages:
    146
    Likes Received:
    98
    With Reaper you have the option to show various analysis curves on the waveform.
    To enable it, go to options menu "Peaks Display Mode" and then select the combination of your choice.
     

    Attached Files:

  8. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,427
    Likes Received:
    3,268
    How do you get it to show correlation? I'm looking in Reaper 7.22.
     
  9. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    196
    Likes Received:
    93
    That is great and more in line with what im looking for, think will get Reaper just for that, thanks!
     
  10. saccamano

    saccamano Audiosexual

    Joined:
    Mar 26, 2023
    Messages:
    1,249
    Likes Received:
    506
    Location:
    CBGB omfug
    Are you running RME audio gear by any chance? If yes, get DigiCheck (free) from the RME audio site. It has a great REALTIME correlation meter as one part of its many other functions including a realtime 1/3 octave analyzer, and phase scope...
     
  11. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    196
    Likes Received:
    93
    Yes using RME and have DigiCheck, its great but im looking for an app that i could drop lets say 10 tracks and it will analyse and show the correlation of the whole track, not in real time! The Reaper suggestion by @alexbart is the only one that can do this (that im aware of).
     
  12. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    196
    Likes Received:
    93
    Do you know any app that will analyse a bunch of tracks and show he whole correlation history of each track?

    Just downloaded Reaper and cant find the correlation option?
     

    Attached Files:

  13. dondada

    dondada Audiosexual

    Joined:
    Jan 2, 2015
    Messages:
    1,058
    Likes Received:
    508
    Wavelab pro (12)
    on some of the windows it lets you analyse the whole track
    cant remember if it's the exact thing you need
    But since it can also do multitrack, it should be covered

    But most, like Master Pinguin
    do offline Loudness (batch) processing, dont know if correlation is also covered
    sorry i cant remember:dunno:


    edit:
    Nugen
    Wavelab
    RTW

    and lastly maybe this is it:wink:
    Zplane PPMulator
     
    Last edited: Nov 21, 2024 at 1:48 AM
  14. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,427
    Likes Received:
    3,268
    Many of these options are going to show correlation on a goniometer as a momentary, short term basis; because that is how most people use them. They typically do not want to just know an average, like you might with peak, loudness, etc. They want to see the spots where you are losing mono compatibility, and what can be done to adjust for it. Depending on the situation, you might just want to setup a plugin like Sonalksis Stereo Tools to mono everything under wherever you select, such as below 100hz; as part of your batch processing setup. Many other plugins are available that you can use as a "monomaker".

    Or you could use a script in python (example, might need some tweaks):
    create a python script program to batch analyze correlation of audio waveforms
    ChatGPT said:

    Here's a Python script that batch analyzes the correlation of audio waveforms. The pro

    gram will load multiple audio files, calculate the cross-correlation between each pair, and store the results in a CSV file for further analysis.

    Script Overview:
    1. Audio File Processing: The script loads audio files (typically .wav format, but can be modified for other formats).
    2. Cross-Correlation Calculation: Computes the normalized cross-correlation for each pair of waveforms.
    3. Results: Stores the correlation coefficients between each pair of audio files in a CSV file.
    Required Libraries:
    • Librosa: For loading audio files.
    • NumPy: For numerical computations.
    • SciPy: For calculating the correlation.
    • Pandas: For managing and exporting results.
    Install the necessary dependencies first:


    bash

    pip install librosa numpy scipy pandas


    Python Script: batch_analyze_audio_correlation.py

    python

    import os
    import librosa
    import numpy as np
    from scipy.signal import correlate
    import pandas as pd

    def load_audio(file_path):
    """
    Load an audio file using librosa.
    Returns the waveform and sample rate.
    """
    waveform, sr = librosa.load(file_path, sr=None) # Load audio without resampling
    return waveform, sr

    def calculate_correlation(waveform1, waveform2):
    """
    Calculate the normalized cross-correlation between two waveforms.
    """
    correlation = correlate(waveform1, waveform2, mode='full')
    # Normalize the correlation to be between -1 and 1
    correlation /= np.sqrt(np.sum(waveform1**2) * np.sum(waveform2**2))
    return correlation.max() # Return the maximum correlation value

    def batch_process_audio_files(directory):
    """
    Process all audio files in a directory and compute pairwise correlations.
    """
    audio_files = [f for f in os.listdir(directory) if f.endswith('.wav')] # Modify extension if necessary
    correlations = []

    # Loop through all pairs of audio files
    for i, file1 in enumerate(audio_files):
    for j, file2 in enumerate(audio_files):
    if i < j: # To avoid redundant computations
    file_path1 = os.path.join(directory, file1)
    file_path2 = os.path.join(directory, file2)

    # Load the audio files
    waveform1, sr1 = load_audio(file_path1)
    waveform2, sr2 = load_audio(file_path2)

    # Compute correlation
    corr_value = calculate_correlation(waveform1, waveform2)
    correlations.append([file1, file2, corr_value])

    return correlations

    def save_correlation_matrix(correlations, output_file):
    """
    Save the correlation results as a CSV file.
    """
    df = pd.DataFrame(correlations, columns=['File 1', 'File 2', 'Correlation'])
    df.to_csv(output_file, index=False)

    def main():
    # Set the directory containing audio files
    audio_directory = './audio_files' # Change this to your folder with audio files
    output_csv = './correlations.csv' # Output CSV file

    # Batch process the audio files and compute correlations
    correlations = batch_process_audio_files(audio_directory)

    # Save the results to a CSV file
    save_correlation_matrix(correlations, output_csv)
    print(f"Correlation analysis saved to {output_csv}")

    if __name__ == "__main__":
    main()


    Explanation of the Script:
    1. load_audio(file_path): Loads an audio file using librosa.load(), returning the waveform and sample rate.
      • The sample rate (sr) is returned but not used in this case, as we are only analyzing the waveforms.
    2. calculate_correlation(waveform1, waveform2): Computes the normalized cross-correlation between two waveforms using scipy.signal.correlate. It normalizes the correlation to ensure it ranges from -1 (perfect negative correlation) to 1 (perfect positive correlation), returning the maximum correlation value.

    3. batch_process_audio_files(directory):
      • Loops through all audio files (with .wav extension) in the provided directory.
      • For each pair of audio files, it computes the correlation between their waveforms.
    4. save_correlation_matrix(correlations, output_file): Saves the list of correlation results into a CSV file. The CSV file contains three columns: File 1, File 2, and Correlation, which store the filenames and the computed correlation coefficient between the corresponding pairs of files.

    5. main(): The entry point of the script. You specify the directory where your audio files are stored (audio_directory), and the script will compute the correlation matrix and save the results in the specified CSV file (output_csv).
    How to Use the Script:
    1. Prepare Audio Files: Place your .wav audio files in a directory (e.g., ./audio_files).

    2. Run the Script:
      • Open a terminal or command prompt.
      • Navigate to the folder where the script is located.
      • Run the script with the command:

        bash

        python batch_analyze_audio_correlation.py
    3. Results:
      • The script will analyze the correlation between each pair of audio files in the specified directory.
      • It will save the results in a CSV file called correlations.csv (or any other filename you choose).
      The resulting CSV will have this structure:

      File 1 File 2 Correlation
      file1.wav file2.wav 0.95
      file1.wav file3.wav 0.78
      file2.wav file3.wav 0.66
      ... ... ...
    Example Output:

    css

    Correlation analysis saved to correlations.csv


    Customizations:
    • Audio File Formats: The script currently works for .wav files, but you can modify it to work with other formats supported by librosa (e.g., .mp3, .flac).
    • Normalization: You can adjust the correlation normalization method if needed based on your specific use case.
    • Handling Large Datasets: For a large number of audio files, consider using multiprocessing to parallelize the correlation computation.
    This script should help you batch process and analyze the correlation of audio waveforms efficiently!
     
    Last edited: Nov 21, 2024 at 3:01 AM
Loading...
Similar Threads - Correlation analysis tool Forum Date
How can I correctly fix phase correlation issues? Mixing and Mastering Sep 16, 2023
Correlation issues Mixing and Mastering Oct 2, 2018
Correlation Live Nov 17, 2017
Correlation :(. Mixing and Mastering Jan 4, 2017
How Long Does Music Stardom Last? A Statistical Analysis Internet for Musician Aug 10, 2024
Loading...