问题列表 - 第43875页

从潜在谐波确定基频的算法

我试图从声源中提取基频.也许有人在麦克风上唱A3,所以我想要检测~110Hz

我的方法是:

  • FFT 1024浮点数
  • 使用每个箱的相位来准确地确定其精确的频率
  • 确定峰值(通常为50左右)
  • 先用最大的声音命令它们

(峰值[0] .power = 1063.343750,.freq = 2032.715088
(峰值[1] .power = 1047.764893,.freq = 3070.605225
(峰值[2] .power = 1014.986877,.fr​​eq = 5925.878418
(峰值[3] .power = 1011.707825,.freq = 6963.769043
(Peak [4] .power = 1009.152954,.freq = 4022.363037
(Peak [5] .power = 995.199585,.freq = 4974.120605
(Peak [6] .power = 987.243713,.freq = 8087.792480
(Peak [7] .power = 533.514832,.freq = 908.691833

  • (MARKER1)以最响亮的方式开始,并将其与所有剩余的峰值匹配,所以如果我有N个峰值,此时我将有N-1个峰值对
  • 检查每个峰值对的谐度; 即它与某个分数a/b有多接近,即我们能找到b <20的a/b,使得| peakA.freq/peakB.freq - a/b | <0.01(这将匹配到20日的谐波)
  • 我们现在有一个精确的峰值列表,这些峰值被认为是彼此谐波的

    Harmonic PeakPair:(0,1)= 2/3,误差:0.00468 => f0 @ 1019.946289
    谐波峰值:( 0,2)= 1/3,误差:0.00969 => …

algorithm estimation signal-processing pitch

16
推荐指数
2
解决办法
4894
查看次数

C++错误 - 返回一个char数组

请考虑以下代码:

char CeaserCrypt(char str[256],int key)
{
    char encrypted[256],encryptedChar;
    int currentAsci;

    encrypted[0] = '\0'; 

    for(int i = 0; i < strlen(str); i++) 
    {
        currentAsci = (int)str[i];
        encryptedChar = (char)(currentAsci+key);
        encrypted[i] = encryptedChar;
    }

    return encrypted;
}
Run Code Online (Sandbox Code Playgroud)

Visual Studio 2010出错,因为该函数返回一个数组.我该怎么办?

我的朋友告诉我要将签名更改为void CeaserCrypt(char str[256], char encrypted[256], int key).但我不认为这是正确的.如何摆脱编译错误?

c c++

3
推荐指数
2
解决办法
2103
查看次数

测试交互式python程序

我想知道python的哪些测试工具支持交互式程序的测试.例如,我有一个应用程序启动:

$ python dummy_program.py 

>> Hi whats your name? Joseph
Run Code Online (Sandbox Code Playgroud)

我想要工具,Joseph所以我可以模仿这种互动行为.

python testing

10
推荐指数
1
解决办法
2228
查看次数

Prolog编程 - 简单的否定查询

我的数据库是:

eat(magi,limo).
eat(nona,banana).
Run Code Online (Sandbox Code Playgroud)

我怎么问:"谁不吃豪华轿车?" 这个:

eat(X,not(limo)).
Run Code Online (Sandbox Code Playgroud)

不行.:(

prolog

3
推荐指数
1
解决办法
1207
查看次数

如何在Maven 2 exec插件的参数中使用空格

相关问题:Maven Exec插件没有读取配置

在我的配置中,我需要一个参数,它是一个文件路径.我发现了一个相当"脏"的解决方法,用POM中的引号括起参数("脏",因为参数将使用这些引号传递给main方法,它们必须在代码中再次删除).

<configuration>
    <executable>java</executable>
    <arguments>
        <argument>"path to file"</argument>
    </arguments>
</configuration>
Run Code Online (Sandbox Code Playgroud)

但是我找不到将路径作为命令行参数传递的解决方案:

>mvn exec:java -Dexec.args="path to file"
Run Code Online (Sandbox Code Playgroud)

java maven-2 maven-plugin maven

15
推荐指数
2
解决办法
1万
查看次数

索引一维numpy.array作为矩阵

我试图在运行时索引具有不同维度的numpy.array.要检索例如*m数组的第一行a,您可以这样做

a[0,:]
Run Code Online (Sandbox Code Playgroud)

但是,如果恰好是1xn向量,则上面的代码会返回索引错误:

IndexError:索引太多了

由于代码需要尽可能高效地执行,我不想引入if声明.有没有人有一个方便的解决方案,理想情况下不涉及更改任何数据结构类型?

python numpy

7
推荐指数
1
解决办法
6831
查看次数

使用标准GCC编译ARM Cortex M3?

是否可以使用带--target开关的vanilla GCC编译ARM Cortex M3(LPC1768)的C/C++代码,还是需要编译GCC,binutils等来执行此操作?

embedded microcontroller gcc arm cortex-m3

9
推荐指数
2
解决办法
1万
查看次数

GCC中的C++ 0x正则表达式

以下代码:

#include <regex>
using namespace std;

(snippage)

regex_search(s, m, re);
Run Code Online (Sandbox Code Playgroud)

适用于Microsoft C++,但GCC 4.4.3提供以下错误消息:

/usr/include/c++/4.4/tr1_impl/regex:2255:警告:内联函数'bool std :: regex_search(_Bi_iter,_Bi_iter,std :: match_results <_Bi_iter,_Allocator>&,const std :: basic_regex <_Ch_type,_Rx_traits >&,std :: regex_constants :: match_flag_type)[与_Bi_iter = __gnu_cxx :: __ normal_iterator,std :: allocator >>,_ Allocator = std :: allocator,std :: allocator >>>,_Ch_type = char,_Rx_traits = std :: regex_traits]'已使用但从未定义过

当然,如果正则表达式只是GCC待办事项列表中的C++ 0x功能之一,我也不会感到惊讶,但在这种情况下,我为什么感到高兴呢?包含指令,变量声明等,并且仅在函数调用上跳过(它甚至似乎理解).

有什么我想念的吗?

regex gcc c++11

10
推荐指数
1
解决办法
1万
查看次数

为什么我的程序使用std :: vector创建堆栈崩溃?

我正在为我的数据结构类创建自己的堆栈.对于我们的任务,我们使用赋值将实时中缀方程转换为后缀方程.
我认为我的程序:
输入
确定它是否为数字或数字(操作数)
打印输出
确定输入是否为运算符(+, - ,/,*)
添加到堆栈或打印输出,具体取决于堆栈优先级

相反,它会按预期打印出操作数,但是当我进入运算符时出现此错误

>.../dorun.sh line 33: 4136 Segmentation fault     <core dumped> sh "$<SHFILE>"


#include <vector>
using namespace std;

class DishWell{  
public:  
    char ReturnEnd(){  
        return Well.back();  
    }  
    void Push(char x){  
        Well.push_back(x);  
    }  
    void Pop(){  
        Well.pop_back();  
    }  
    bool IsEmpty(){  
        return Well.empty();  
    }  
private:  
    vector<char> Well;  
};   
#include <iostream>  
bool Precidence(char Input, char Stack){  
    int InputPrecidence,StackPrecidence;  
    switch (Input){  
        case '*':  
            InputPrecidence = 4;  
            break;
        case '/':
            InputPrecidence = 4;  
            break;  
        case '+':  
            InputPrecidence = 3;  
            break; …
Run Code Online (Sandbox Code Playgroud)

c++ stack

2
推荐指数
1
解决办法
464
查看次数

PHP框架类似于Python Pylons

与Pylons最相似的PHP框架是什么?我的意思是主要是编程的意识形态.

php python comparison pylons web-frameworks

5
推荐指数
1
解决办法
740
查看次数