2011-04-04 104 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) 
相關問題