stpt.m
Go to the documentation of this file.
1 function y= stpt(x,w,N,H,t)
2 M=length(w); % Window size
3 pin=0; % Start pointer
4 pend=length(x)-M; % End pointer
5 y=zeros(1,length(x)); % Inicial. output
6 npeaks=0; % Number of peaks
7 w=w./sum(w); % Analy. Windw. Norm.
8 w_out=hanning(M)'; % Synthesis window.
9 w_out=w_out./sum(w_out); % Synth. Windw. Norm.
10 while(pin<pend) % Until the end...
11  %---Analysis
12  x_w=x(pin+1:pin+M).*w(1:M); % Windowing signal
13  fftbuffer=[x_w, zeros(1,N-M)]; % Zero-padding
14  fftbuffer=circshift(fftbuffer,[0,-(M-1)/2]);% Zero-phase shift
15  X=fft(fftbuffer,N); % FFT
16  Xmag=20*log10(abs(X(1:N/2+1))); % Magnitude in dBs
17  Xphase=unwrap(angle(X(1:N/2+1))); % Phase
18  %---Transformation Xmag and Xphase
19  ploc = 1+find((Xmag(2:N/2)>t).*(Xmag(2:N/2)>Xmag(3:N/2+1)).*(Xmag(2:N/2)>Xmag(1:N/2-1))); % Find the local max.
21  pphase=Xphase(ploc); % Save phase values
22  pmag=Xmag(ploc); % Save mag. values
23  %plot_peaks(Xmag,Xphase,ploc,t); % Plotting peaks
24  Xmag=zeros(1,N/2+1)-1000; % Modifying Xmag...
25  Xphase=zeros(1,N/2+1); % Modifying Xphase...
26  %ploc=round(ploc.*0.96); % Transposition (fx)
27  %ploc=10:10:10*length(ploc); % Harmonics mapping(fx)
28  Xmag(ploc)=pmag; % Add the mag maxs.
29  Xphase(ploc)=pphase; % Add the phase maxs.
30  %---Synthesis
31  Y(1:N/2+1) = 10.^(Xmag/20).*exp(1i.*Xphase);% Generate posit. freq.
32  Y(N/2+2:N) = conj(fliplr(Y(2:N/2))); % Generate negat. freq
33  fftbuffer_out=real(ifft(Y)); % Clean the signal
34  fftbuffer_out=circshift(fftbuffer_out,[0,+(M-1)/2]);
35  % Undo zero-phasing
36  y(pin+1:pin+M)=y(pin+1:pin+M)+H*N*fftbuffer_out(1:M).*w_out;
37  % Overlap-add method
38  pin=pin+H; % Advance pointer
39 end
static int shift(int a, int b)
Definition: sonic.c:86
if max(w)>1 w=0.9 *w/max(w)
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
Definition: git-howto.txt:5
N, 1 zeros()
id H()
Inicial output npeaks
Definition: stpt.m:6
Save phase values pmag
Definition: stpt.m:22
function y
Definition: stpt.m:1
#define M(a, b)
Definition: vp3dsp.c:43
end end
Save mag values plot_peaks(Xmag, Xphase, ploc, t)
#define N
Definition: vf_pp7.c:200
Analy Windw Norm w_out
Definition: stpt.m:8
Number of peaks w
Definition: stpt.m:7
Discrete Time axis x
Generate negat freq fftbuffer_out
Definition: stpt.m:33
Start pointer pend
Definition: stpt.m:4
#define zero
Definition: regdef.h:64
fftbuffer, [0,-(M-1 circshift()
static av_always_inline av_const double round(double x)
Definition: libm.h:162
overlapping window(triangular window to avoid too much overlapping) ovidx
int size
use a maximum of peaks[f0, f0error]
Sampled sinusoid X
t
Definition: genspecsines3.m:6
Harmonics mapping(fx) Xmag(ploc)
1i.*Xphase exp()
FFT Xmag
Definition: stpt.m:16
mag
Definition: lab5.m:14
synthesis window for stochastic i
Modifying Xphase ploc
Definition: stpt.m:26
Transposition(fx)%ploc
Magnitude in dBs Xphase
Definition: stpt.m:17
fftbuffer, N fft()
Synth Windw Norm while(pin< pend)%Until the end...%---Analysis x_w
Window size pin
Definition: stpt.m:3
these buffered frames must be flushed immediately if a new input produces new output(Example:frame rate-doubling filter:filter_frame must(1) flush the second copy of the previous frame, if it is still there,(2) push the first copy of the incoming frame,(3) keep the second copy for later.) If the input frame is not enough to produce output
Generate posit freq Y(N/2+2:N)
const char int length
Definition: avisynth_c.h:668
pphase
Definition: stpt.m:21
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
Windowing signal fftbuffer
Definition: stpt.m:13