Java 用最小值定义频带

Java 用最小值定义频带,java,fft,minim,Java,Fft,Minim,我正在使用一个Minim BeatDetect对象来分析传入的麦克风信号。BeatDetect使用FFT 在BeatDetect类中,有四个感兴趣的函数:isHat()、isKick()、isSnare()和isRange(int,int,int)。前三个是isRange()的自定义版本。我试着做的是识别不仅仅是帽子、踢腿和圈套鼓 为了做到这一点,我需要理解方法isHat()、isKick()和isSnare()中的数学知识。我希望这里有人能帮我。下面是4个函数的代码 /** * In fre

我正在使用一个Minim BeatDetect对象来分析传入的麦克风信号。BeatDetect使用FFT

在BeatDetect类中,有四个感兴趣的函数:
isHat()
isKick()
isSnare()
isRange(int,int,int)
。前三个是
isRange()
的自定义版本。我试着做的是识别不仅仅是帽子、踢腿和圈套鼓

为了做到这一点,我需要理解方法
isHat()
isKick()
isSnare()
中的数学知识。我希望这里有人能帮我。下面是4个函数的代码

/**
 * In frequency energy mode this returns true if a beat corresponding to the
 * frequency range of a kick drum has been detected. This has been tuned to
 * work well with dance / techno music and may not perform well with other
 * styles of music. In sound energy mode this always returns false.
 * 
 * @return boolean: true if a kick drum beat has been detected
 * 
 * @example Analysis/FrequencyEnergyBeatDetection
 * 
 * @related BeatDetect
 */
public boolean isKick()
{
    if (algorithm == SOUND_ENERGY)
    {
        return false;
    }
    int upper = 6 >= spect.avgSize() ? spect.avgSize() : 6;
    return isRange(1, upper, 2);
}

/**
 * In frequency energy mode this returns true if a beat corresponding to the
 * frequency range of a snare drum has been detected. This has been tuned to
 * work well with dance / techno music and may not perform well with other
 * styles of music. In sound energy mode this always returns false.
 * 
 * @return boolean: true if a snare drum beat has been detected
 * 
 * @example Analysis/FrequencyEnergyBeatDetection
 * 
 * @related BeatDetect
 */
public boolean isSnare()
{
    if (algorithm == SOUND_ENERGY)
    {
        return false;
    }
    int lower = 8 >= spect.avgSize() ? spect.avgSize() : 8;
    int upper = spect.avgSize() - 1;
    int thresh = (upper - lower) / 3 + 1;
    return isRange(lower, upper, thresh);
}

/**
 * In frequency energy mode this returns true if a beat corresponding to the
 * frequency range of a hi hat has been detected. This has been tuned to work
 * well with dance / techno music and may not perform well with other styles
 * of music. In sound energy mode this always returns false.
 * 
 * @return boolean: true if a hi hat beat has been detected
 * 
 * @example Analysis/FrequencyEnergyBeatDetection
 * 
 * @related BeatDetect
 */
public boolean isHat()
{
    if (algorithm == SOUND_ENERGY)
    {
        return false;
    }
    int lower = spect.avgSize() - 7 < 0 ? 0 : spect.avgSize() - 7;
    int upper = spect.avgSize() - 1;
    return isRange(lower, upper, 1);
}

/**
 * In frequency energy mode this returns true if at least
 * <code>threshold</code> bands of the bands included in the range
 * <code>[low, high]</code> have registered a beat. In sound energy mode
 * this always returns false.
 * 
 * @param low
 *           int: the index of the lower band
 * @param high
 *           int: the index of the higher band
 * @param threshold
 *           int: the smallest number of bands in the range
 *           <code>[low, high]</code> that need to have registered a beat
 *           for this to return true
 * @return boolean: true if at least <code>threshold</code> bands of the bands
 *         included in the range <code>[low, high]</code> have registered a
 *         beat
 *         
 * @related BeatDetect
 */
public boolean isRange(int low, int high, int threshold)
{
    if (algorithm == SOUND_ENERGY)
    {
        return false;
    }
    int num = 0;
    for (int i = low; i < high + 1; i++)
    {
        if (isOnset(i))
        {
            num++;
        }
    }
    return num >= threshold;
}
我希望通过操纵上述方法,能够准确识别各种乐器的节拍。有人能教我认识到这一点需要什么吗

目前,我了解如果在指定的频带范围内检测到节拍,函数返回
true
。我不明白的是,为什么函数中的参数值[低、高、阈值]与特定仪器相关。谢谢你的意见