本文介绍了1D多峰值检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am currently trying to implement basic speech recognition in AS3. I need this to be completely client side, as such I can't access powerful server-side speech recognition tools. The idea I had was to detect syllables in a word, and use that to determine the word spoken. I am aware that this will grealty limit the capacities for recognition, but I only need to recognize a few key words and I can make sure they all have a different number of syllables.

我目前能够产生的声音水平的一维数组的口语,我可以清楚地看到,如果我不知怎么画它,有明显的峰值在大多数的情况下,音节。不过,我完全被卡住,如何我会找出那些山峰。我只真正需要的数量,但我​​想自带的找到他们。起初我以为抓住了几个最大值和他们的平均值比较,但我已经忘了峰值是大于其他人,因此,我所有的峰是位于一个实际的峰值。

I am currently able to generate a 1D array of voice level for a spoken word, and I can clearly see, if I somehow draw it, that there are distinct peaks for the syllables in most of the cases. However, I am completely stuck as to how I would find out those peaks. I only really need the count, but I suppose that comes with finding them. At first I thought of grabbing a few maximum values and comparing them with the average of values but I had forgot about that peak that is bigger than the others and as such, all my "peaks" were located on one actual peak.

我无意中发现了一些Matlab的code ,看起来几乎太短是真实的,但我不能非常是因为我无法将其转换为我知​​道任何语言。我想AS3和C#。所以,我想知道,如果你们可以开始了我在正确的道路上或有任何伪code峰值检测?

I stumbled onto some Matlab code that looks almost too short to be true, but I can't very that as I am unable to convert it to any language I know. I tried AS3 and C#. So I am wondering if you guys could start me on the right path or had any pseudo-code for peak detection?

推荐答案

在MATLAB code是pretty的简单。我会尽力把它翻译到更多的东西伪codeISH。

The matlab code is pretty straightforward. I'll try to translate it to something more pseudocodeish.

这应该很容易转化为ActionScript / C#中,你应该,如果你被卡住试试这个和后期的后续问题与你的code,这样你就会有最好的学习效果。

It should be easy to translate to ActionScript/C#, you should try this and post follow-up questions with your code if you get stuck, this way you'll have the best learning effect.

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

这篇关于1D多峰值检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:45