我最近试图执行此处发现的星号探测法,即:Derivation and Combfilter算法1:。
我不敢肯定,如果我没有取得良好结果,我会成功执行。 我很想知道,有人是否成功地或只是为了想要普遍帮助的好人而执行了这一规定。 我在此执行:
//Cycle through Tempo s (60 to 200) incrementing each time by 10
for (int i = (int)mintempo; i <= maxtempo; i += 10)
{
//Clear variables to be used
curtempo = i;
fftPulse.Clear();
offset = 0;
energy = 0;
short[] prevBuffer = null;
//Calculate ti
ti = (60 / curtempo) * 44100;
ti = Math.Round(ti, 0);
//Generate pulse train
for (int j = 0; j < pulseTrain.Length; j++)
{
if ((j % ti) == 0)
pulseTrain[j] = short.MaxValue;
else
pulseTrain[j] = 0;
}
//Compute FFT of the pulseTrain array
while (offset < pulseTrain.Length)
{
//Generate block samples (1024 is my blocksize)
short[] fftPulseBuffer = new short[po.blocksize / 2];
//Store samples from pulseTrain in a 1024 block buffer for passing to the FFT algorithm
index = 0;
for (int j = offset; j < (offset + (po.blocksize / 2)) && j < pulseTrain.Length; j++)
{
fftPulseBuffer[index] = pulseTrain[j];
index++;
}
//Initialize prevBuffer, which contains samples from the previous block, used in conjunction with the current block for the FFT
if (prevBuffer == null)
prevBuffer = new short[po.blocksize / 2];
//Calculate the FFT using the current and previous blocks
fftPulse.Add(CalculateFFT(fftPulseBuffer,prevBuffer));
//Set prevBuffer and increment to next block start position
prevBuffer = fftPulseBuffer;
offset += (po.blocksize / 2);
}
//Calculate energy
for (int j = 0; j < intendomainarr.Count; j++)
{
double[] signalarr = intendomainarr[j];
double[] pulsearr = fftPulse[j];
for (int x = 0; x < signalarr.Length; x++)
{
energy += Math.Abs(signalarr[x] * pulsearr[x]);
}
}
//Get current best tempo match
if (energy > maxenergy)
{
chosentempo = curtempo;
maxenergy = energy;
}
}
我获得的结果总是很高,通常大约为190和200BPM,如果是NOT,那么情况就是如此,因为我的S.wav档案只有60-120BPM之间有节奏。
请注意,我正在使用“WAV”档案(44.1Khz, 16-bit, Mono),这样一些公式就作了修改(即计算能源),只用一个渠道开展工作。 我要确认,在执行我方面是否有任何差异? 我并不担心FFT部分,因为我正在为此使用一个图书馆。
非常感谢!