1 / 10

Phase Vocoder

Phase Vocoder. Colter McQuay. Phase Vocoder Structure. Input x[ nTs ]. Analyze. Effect Specific Code. Synthesize. Output y[ nTs ]. Time Stretch Effect. %% Load Signal From File [ x Fs]= wavread ('../x1.wav'); x=x(:,1 )'; % Convert to mono windowSize =2048 ; % Set up window Size

zlhna
Télécharger la présentation

Phase Vocoder

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Phase Vocoder Colter McQuay

  2. Phase Vocoder Structure Input x[nTs] Analyze Effect Specific Code Synthesize Output y[nTs]

  3. 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

  4. Pitch Shift Effect Pitch Shifted by 0.7 %% 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

  5. 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 [pRowspCols]=size(phase); % Set new phases to zero phase=zeros(pRows,pCols); % Reconstruct Output Signal y=pvSynthesize(mag,phase,synthHop,anHop,1); Window = 1024 Hop=512 Window = 512 Hop=128

  6. Whisperization 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 [pRowspCols]=size(phase); % De-Correlate phases by randomizing phase=2*pi*rand(pRows,pCols); % Reconstruct Output Signal y=pvSynthesize(mag,phase,synthHop,anHop,1);

  7. 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); [pRowspCols]=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 fori = 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); Original Pad & Drums Transient Components Stable Components

  8. Filter Filtered Signal %% 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 [mRowsmCols]=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);

  9. 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); Noisy Signal De-Noised Signal

  10. Questions?

More Related