English 中文(简体)
• 帮助实施该次探测算法?
原标题:Help with implementing this beat-detection algorithm?

我最近试图执行此处发现的星号探测法,即: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部分,因为我正在为此使用一个图书馆。

非常感谢!

问题回答

• 绘制能源的地块。

I think you ll find that the harmonics have nearly identical energy to the base signal, and if the actual frequency falls halfway between frequency bins, then the second harmonic s peak is sampled and easily beats the two samples to either side of the true frequency.

你们需要惩罚更高的频率,以克服这种影响。


请注意,虽然C#不是在实际时间或批量处理中采用这种算法的不合理选择,但它对于算法开发和拖.来说是可怕的。 d 我建议使用MatLab(或免费衣帽),以获得算法权,而且只是在处理一些测试案件时,才将该代码改为C#(或C++)。

我不敢肯定,如果有人要这样做,但在这个障碍中,评论不符合守则:

    //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++;
    }

根据《刑法》第512条,第1024条。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签