埃尔米特插值方法的说明 [英] Explanation of Interpolate Hermite method
问题描述
我有现在的got如何随球场的意图重新取样的音频数据运行此赏金。
I've currently got this bounty running on how to resample audio data with the intention of increasing the pitch.
很多解决方案已经做出,我不得不承认,我感觉有点被选择和信息。
Many solutions have been made and I have to admit I'm feeling a bit overwhelmed by the choices and information.
我是针对<一个href=\"http://stackoverflow.com/questions/1125666/how-do-you-do-bicubic-or-other-non-linear-interpolation-of-re-sampled-audio-dat\">this解决方案,发现这个块code的:
I was directed to this solution and found this chunk of code:
public static float InterpolateCubic(float x0, float x1, float x2, float x3, float t)
{
float a0, a1, a2, a3;
a0 = x3 - x2 - x0 + x1;
a1 = x0 - x1 - a0;
a2 = x2 - x0;
a3 = x1;
return (a0 * (t * t * t)) + (a1 * (t * t)) + (a2 * t) + (a3);
}
public static float InterpolateHermite4pt3oX(float x0, float x1, float x2, float x3, float t)
{
float c0 = x1;
float c1 = .5F * (x2 - x0);
float c2 = x0 - (2.5F * x1) + (2 * x2) - (.5F * x3);
float c3 = (.5F * (x3 - x0)) + (1.5F * (x1 - x2));
return (((((c3 * t) + c2) * t) + c1) * t) + c0;
}
这看起来似乎很简单,我可以绕到我头上,但我想知道我怎么输入量我想提高我的球场。我这导致了以下几个问题:
This seems like something simple enough that I can wrap my head around, but I'm wondering how I input the amount I would want to increase my pitch by. Which leads me to the following questions:
-
第一种方法的第t参数采用0和1之间的数字。这是由我增加俯仰的因素是什么?这会让1%100间距的增加(主要是速度提高一倍?)。
The t argument of the first method takes a number between 0 and 1. Is this the factor by which I increase the pitch? Would that make 1 an increase of pitch of %100 (essentially double the speed)?.
如果上面的理论是正确的我只能对输入的更多然后1的一个因素?如果没有,我怎么会能够做到这一点?
If the above theory is correct am I able to input a factor of more then 1? If not, how would I be able to do this?
如果通过说明上面我已经清楚地表明,我完全偏离了轨道会有人帮clairfy使用这种方法我怎么控制间距增加量?
If by stating the above I've clearly shown that I'm totally off track would someone please help clairfy how I control the amount of increase in pitch using this method?
感谢你这么多。
推荐答案
这些是做了以下功能:给定样本的离散序列,它们之间平滑地插入。那就是:假设你的原始数据为x(0),X(1),X(2),等等。你想要的(假设),使其更快1.234倍。那么你要样点x(0)×(1 / 1.234),X(2 / 1.234),X(3 / 1.234),等你想这些看起来像样本通过样品去一个漂亮的光信号指出你。
These are functions that do the following: Given a discrete sequence of samples, interpolate smoothly between them. That is: suppose your original data is x(0), x(1), x(2), etc. You want (let's say) to make it 1.234 times faster. Then you want samples x(0), x(1/1.234), x(2/1.234), x(3/1.234), etc. And you want these to look like samples from a nice smooth signal that goes through the sample points you have.
如下这两个函数应使用。你要X(n)和X(N + 1)之间进行插补。为了让您可以致电X(N + T)的值,叫他们带参数X(N-1),X(N),X(N + 1),X(N + 2)和T。 T = 0时,你会得到X(N); t = 1时,你会得到X(N + 1);你不应该(也许除了在数据的两端)使用不0和1之间的参数。
Both of these functions should be used as follows. You want to interpolate between x(n) and x(n+1). To get a value you can call x(n+t), call them with arguments x(n-1), x(n), x(n+1), x(n+2) and t. When t=0 you'll get x(n); when t=1 you'll get x(n+1); you shouldn't (except maybe at the ends of your data) use arguments that aren't between 0 and 1.
因此,要加快或有时[整数] / [速度系数]你的信号,采样减速;对于每个时间t,取n-1,N,N + 1,N + 2使得n&下; = T&下; = n + 1个,并调用具有值x的内插器(N-1)中,x(n)的中,x(N + 1),X(N + 2)和TN。看看它是如何的声音: - )
So, to speed up or slow down your signal, sample at times [integer]/[speed factor]; for each time t, take n-1,n,n+1,n+2 such that n <= t <= n+1, and call the interpolator with values x(n-1),x(n),x(n+1),x(n+2) and t-n. And see how it sounds :-).
这篇关于埃尔米特插值方法的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!