【问题标题】:Note detection with processing and minim带处理和最小化的音符检测
【发布时间】:2013-04-20 19:44:21
【问题描述】:

我正在尝试创建一个能够检测乐器(吉他)音符的处理应用程序。例如,如果播放打开的“A”音符,我想做一些基于它的事情,比如在屏幕上显示音符或显示图像。

我被卡住了,不确定我是否做得对或如何继续。据我了解,我需要获得基频?如果是这样,我该如何得到它?似乎当我现在弹奏一个音符时,随着音符的进行,草图会显示出一堆不同的频率。我是否应该只尝试获取音符的开头或其他内容?

如果你看不出来,我是新手,所以要温柔;)这是我目前所拥有的:

/* sketch to measure frequencies */

import ddf.minim.analysis.*;
import ddf.minim.*;

Minim minim;
AudioInput in;
FFT fft;

void setup()

{
  size(512, 200, P3D);
  minim = new Minim(this);

  in = minim.getLineIn(Minim.STEREO, 2048);

  // create an FFT object that has a time-domain buffer 
  // the same size as jingle's sample buffer
  // note that this needs to be a power of two 
  // and that it means the size of the spectrum
  // will be 512. see the online tutorial for more info.
  fft = new FFT(in.bufferSize(), 44100);
}

void draw()
{
  background(0);
  stroke(255);
  // perform a forward FFT on the audip that's coming in
  fft.forward(in.mix);
  for(int i = 0; i < fft.specSize(); i++)
  {
    // draw the line for frequency band i, scaling it by 4 so we can see it a bit better
    line(i, height, i, height - fft.getBand(i) * 4);
    //print out the frequency. Am I supposed to be multiplying the value by 2048?
    println( (fft.getFreq(i) * 2048)); 
  }

  fill(255);

}


void stop()
{
  // always close Minim audio classes when you finish with them
  in.close();
  minim.stop();
  super.stop();
}

【问题讨论】:

  • 我认为您需要对音高检测的基础知识进行更多研究。试试维基百科、关于 SO 的其他问题或这篇博文:blog.bjornroche.com/2012/07/…
  • 谢谢比约恩。这看起来是一篇很棒的文章。我会阅读它并尝试学习尽可能多的理论。但是,我不会用 C 编写代码。你有什么建议可以让我在这个过程中前进吗?
  • 博文中的 C 代码示例与您在 Java/Processing 中所做的任何事情都非常相似,并且概念是相同的。

标签: signal-processing processing minim


【解决方案1】:

请勿使用裸 FFT 进行吉他音高估计。甚至是一个窗口的。不要使用上面的 bjorneroche 博客文章。

FFT 峰值检测器对于主要由泛音组成的声音(例如大多数音乐中的声音)效果不佳。请改用更稳健的音高检测/估计方法,例如 RAPT、YAAPT、自相关变体、谐波积谱或倒谱/倒谱方法。

【讨论】:

  • 嗨,Hotpaw2!你能举一个处理的具体例子吗?或者处理只是不是用于此的程序?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-02
  • 2013-07-07
相关资源
最近更新 更多