小编Tib*_*ibo的帖子

在Python中实现(巴特沃斯)过滤器并创建wav文件

我\xe2\x80\x99m 尝试实现巴特沃斯带通滤波器以在Python 中的wav 文件上实现(我对此非常陌生)。我目前得到的代码如下

\n\n
import wave\nimport numpy\nimport matplotlib.pyplot as plt\nfrom scipy import signal\nfrom scipy.signal import filtfilt\n\n# open the audio file and extract some information\nspf = wave.open(\'clip.wav\',\'r\')\n(nChannels, sampWidth, sampleRate, nFrames, compType, compName) = spf.getparams()\n\n# extract audio from wav file\ninput_signal = spf.readframes(-1)\ninput_signal = numpy.fromstring(input_signal, \'Int16\')\nspf.close()\n\n# create the filter\nN = 4\nnyq = 0.5 * sampleRate\nlow = 100 / nyq\nhigh = 500 / nyq\nb, a = signal.butter(N, [low, high], btype=\'band\')\n\n# apply filter\noutput_signal = signal.filtfilt(b, a, input_signal)\n\n# ceate output file\nwav_out = wave.open("output.wav", "w")\nwav_out.setparams((nChannels, sampWidth, …
Run Code Online (Sandbox Code Playgroud)

python audio wav bandpass-filter

6
推荐指数
1
解决办法
2675
查看次数

字段有不完整的类型错误

在我的C代码中,我有一个tcpsock.c和tcpsock.h文件.tpcsock.c文件包含tcpsock.h文件.此套接字代码用于connmgr.c(包括tcpsock.c).在C文件中我有两个结构,定义如下:

struct tcpsock{
   long cookie;
   int sd;
   char * ip_addr;
   int port;
};

struct conn{
   struct tcpsock_t socket;
   long last_active;
};
Run Code Online (Sandbox Code Playgroud)

在头文件中,我有以下代码:

typedef struct tcpsock tcpsock_t;
typedef struct conn conn_t;
Run Code Online (Sandbox Code Playgroud)

当我尝试编译它时,我收到以下错误:

In file included from connmgr.c:12:0:
lib/tcpsock.c:78:22: error: field ‘socket’ has incomplete type
struct tcpsock_t socket;
                 ^
Run Code Online (Sandbox Code Playgroud)

我一直在寻找,但无法找到解决方案,所以我希望这里的任何人都可以帮助我.提前致谢!

c struct types incomplete-type

0
推荐指数
1
解决办法
4232
查看次数

标签 统计

audio ×1

bandpass-filter ×1

c ×1

incomplete-type ×1

python ×1

struct ×1

types ×1

wav ×1