sinemodel1.m
Go to the documentation of this file.
1 function [y]=sinemodel1(x,w,N,t)
2 %initializing values
3 M = length(w); % window size - the longer the more frequency resolution
4 N2 = N/2+1; % positive part of the spectrum
5 Ns= 1024; % FFT size for synthesis (even)
6 H = 256; % analysis/synthesishop size
8 
9 fftbuffer = zeros(N,1); % initialize buffer for FFT
10 
11 %Create a loop to step through the sound array x
12 %initializing the loop
13 hNs = Ns/2; % half synthesis window size
14 hM = (M-1)/2; % half analysis window size used to overlap windows
15 
16 pin = max(H+1,1+hM); % initialize sound pointer to middle of analysis window
18 
19 y = zeros(soundlength,1); % initialize output array
20 w = w/sum(w); % normalize analysis window
21 sw = zeros(Ns,1);
22 ow = triang(2*H-1); % overlapping window
23 ovidx = Ns/2+1-H+1:Ns/2+H; % overlap indexes
24 sw(ovidx) = ow(1:2*H-1);
25 bh = blackmanharris(Ns); % synthesis window
26 bh = bh ./ sum(bh); % normalize synthesis window
27 sw(ovidx) = sw(ovidx) ./ bh(ovidx);
28 
30  xw = x(pin-hM:pin+hM).*w(1:M)'; % window the input sound - STFT definition
31 
32  %zero phased window
33  fftbuffer(:) = 0; % reset buffer
34  fftbuffer(1:(M+1)/2) = xw((M+1)/2:M); % zero-phase fftbuffer
35  fftbuffer(N-(M-1)/2+1:N) = xw(1:(M-1)/2);
36 
37  %compute FFT of the zero phased frame
38  X = fft(fftbuffer);
39 
40  %calculate magnitude and phase spectrum of of positive frequencies
41  mX = 20*log10(abs(X(1:N2)));
42  pX = unwrap(angle(X(1:N2)));
43 
44 
45  %Find the locations, ploc, of the local maxima above a given
46  %threshold, t, in each magnitude spectrum by finding changes of slope.
47  ploc = 1+find((mX(2:N2-1)>t).*(mX(2:N2-1)>mX(3:N2)).*(mX(2:N2-1)>mX(1:N2-2)));
48 
49  %Find the magnitudes, pmag, and phases, pphase, of the obtained
50  %locations.
51  pmag = mX(ploc);
52  %pmag = mX(ploc)*0.4;
53  pphase = pX(ploc);
54 
55 
56  %peak interpolation
57  [iploc, ipmag, ipphase] = peakinterp (mX, pX, ploc);
58 
59 
60  %plot for a window
61  if (pin==1+hM+20*H)
62  figure
63  subplot(2,1,1)
64  plot(mX)
65  hold on
66  plot(iploc,mX(ploc),'*')
67  title('magnitude and peak values');
68  hold off
69  subplot(2,1,2)
70  plot(pX)
71  hold on
72  plot(iploc,pX(ploc),'*')
73  title('phase and peak values');
74  hold off
75 
76  %number of peaks
77  npeaksm = length(pmag)
78  npeaksp = length(pphase)
79  end
80 
81 
82  %-----synthesis-----%
83 plocs = (ploc-1)*Ns/N+1; % adapt peak locations to synthesis FFT
84 Y = genspecsines(plocs,pmag,pphase,Ns); % generate spec sines
85 yw = fftshift(real(ifft(Y))); % time domain of sinusoids
86 y(pin-hNs:pin+hNs-1) = y(pin-hNs:pin+hNs-1)+ sw.*yw(1:Ns); % overlap-add
87 pin = pin+H; % advance the sound pointer
88 
89 end
90 end
Definition: start.py:1
normalize analysis window sw
Definition: sinemodel1.m:21
magnitude spectrum pX
Definition: stft_peak.m:24
if max(w)>1 w=0.9 *w/max(w)
title('Sinusoid at 1/4 the Spampling Rate')
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
overlapping window ovidx
Definition: sinemodel1.m:23
plot(ejex, abs(X3),'*')
initialize sound pointer to middle of analysis window pend
Definition: sinemodel1.m:17
function ploc
Interpolated time axis hold on
#define sample
FFT of current buffer mX
Definition: stft_peak.m:23
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 please avoid problems through this extra level of scrutiny For cosmetics only commits you should e g by running git config global user name My Name git config global user email my email which is either set in your personal configuration file through git config core editor or set by one of the following environment VISUAL or EDITOR Log messages should be concise but descriptive Explain why you made a what you did will be obvious from the changes themselves most of the time Saying just bug fix or is bad Remember that people of varying skill levels look at and educate themselves while reading through your code Don t include filenames in log Git provides that information Possibly make the commit message have a descriptive first an empty line and then a full description The first line will be used to name the patch by git format patch Renaming moving copying files or contents of making those normal commits mv cp path file otherpath otherfile git add[-A] git commit Do not rename or copy files of which you are not the maintainer without discussing it on the mailing list first Reverting broken commits git revert< commit > git revert will generate a revert commit This will not make the faulty commit disappear from the history git reset< commit > git reset will uncommit the changes till< commit > rewriting the current branch history git commit amend allows to amend the last commit details quickly git rebase i origin master will replay local commits over the main repository allowing to merge or remove some of them in the process Note that the reset
Definition: git-howto.txt:153
half synthesis window size hM
Definition: sinemodel1.m:14
initialize buffer for FFT Create a loop to step through the sound array x initializing the loop hNs
Definition: sinemodel1.m:13
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
#define M(a, b)
Definition: vp3dsp.c:43
pphase
Definition: stft_peak.m:27
#define H
Definition: swscale-test.c:342
#define Y
Definition: vf_boxblur.c:76
end end
function magnitudes and phases
figure
Definition: genspecsines2.m:3
Plot spectral magnitude
analysis synthesishop size soundlength
Definition: sinemodel1.m:7
#define N2
Definition: vf_pp7.c:196
frame
Definition: stft.m:14
Discrete Time axis x
FFT size for synthesis(even) H
#define zero
Definition: regdef.h:64
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 input
phase spectrum(unwrapped) ploc
overlapping window(triangular window to avoid too much overlapping) ovidx
FFmpeg Automated Testing Environment ************************************Table of Contents *****************FFmpeg Automated Testing Environment Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass target exec to configure or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script tests fate sh from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at doc fate_config sh template Create a configuration that suits your based on the configuration template The slot configuration variable can be any string that is not yet used
Definition: fate.txt:34
initialize buffer for FFT yw
Definition: gong.m:13
id N()
int size
clear max peak[Mmag2, Mloc2]
Definition: extra/TWM.m:16
use a maximum of peaks[f0, f0error]
Sampled sinusoid X
t
Definition: genspecsines3.m:6
MUSIC TECHNOLOGY GROUP UNIVERSITAT POMPEU FABRA Free Non Commercial Binary License Agreement UNIVERSITAT POMPEU OR INDICATING ACCEPTANCE BY SELECTING THE ACCEPT BUTTON ON ANY DOWNLOAD OR INSTALL YOU ACCEPT THE TERMS OF THE LICENSE SUMMARY TABLE Software MELODIA Melody Extraction vamp plug in Licensor Music Technology Group Universitat Pompeu Plaça de la Spain Permitted purposes Non commercial internal research and validation and educational purposes only All commercial uses in a production either internal or are prohibited by this license and require an additional commercial exploitation license TERMS AND CONDITIONS SOFTWARE Software means the software programs identified herein in binary any other machine readable any updates or error corrections provided by and any user programming guides and other documentation provided to you by UPF under this Agreement LICENSE Subject to the terms and conditions of this UPF grants you a royalty non non non limited for the specified duration in to reproduce and use internally Software complete and unmodified for the purposes indicated in the Summary Table CONDITIONS The Software is confidential and copyrighted You may make one backup copy Unless enforcement is prohibited by applicable law and other than as expressly provided in the Table above
sound(x3, Fs)
subplot(3, 1, 1)
static int loop
Definition: ffplay.c:305
static av_always_inline int even(uint64_t layout)
function ipmag
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted then it is pulled from the input slice through the input converter and horizontal scaler The result is also stored in the ring buffer to serve future vertical scaler requests When no more output can be generated because lines from a future slice would be then all remaining lines in the current slice are horizontally scaled and put in the ring buffer[This is done for luma and chroma, each with possibly different numbers of lines per picture.] Input to YUV Converter When the input to the main path is not planar bits per component YUV or bit it is converted to planar bit YUV Two sets of converters exist for this the other leaves the full chroma resolution
Definition: swscale.txt:33
half analysis window size used to overlap windows pin
Definition: sinemodel1.m:16
N, 1 zeros()
initialize output array w
Definition: sinemodel1.m:20
last sample to start a frame y
Definition: sinemodel1.m:19
function pmag
fftbuffer, N fft()
Synth Windw Norm while(pin< pend)%Until the end...%---Analysis x_w
last sample to start a frame fftbuffer
FFmpeg Automated Testing Environment ************************************Table of Contents *****************FFmpeg Automated Testing Environment Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass target exec to configure or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script tests fate sh from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at doc fate_config sh template Create a configuration that suits your based on the configuration template The slot configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern< arch >< os >< compiler >< compiler version > The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the fate_recv variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ssh command with one or more v options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory FATE makefile targets and variables *************************************Makefile can be set to
Definition: fate.txt:142
function ipphase
bh
Definition: sinemodel1.m:25
1:W2 xw()
magnitude of bin at right iploc
the buffer and buffer reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFilterBuffer structures They must not be accessed but through references stored in AVFilterBufferRef structures Several references can point to the same buffer
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
ow
Definition: sinemodel1.m:22
Filter the word “frame” indicates either a video frame or a group of audio samples
positive part of the spectrum Ns
Definition: sinemodel1.m:5
const char int length
Definition: avisynth_c.h:668
for(j=16;j >0;--j)
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
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