【问题标题】:How can I increase/decrease (frequency/pitch) of signal如何增加/减少信号的(频率/音高)
【发布时间】:2011-04-27 15:48:21
【问题描述】:

如何使用 fft/ifft 增加/减少(频率/音高)和相位

有人告诉我 repmat 和 resample 可能会有所帮助,是的,我想线性移动所有组件。我想随着时间的推移调整相位,以便它产生驻波。一个信号的相位朝一个方向变化,另一个信号的相位朝相反的方向变化

PS:它是在 Octave/matlab 代码中完成的

例如,我有一个每秒重复 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')

【问题讨论】:

  • 如何你想修改每个组件的频率,确切地说?所有组件的固定(即线性)移位?通过常数因子(即对数移位)缩放所有组件?你到底想对这个阶段做什么(以及为什么)?
  • @Paul R 有人告诉我 repmat 和 resample 可能会有所帮助,是的,所有组件的线性移位。我想随着时间的推移调整相位,以便它产生驻波。一个信号的相位朝一个方向变化,另一个信号的相位朝相反的方向变化
  • 好的 - 您可能应该编辑您的问题以包含此信息 - 然后您将更清楚您要实现的目标是什么

标签: matlab octave fft


【解决方案1】:

这是一种方法,但如果信号很大,您可能必须增加信号的点数

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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多