我在matlab中实现了基于小波的音高变换。它看起来工作正常,但输出信号的相位存在问题。我不知道如何解决这个问题。我尝试了几种相移方法,但都没有正常工作。也许这是其他一些问题。 c
的不同值的相移是不同的。无论如何这里是代码:
[input fs nbits] = wavread('sinus.wav');
f = input(:,1);
c = 0.6; % pitch factor
wlet = 'morl';
coefs = cwtft(f, 'wavelet', wlet);
absc = abs(coefs.cfs).*c; %mag
phac = angle(coefs.cfs); %phase
phac = phac.* c;
phac_unwrap = unwrap(phac);
coefs.cfs = absc.*exp(1i*phac_unwrap); %coefs_shifted
coefs.scales = coefs.scales./c; %scales_shifted
f_shifted = icwtft(coefs);
result = f_shifted;
maxx = max(abs(f));
maxy = max(abs(result));
result = (result/maxy)*maxx;
wavwrite(result, fs, nbits, 'sinusup');