1D多峰检测?

Ale*_*pin 5 math matlab speech-recognition graph actionscript-3

我目前正在尝试在AS3中实现基本语音识别.我需要这完全是客户端,因此我无法访问功能强大的服务器端语音识别工具.我的想法是检测一个单词中的音节,并用它来确定所说的单词.我知道这会限制识别的能力,但我只需要识别几个关键词,我可以确保它们都有不同数量的音节.

我现在能够为一个口语单词生成一维语音级别,我可以清楚地看到,如果我以某种方式绘制它,在大多数情况下,音节有明显的峰值.但是,我完全不知道如何找到那些高峰.我只是真的需要计数,但我想这就是找到它们.起初我想抓住一些最大值并将它们与平均值进行比较,但我忘记了那个比其他值更大的峰值,因此,我所有的"峰值"都位于一个实际峰值上.

我偶然发现了一些看起来太短暂无法实现的Matlab代码,但由于我无法将其转换为我所知道的任何语言,因此我无法做到这一点.我试过AS3和C#.所以我想知道你们是否可以在正确的道路上开始我或者有任何用于峰值检测的伪代码?

sch*_*der 4

matlab 代码非常简单。我会尝试将其翻译成更伪代码的东西。

翻译成ActionScript/C#应该很容易,你应该尝试这个,如果你遇到困难,用你的代码发布后续问题,这样你就会有最好的学习效果。

Param: delta (defines kind of a tolerance and depends on your data, try out different values)
min = Inf (or some very high value)
max = -Inf (or some very low value)
lookformax = 1
for every datapoint d [0..maxdata] in array arr do
  this =  arr[d]
  if this > max
    max = this
    maxpos = d
  endif
  if this < min
    min = this
    minpos = d
  endif

  if lookformax == 1
    if this < max-delta
      there's a maximum at position maxpos
      min = this
      minpos = d
      lookformax = 0
    endif
  else
    if this > min+delta
      there's a minimum at position minpos
      max = this
      maxpos = d
      lookformax = 1
    endif
  endif
Run Code Online (Sandbox Code Playgroud)