estimation - Calculating audio pitch in MATLAB? -
yesterday finalised code detecting audio energy of track displayed on time, use part of audio thumbnailing project.
however method can detect pitch of track displayed on time, have 2 options base research upon.
[y, fs, nb] = wavread('three.wav'); %# load signal variable y framewidth = 441; %# 10 msec numsamples = length(y); %# number of samples in y numframes = floor(numsamples/framewidth); %# number of full frames in y energy = zeros(1,numframes); %# initialize energy frame = 1:numframes %# loop on frames startsample = (frame-1)*framewidth+1; %# starting index of frame endsample = startsample+framewidth-1; %# ending index of frame energy(frame) = sum(y(startsample:endsample).^2); %# calculate frame energy end
that correct code energy method, , after researching, found need use discrete time fourier transform find current pitch of each frame in loop.
i thought process easy modifying final lines of code include "fft" matlab command calculating discrete fourier transforms getting errors unbalanced equation.
help appreciated, if it's general pointer in right direction. thank you.
determining pitch lot more complicated applying dft. depends on nature of source - different algorithms appropriate speech versus musical instrument, example. if music track, question seems imply, you're out of luck there no obvious way of determining single pitch value multiple musical instruments playing (how define pitch in context ?). maybe more specific trying - perhaps power spectrum more useful trying determine arbitrary pitch ?
Comments
Post a Comment