谢谢大家了,只要翻译得出来,分不是问题可以再加,谢谢大家帮忙...
这是用法
[d,sr]=wavread('sf1_cln.wav'); 
% 1024 samples is about 60 ms at 16kHz, a good window 
y=pvoc(d,.75,1024);下面是文件
///////////pvoc.m/////////////
function y = pvoc(x, r, n)
% y = pvoc(x, r, n)  Time-scale a signal to r times faster with phase vocoder
%      x is an input sound. n is the FFT size, defaults to 1024.  
%      Calculate the 25%-overlapped STFT, squeeze it by a factor of r, 
%      inverse spegram.
% 2000-12-05, 2002-02-13 [email protected].  Uses pvsample, stft, istft
% $Header: /homes/dpwe/public_html/resources/matlab/RCS/pvoc.m,v 1.2 2002/02/13 16:14:54 dpwe Exp $
if nargin < 3
  n = 1024;
end
% With hann windowing on both input and output, 
% we need 25% window overlap for smooth reconstruction
hop = n/4;
% Effect of hanns at both ends is a cumulated cos^2 window (for
% r = 1 anyway); need to scale magnitudes by 2/3 for
% identity input/output
scf = 2/3;
% Calculate the basic STFT, magnitude scaled
X = scf * stft(x', n, n, hop);
% Calculate the new timebase samples
[rows, cols] = size(X);
t = 0:r:(cols-2);
% Have to stay two cols off end because (a) counting from zero, and 
% (b) need col n AND col n+1 to interpolate
% Generate the new spectrogram
X2 = pvsample(X, t, hop);
% Invert to a waveform
y = istft(X2, n, n, hop)';
///////////stft.m/////////////
function d = stft(x, f, w, h)
%       D = stft(X, F, W, H)                            Short-time Fourier transform.
% Returns some frames of short-term Fourier transform of x.  Each 
% column of the result is one F-point fft; each successive frame is 
% offset by H points until X is exhausted.  Data is hamm-windowed 
% at W pts..
% See also 'istft.m'.
% dpwe 1994may05.  Uses built-in 'fft'
% $Header: /homes/dpwe/public_html/resources/matlab/RCS/stft.m,v 1.1 2002/02/13 16:15:55 dpwe Exp $
s = length(x);
if rem(w, 2) == 0   
% force window to be odd-len
  w = w + 1;
end
halflen = (w-1)/2;
halff = f/2;   % midpoint of win
acthalflen = min(halff, halflen);
halfwin = 0.5 * ( 1 + cos( pi * (0:halflen)/halflen));
win = zeros(1, f);
win((halff+1):(halff+acthalflen)) = halfwin(1:acthalflen);
win((halff+1):-1:(halff-acthalflen+2)) = halfwin(1:acthalflen);
c = 1;
% pre-allocate output array
d = zeros((1+f/2),1+fix((s-f)/h));
for b = 0:h:(s-f)
  u = win.*x((b+1):(b+f));
  t = fft(u);
  d(:,c) = t(1:(1+f/2))';
  c = c+1;
end;
///////////pvsample.m/////////////
function c = pvsample(b, t, hop)
% c = pvsample(b, t, hop)   Interpolate an STFT array according to the 'phase vocoder'
%     b is an STFT array, of the form generated by 'specgram'.
%     t is a vector of (real) time-samples, which specifies a path through 
%     the time-base defined by the columns of b.  For each value of t, 
%     the spectral magnitudes in the columns of b are interpolated, and 
%     the phase difference between the successive columns of b is 
%     calculated; a new column is created in the output array c that 
%     preserves this per-step phase advance in each bin.
%     hop is the STFT hop size, defaults to N/2, where N is the FFT size
%     and b has N/2+1 rows.  hop is needed to calculate the 'null' phase 
%     advance expected in each bin.
%     Note: t is defined relative to a zero origin, so 0.1 is 90% of 
%     the first column of b, plus 10% of the second.
% 2000-12-05 [email protected]
% $Header: /homes/dpwe/public_html/resources/matlab/dtw/../RCS/pvsample.m,v 1.3 2003/04/09 03:17:10 dpwe Exp $
if nargin < 3
  hop = 0;
end
[rows,cols] = size(b);
N = 2*(rows-1);
if hop == 0
  % default value
  hop = N/2;
end
% Empty output array
c = zeros(rows, length(t));
% Expected phase advance in each bin
dphi = zeros(1,N/2+1);
dphi(2:(1 + N/2)) = (2*pi*hop)./(N./(1:(N/2)));
% Phase accumulator
% Preset to phase of first frame for perfect reconstruction
% in case of 1:1 time scaling
ph = angle(b(:,1));
% Append a 'safety' column on to the end of b to avoid problems 
% taking *exactly* the last frame (i.e. 1*b(:,cols)+0*b(:,cols+1))
b = [b,zeros(rows,1)];
ocol = 1;
for tt = t
  % Grab the two columns of b
  bcols = b(:,floor(tt)+[1 2]);
  tf = tt - floor(tt);
  bmag = (1-tf)*abs(bcols(:,1)) + tf*(abs(bcols(:,2)));
  % calculate phase advance
  dp = angle(bcols(:,2)) - angle(bcols(:,1)) - dphi';
  % Reduce to -pi:pi range
  dp = dp - 2 * pi * round(dp/(2*pi));
  % Save the column
  c(:,ocol) = bmag .* exp(j*ph);
  % Cumulate phase, ready for next frame
  ph = ph + dphi' + dp;
  ocol = ocol+1;
end
///////////istft.m/////////////
function x = istft(d, ftsize, w, h)
% X = istft(D, F, W, H)                   Inverse short-time Fourier transform.
% Performs overlap-add resynthesis from the short-time Fourier transform 
% data in D.  Each column of D is taken as the result of an F-point 
% fft; each successive frame was offset by H points. Data is 
% hamm-windowed at W pts..
% dpwe 1994may24.  Uses built-in 'ifft' etc.
% $Header: /homes/dpwe/public_html/resources/matlab/RCS/istft.m,v 1.1 2002/02/13 16:16:12 dpwe Exp $
s = size(d);
%if s(1) != (ftsize/2)+1
%  error('number of rows should be fftsize/2+1')
%end
cols = s(2);
xlen = ftsize + cols * (h);
x = zeros(1,xlen);
if rem(w, 2) == 0   
  % force window to be odd-len
  w = w + 1;
end
win = zeros(1, ftsize);
halff = ftsize/2;   % midpoint of win
halflen = (w-1)/2;
acthalflen = min(halff, halflen);
halfwin = 0.5 * ( 1 + cos( pi * (0:halflen)/halflen));
win((halff+1):(halff+acthalflen)) = halfwin(1:acthalflen);
win((halff+1):-1:(halff-acthalflen+2)) = halfwin(1:acthalflen);
for b = 0:h:(h*(cols-1))
  ft = d(:,1+b/h)';
  ft = [ft, conj(ft([((ftsize/2)):-1:2]))];
  px = real(ifft(ft));
  x((b+1):(b+ftsize)) = x((b+1):(b+ftsize))+px.*win;
end;

解决方案 »

  1.   

    使用Matcom,参考文章:
    http://www.vckbase.com/document/viewdoc/?id=1435
      

  2.   

    http://www.vckbase.com/document/finddoc.asp?keyword=matlab
      

  3.   

    先谢谢 vcleaner(我没当大哥很久了.......) 了。
    不过我主要是想知道这几个文件中的处理过程是怎么样的,所以要想办法把它看懂:)
      

  4.   

    推荐你看一本书:
    http://www.buaapress.com.cn/buaa/html/book/view.asp?id=1276&cat_f=&cat_s=23&catf_id=12
      

  5.   

    http://www.2nsoft.com/forum/showTopic.jsp?topicid=129
      

  6.   

    现在Matcom(MIDEVA)已经被集成在matlab中了。你只需要按照帮助文件中的步骤做即可了!
      

  7.   

    vcleaner大哥,是这样的,现在要做的这个东西目的是要移植到别的OS上,所以核心代码一定要用纯C实现,不能用第三方库和DLL等东西。你介绍的东西我都看了,但是混合编程做不到这个要求啊
      

  8.   

    Matcom(MIDEVA)可以将其转换为C或者C++的代码,在什么平台下这两种语言不能用???呵呵,俺还不知道。
      

  9.   

    变成C不一定能实现啊,MATLAB的函数好象都可以看代码哦