2011-04-04 101 views
0

我怎样才能增加/减少(频率/音调)和相位使用fft/ifft我认为我有基本的代码,但我不知道下一步该怎么做我怎样才能增加/减少(频率/音高)信号

我被告知repmat和resample可能有所帮助,是的,我想线性移位所有组件。我想随着时间的推移调整相位,这样它就会产生驻波。与在一个方向上的相变,并与相位另一个信号去相反方向

PS一个信号:它在八度/ MATLAB代码完成

例I有一个信号的重复1次每秒,我想让它每秒重复3次。

%Voiceprint raise lower freq phase conjugate signal 
tic 
clear all, clc,clf,tic 
%% Sound /beep calculation complete 
filerawbeepStr='calculations_complete.wav'; 
filerawbeeppathStr='/home/rat/Documents/octave/raw/'; 
filevoiceprepathStr='/home/rat/Documents/octave/eq_research/main/transform/voice/'; 
filewavpathStr='/home/rat/Documents/octave/eq_research/main/transform/wav/'; 
[ybeep, Fsbeep, nbitsbeep] = wavread(strcat(filerawbeeppathStr,filerawbeepStr)); 
%addpath(”/home/rat/Documents/octave/eq_research/main/transform/”); %add path to location of functions 

%1a voice print import 
[vp_sig_orig, fs_rate, nbitsraw] = wavread(strcat(filevoiceprepathStr,'voice8000fs.wav')); 

%vp_sig_orig=vp_sig_orig’; 
vp_sig_len=length(vp_sig_orig); 

%2a create frequency domain 
ya_fft = fft(vp_sig_orig); 
vp_sig_phase_orig = unwrap(angle(ya_fft)); 

%get Magnitude 
ya_fft_mag = abs(ya_fft); 

%3a frequency back to time domain 
ya_ifft=real(ifft(ya_fft)); 

%adjust frequency/phase here? How? 
vp_sig_new=real(ifft(ya_fft_mag.*exp(i*vp_sig_phase_orig))); 

subplot(3,1,1), plot(vp_sig_orig),title('1 original time domain') 
subplot(3,1,2), plot(ya_ifft),title('2 rebuild time domain') 
subplot(3,1,3), plot(vp_sig_new),title('3 adjusted time') 
+0

*如何*您要修改的每个频率组件,确切地说?所有组件的固定(即线性)移位?通过常数系数(即对数移位)对所有组件进行缩放?你想对这个阶段做什么(以及为什么)? – 2011-04-04 22:45:00

+0

@Paul R我被告知repmat和resample可能有所帮助,是所有组件的线性移位。我想随着时间的推移调整相位,这样它就会产生驻波。一个信号的相位在一个方向上变化,另一个信号的相位在相反的方向上变化 – 2011-04-07 15:52:00

+0

行 - 您应该编辑您的问题以包含此信息 - 然后它会更清晰地表明您尝试实现的目标 – 2011-04-07 16:44:30

回答

0

这是做到这一点的一种方式,但如果信号大,你可能要增加点的数量的信号

clear,clc 
fs = 44100;     % Sampling frequency 
t=linspace(0,1,fs); 
freq=1; 
ya = sin(2*pi*freq*t)'; %+ 1*sin(2*pi*250*t); 


num_per_sec=5 
yb=repmat(ya,num_per_sec,1);%replicate matrix 
xxo=linspace(0,1,length(yb))'; %go from 0 to 1 sec can change speed by incr/decr 1 
xxi=linspace(0,1,length(ya))'; %go from 0 to 1 sec and get total samplerate from total y value 
yi_t=interp1(xxo,yb,xxi,'linear'); 

plot(yi_t) 
相关问题