Jump to content

Need to analyze a bitstream from a digital out - compare to pcm .wav file


Recommended Posts

1. Record to wav using spdif input, using some path which is bit-perfect (windows - asio, linux - alsa, OSX - no idea :) )


2. Run audacity and configure it (Edit - Preferences - Quality) to fit exactly your samplerate and bit resolution. Disable dithering on the same tab.


3. Load the recorded and original tracks side by side and trim both at the beginning to be exactly sample-aligned. Using the zoom (wheel) you can find the corresponding peaks.


4. Trim both tracks at the end to contain equal number of samples


5. Store the prepared tracks to wavs, keeping the samplerate and resolution.


6. Install latest stable version of sox http://sourceforge.net/projects/sox/files/sox/


Compare the two wavs for identity with


sox -m sample1.wav -v -1 sample2.wav -n stat


The command mixes/adds the two wavs (parameter -m), while the second wav multiplies by -1 (parameter -v -1, i.e. effectively subtracts). If the two wavs are identical, you will get zeros at the stat effect output:


sox -m sample1.wav -v -1 sample2.wav -n stat

Samples read: 36454400

Length (seconds): 94.933333

Scaled by: 2147483647.0

Maximum amplitude: 0.000000

Minimum amplitude: 0.000000

Midline amplitude: 0.000000

Mean norm: 0.000000

Mean amplitude: 0.000000

RMS amplitude: 0.000000

Maximum delta: 0.000000

Minimum delta: 0.000000

Mean delta: 0.000000

RMS delta: 0.000000

Rough frequency: -2147483648



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...