fft

Real time pitch detection

喜你入骨 提交于 2019-12-17 07:05:50
问题 I'm trying to do real time pitch detection of a users singing, but I'm running into alot of problems. I've tried lots of methods, including FFT (FFT Problem (Returns random results)) and autocorrelation (Autocorrelation pitch detection returns random results with mic input), but I can't seem to get any methods to give a good result. Can anyone suggest a method for real-time pitch tracking or how to improve on a method I already have? I can't seem to find any good C / C++ methods for real time

fft,ntt总结

a 夏天 提交于 2019-12-17 06:46:48
一个套路:把式子推成卷积形式,然后用fft或ntt优化求解过程。 fft的扩展性不强,不可以在fft函数里多加骚操作--DeepinC T1:多项式乘法 板子题 T2:快速傅立叶之二 另一个板子,小技巧:把一个数组反转过来,以符合卷积形式 T3:力 拆式子,把q j 除到左边,然后把大于j的贡献和小于j的贡献分开考虑,对于小于j的,直接用fft统计,对于大于的,先反转再fft T4:Normal 大神题,考虑把贡献拆成点对,对于两个点i与j,若i能对j作出贡献,则i到j的路径上没有断点,同样删除i到j路径以外的点不影响i与j之间的贡献,则i对j作出贡献的概率为 $\frac{1}{dis(i,j)}$则答案即为$\sum\limits_{i=1}^{n}\sum \limits_{j=1}^{n}\frac{1}{dis(i,j)}$ 然后这玩意可以用点分治求,合并子树用fft优化 1 #include<bits/stdc++.h> 2 #define N 70050 3 #define LL long long 4 const int mod=998244353,G1=3,G2=(mod+1)/G1; 5 #define cri const register int 6 using namespace std; 7 int a[N],b[N]; 8 int n; 9 int he

[学习笔记]FFT

好久不见. 提交于 2019-12-16 23:07:11
转载 大佬的博客 # include <cstdio> # include <cmath> const int MAXN = 3000005 ; const double pi = acos ( - 1.0 ) ; int read ( ) { int num = 0 , flag = 1 ; char c ; while ( ( c = getchar ( ) ) < '0' || c > '9' ) if ( c == '-' ) flag = - 1 ; while ( c >= '0' && c <= '9' ) num = ( num << 3 ) + ( num << 1 ) + ( c ^ 48 ) , c = getchar ( ) ; return num * flag ; } int n , m , len ; struct complex { double x , y ; complex ( ) { } complex ( double X , double Y ) : x ( X ) , y ( Y ) { } complex operator + ( const complex & R ) const { return complex ( x + R . x , y + R . y ) ; } complex operator - ( const

Using the Apple FFT and Accelerate Framework

社会主义新天地 提交于 2019-12-16 20:14:30
问题 Has anybody used the Apple FFT for an iPhone app yet or know where I might find a sample application as to how to use it? I know that Apple has some sample code posted, but I'm not really sure how to implement it into an actual project. 回答1: I just got the FFT code working for an iPhone project: create a new project delete all the files except for main.m and xxx_info.plist going to project settings and search for pch and stop it from trying to load a .pch (seeing as we have just deleted it)

多项式总结(STAGE 1)

情到浓时终转凉″ 提交于 2019-12-16 10:53:47
这么难的专题居然只给了这么短时间。。。 然而在NC的教导之下还是有一定的收获的。 必须打广告: 0 , 1 , 2 , 3 附带一个垃圾博客: -1 按照习惯,堆砌结论而不加证明。 Section1 导数: 基本形式:$f'(x)=\lim\limits_{\Delta x\rightarrow 0}\frac{f(x+\Delta x)-f(x)}{\Delta x}$ 一次函数:$f(x)=ax+b \rightarrow f'(x)=a$ 幂函数:$f(x)=x^n \rightarrow f'(x)=nx^{n-1}$ 正弦函数:$\lim\limits_{x \rightarrow 0}sin(x)=x $,得到$f(x)=sin(ax+b) \rightarrow f'(x)=a \ cos(ax+b)$ 余弦函数:$\lim\limits_{x \rightarrow 0}cos(x)=1 $,得到$f(x)=cos(ax+b) \rightarrow f'(x)=-a \ sin(ax+b)$ 指数函数:$e=\lim\limits_{n \rightarrow + \infty} (1+ \frac{1}{n})^n$,得到$f(x)=a^x \rightarrow f'(x)=a^x ln \ a$   特别的,自然对数的指数函数:$f(x)=e^x

多项式fft、ntt、fwt 总结

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-16 06:53:08
做了四五天的专题,但是并没有刷下多少题。可能一开始就对多项式这块十分困扰,很多细节理解不深。 最简单的形式就是直接两个多项式相乘,也就是多项式卷积,式子是$N^2$的。多项式算法的过程就是把卷积做一种变换,在变换后各系数相称得到新系数。其实这一步变换的构造过程挺深奥的,并不是很会。对于多项式卷积的变换就是点值。于是就有了快速变换这样的算法。 细节问题出过很多。边界的问题容易弄错。一般如果是两个N项多项式相乘,得到的是一个$2*N-1$项的多项式,这是存在系数的,只不过一般我们只要N项的结果,所以做fft、ntt的时候总项数从$2*N$开始计算。其实这样解释比较牵强,但是原理的解释我并不清楚,稍感性理解。 多项式卷积应该化成类似i+j=k的形式,其实差值为k也是可以卷积的(翻转一个序列,这样得到的结果序列也是反的)。 fwt处理位运算形式的卷积,同样分治法。位运算是针对下标的,分治的时候考虑好左右两半的子答案的贡献。 多项式全家桶,基础是求导、积分。有时候一些式子不是直接两个相乘得到另一个,可能还要先求出逆元再变回去。这时候用到的就是关于多项式的各种运算。 具体的题目好多是和卷积、“各种数和各种反演”有关,把式子化成卷积形式进行优化。 没有时间写每个题解了,做题也很少,好多东西还没学。这块综合了不少东西,前置内容就有很多。 可能多项式要咕一大截了,难受。 来源: https:/

分治FFT/NTT

那年仲夏 提交于 2019-12-14 15:35:09
考虑对当前左区间对右区间的贡献,由于右区间的F未更新,可以更改指标 \begin{array}{rcl} F_x&=&\sum\limits_{i=L}^{mid}F_iG_{x-i} \\ &=&\sum\limits_{i=L}^{x}F_iG_{x-i} \\ &=&\sum\limits_{i=0}^{x-L}F_{L+i}G_{x-L-i} \end{array} 设$A_i=F_{i+L},B_i=G_i$ \begin{array}{rcl} F_x=C_{x-L}=\sum\limits_{i=0}^{x-L}A_iB{x-L-i} \end{array} 模板: 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<cmath> 5 #define ll long long 6 #define reg register 7 #define F(i,a,b) for(register int (i)=(a);(i)<=(b);++(i)) 8 using namespace std; 9 int read(); 10 const int N=400005; 11 const ll mod=998244353ll; 12 int n,h,cs; 13 int rev[N]; 14

KissFFT forward / inverse is outputting noise, why?

两盒软妹~` 提交于 2019-12-14 04:17:08
问题 I'm trying to use KissFFT natively in a java app, but the forward/inverse of an input signal isn't returning as it should: the signal amplitude is almost non-existent. If I remove the scaling factor (dividing by 2N), the result is harmonic noise. Can anyone spot the bug? Here is the forward call (copied from GDX, so should be ok!): JNIEXPORT void JNICALL Java_com_badlogic_gdx_audio_analysis_KissFFT_spectrum(JNIEnv* env, jclass clazz, jlong handle, jshortArray obj_samples, jfloatArray obj

play stat -freq What does the output mean?

僤鯓⒐⒋嵵緔 提交于 2019-12-14 03:23:05
问题 What does the output of play $file stat -freq mean? I recently ran the command, here's a sample of the output: $ play 44100Hz/3660/6517/3660-6517-0024.flac stat -freq 44100Hz/3660/6517/3660-6517-0024.flac: File Size: 214k Bit Rate: 325k Encoding: FLAC Info: Processed by SoX Channels: 1 @ 16-bit Samplerate: 44100Hz Replaygain: off Duration: 00:00:05.28 In:0.00% 00:00:00.00 [00:00:05.28] Out:0 [ | ] Clip:0 0.000000 0.412632 10.766602 0.430416 21.533203 0.750785 32.299805 0.839694 43.066406 0

Implementing 2D inverse fourier transform using 1D transforms

末鹿安然 提交于 2019-12-14 02:33:29
问题 I am trying to implement, in Python, some functions that transform images to their Fourier domain and vice-versa, for image processing tasks. I implemented the 2D-DFT using repeated 1D-DFT, and it worked fine, but when I tried to implement 2D inverse DFT using repeated inverse 1D-DFT, some weird problem occurred: when I transform an image to its Fourier domain and then back to the image domain, it looks like the image was reflected and merged with its reflection, as can be seen here: This is