I have information (20,000 frames of data) about an audio track that I automatically correlated using:
[r,lags] = xcorr(XX,XX,'biased');
And it looks like this:
alt text http://a.imageshack.us/img809/3775/plot.jpg
Which, I hope, is so good so far. Ideally, I would like to have a frame number that corresponds to the highest part of the second peak. I read and tried to load different methods, but I just can't get it to get the information for me.
Can anyone shed some light on what I have to do?
Many thanks!
edit1: I tried using findpeaks , but it doesn't seem to work for me. I am not sure if this is because I am using the wrong data or not.
edit2: I am currently testing a method that can only be used on this sound track, but I want to expand it soon so that I can execute this method in the whole file directory, so I am kind of needing a script that can detect peaks rather than find information itself.
edit3: My .M file:
[y, fs, nb] = wavread('Three.wav'); %# Load the signal into variable y frameWidth = 441; %# 10ms numSamples = length(y); %# Number of samples in y numFrames = floor(numSamples/frameWidth); %# Number of full frames in y energy = zeros(1,numFrames); %# Initialize energy startSample = zeros(1,numFrames); %# Initialize start indices endSample = zeros(1,numFrames); %# Initialize end indices for frame = 1:numFrames %# Loop over frames startSample(frame) = (frame-1)*frameWidth+1; %# Starting index of frame endSample(frame) = frame*frameWidth; %# Ending index of frame frameIndex = startSample(frame):endSample(frame); %# Indices of frame samples energy(frame) = sum(y(frameIndex).^2); %# Calculate frame energy end %# End loop XX = filtfilt(ones(1,10)/10, 1, energy); %# Smooths signal [r,lags] = xcorr(XX,XX,'biased'); %# Auto-correlates the data plot(lags,r), xlabel('lag'), ylabel('xcorr') %# Plots data