pitchshiftdelaylinemodulation.m

来自「matlab code, discrete time processing vv」· M 代码 · 共 57 行

M
57
字号
% Pitch shift delay line modulation 

close all
clear all

BLen = 1024; %block length
freq_sawtooth=-30; %pitch change variable (negative rases pitch)
Width=0.01;

[x,fs,bit]=wavread('Brass_Jazz.wav');

% creating the window
ind = (1:length(x))'*2*pi/BLen;
Wa =(1-cos(ind))/2;

%plot(w)

% makes 2 copies of input file
An=x(1:length(x));
Bn=x(1+BLen/2:length(x));

% applies varring delay
An_y=Delayline(An,fs,freq_sawtooth,Width,BLen);
Bn_y=Delayline(Bn,fs,freq_sawtooth,Width,BLen);
    
% applies windowing to modified input
An_Win=An_y.*Wa(1:length(An_y));
Bn_Win=Bn_y.*Wa(1:length(Bn_y));

% stores modifed input in buffer
y_a=An_Win;
y_b=[1,length(x)]*0;
y_b(1+BLen/2:length(x))=Bn_Win;

% combines the two buffers 
y=y_a+y_b';

%wavwrite(y,fs,'7_4_3_DelayLine_HIGH.wav');
%wavwrite(y,fs,'7_4_3_DelayLine_LOW.wav');


% figure
% plot(abs(fft(x)),'b')
% hold
% plot(abs(fft(y)),'r')
% hold off

figure (2)
plot(x,'b')
hold
plot(y,'r')
hold off

% figure
% plot(y_a)
% figure
% plot(y_b)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?