python手记(43)
来源:互联网 发布:网络电视方案 编辑:程序博客网 时间:2024/06/08 15:44
>>> runfile(r'K:\testpro\test.py', wdir=r'K:\testpro')
http://blog.csdn.net/myhaspl
myhaspl@qq.com
working...
[插入
http://blog.csdn.net/myhaspl
myhaspl@qq.com
working...
>>>
python对声音处理
显示一段语音的波形
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.csdn.net/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npprint 'http://blog.csdn.net/myhaspl' print 'myhaspl@qq.com' print print 'working...' # 打开WAV文档f = wave.open(r"speak.wav", "rb")# 读取格式信息# (nchannels, sampwidth, framerate, nframes, comptype, compname)params = f.getparams()nchannels, sampwidth, framerate, nframes = params[:4]# 读取波形数据str_data = f.readframes(nframes)f.close()#将波形数据转换为数组wave_data = np.fromstring(str_data, dtype=np.short)wave_data.shape = -1, 2wave_data = wave_data.Ttime = np.arange(0, nframes) * (1.0 / framerate)# 绘制波形pl.subplot(211)pl.plot(time, wave_data[0])pl.subplot(212)pl.plot(time, wave_data[1], c="g")pl.xlabel("time (seconds)")pl.show()
[插入
- python手记(43)
- Python 手记
- python手记
- python socket 编程手记
- Python重载学习手记
- python手记(1)
- python手记(2)
- python手记(3)
- python手记(4)
- python手记(5)
- python手记(6)
- python手记(7)
- python手记(8)
- python手记(9)
- python手记(10)
- python手记(11)
- python手记(12)
- python手记(14)
- STM32 调试停留在LDR R0, =SystemInit,不能自动Run to main
- ACE线程安全与同步(Thread Safety and Synchronization)
- a链接刷新页面与js刷新页面总结
- ThinkPHP 调试
- <html:radio>与<html:option>的区别
- python手记(43)
- jxl在web项目中以IO流的形式写入excel文件
- LPTSTR CString 相互转换 CString char * 相互转换
- CSS3----渐变主流浏览器支持
- List 的排序和查询
- android手机开机自动启动
- 于关u-boot中的.balignl 16,0xdeadbeef的理解
- ThinkPHP 视图
- c++模板类/模板函数的声明与定义应该放在头文件里