Download presentation
Presentation is loading. Please wait.
2
Phase Vocoder Colter McQuay
3
Phase Vocoder Structure Input x[nTs] Effect Specific Code Synthesize Output y[nTs] Analyze
4
Time Stretch Effect % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono windowSize=2048;% Set up window Size stretchRatio=2.5;% Our time Stretch Ratio anHop=128;% Analysis Hop Size % Calculate Synthesis Hop Size based on ratio synthHop=round(anHop*stretchRatio); % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); % Generate output (don’t modify phase or % magnitudes) y=pvSynthesize(mag,phase,synthHop,anHop,1); Tom’s Diner Original Stretched by 2.5 Compressed by 0.5 Audacity Time Stretch
5
Pitch Shift Effect % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono windowSize=2048;% Set up window Size pitchRatio=0.7;% Our pitch shift Ratio anHop=256;% Analysis Hop Size % Calculate Synthesis Hop Size based on ratio synthHop=round(anHop*pitchRatio); % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); % Generate output (don’t modify phase or % magnitudes) y=pvSynthesize(mag,phase,synthHop,anHop,1); % Resample output to make pitch shifted % version of input y=resample(y,anHop,synthHop); Pitch Shifted by 1.4 Pitch Shifted by 0.7
6
Robotization % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono windowSize=512;% Set up window Size anHop=128;% Analysis Hop Size synthHop=anHop;% Synthesis Hop Size % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); % Get size of phase array [pRows pCols]=size(phase); % Set new phases to zero phase=zeros(pRows,pCols); % Reconstruct Output Signal y=pvSynthesize(mag,phase,synthHop,anHop,1); Window = 512 Hop=128 Window = 1024 Hop=512
7
Whisperization % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono windowSize=512;% Set up window Size anHop=128;% Analysis Hop Size synthHop=anHop;% Synthesis Hop Size % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); % Get size of phase array [pRows pCols]=size(phase); % De-Correlate phases by randomizing phase=2*pi*rand(pRows,pCols); % Reconstruct Output Signal y=pvSynthesize(mag,phase,synthHop,anHop,1); Whisperization
8
Isolation of Stable & Transient Components % SOUND FILE [x Fs]=wavread('../stableTest.wav'); x=x(:,1)'; windowSize=1024; anHop=512; synthHop=anHop; %Analyze Input Signal [mag phase]=pvAnalyze(x,windowSize,anHop); [pRows pCols]=size(phase); % Set Threshold thresh=.5; % Pre-allocate new phase and magnitude arrays newPhase=zeros(pRows,pCols); newMag=zeros(pRows,pCols); % make first window of new phase array equal to original phase newPhase(1,:)=phase(1,:); % nominal phase increment for each bin omega_k=2*pi*[0:pCols-1]./pCols; % Iterate through all windows for i = 2:pRows % Calculate the target phase for each bin based on previous phase target_phase=phase(i-1,:)+omega_k*anHop; % Calculate deviation from the target phase deviation_phase=princarg(phase(i,:)-target_phase); % Set all bins either outside or inside the threshold to zero % NOTE: if abs(deviation_phase)<thresh is used, the stable components % will be kept. If abs(deviation_phase)>thresh the transient % components will be kept newPhase(i,:)=phase(i,:).*(abs(deviation_phase)<thresh); newMag(i,:)=mag(i,:).*(abs(deviation_phase)<thresh); end % Reconstruct output signal y=pvSynthesize(newMag,newPhase,synthHop,anHop,1); Transient Components Original Pad & Drums Stable Components
9
Filter % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono windowSize=2048;% Set up window Size anHop=256;% Analysis Hop Size synthHop=anHop;% Synthesis Hop Size b=[1 -1]; % Filter numerator Coefficients a=[1 -1.7718 0.9009]; % Filter Denominator % Get Frequency Response of Filter filterCoefs=freqz(b,a,windowSize)'; % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); % Get size of magnitude array [mRows mCols]=size(mag); % Multiply the filter frequency response with % The time frequency data in each window for i = 1:mRows mag(i,:)=mag(i,:).*abs(filterCoefs); phase(i,:)=phase(i,:)+angle(filterCoefs); End % Reconstruct Output Signal y=pvSynthesize(mag,phase,synthHop,anHop,1); Filtered Signal
10
De-Noise % Load Signal From File [x Fs]=wavread('../x1.wav'); x=x(:,1)';% Convert to mono noise=0.01*randn(1,length(x)); % Create a noise signal x=x+noise;% Add noise to input windowSize=2048;% Set up window Size anHop=256;% Analysis Hop Size synthHop=anHop;% Synthesis Hop Size % Analyze input signal [mag phase]=pvAnalyze(x,windowSize,anHop); coef=0.0015;% Set up de-noising coefficient f=mag.*exp(j*phase);% Set up frequency vector r = mag/windowSize;% Get r parameter for de-noising newF = f.*r./(r+coef);% Remove noise based on coef newMag=abs(newF);% get new magnitude newPhase=angle(newF);% get new phase % Reconstruct Output Signal y=pvSynthesize(newMag,newPhase,synthHop,anHop,1); De-Noised Signal Noisy Signal
11
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.