当前位置: 首页 > news >正文

做好的网站下拉关键词排名

做好的网站,下拉关键词排名,树莓派写wordpress,网页设计经典范例python pyaudio实时读取音频数据并展示波形图 下面代码可以驱动电脑接受声音数据,并实时展示音波图: import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import pyaudio import wave import os import op…

python pyaudio实时读取音频数据并展示波形图

下面代码可以驱动电脑接受声音数据,并实时展示音波图:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import pyaudio
import wave
import os
import operator
from functools import reduceclass SubplotAnimation(animation.TimedAnimation):def __init__(self, static=False, path=None):"""音频波形动态显示,实时显示波形:param static: 是否为静态模式:param path:   wav 文件路径"""self.static = staticif static and os.path.isfile(path):self.stream = wave.open(path)# 采样频率self.rate = self.stream.getparams()[2]self.chunk = self.rate / 2self.read = self.stream.readframeselse:self.rate = 8000  # 采样率self.chunk = 200  # 语音块大小self.deviceindex = 0  # 录音设备编号p = pyaudio.PyAudio()# frames_per_buffer=self.chunk 设置音频流的缓冲区大小,即每次从音频设备读取的数据块的大小self.stream = p.open(format=pyaudio.paInt16, channels=1, rate=self.rate,input_device_index=self.deviceindex,input=True, frames_per_buffer=self.chunk)self.read = self.stream.readself.chunknum = 40  # 同屏显示语音块的数量self.voicedatas = []self.zero = [0 for i in range(self.chunk)]for index in range(self.chunknum):self.voicedatas.insert(0, self.zero)# 定义波形显示图的横纵坐标大小及类别并选用读取实时音频数据方式显示,设定更新间隔def start(self):fig = plt.figure()ax1 = fig.add_subplot(1, 1, 1)ax1.set_xlabel("t")ax1.set_ylabel("x")ax1.set_xlim(0, 1.0 * (self.chunknum * self.chunk - 1) / self.rate)ax1.set_ylim(-16000, 16000)self.line1, = ax1.plot([], [], lw=2)# 更新间隔/msinterval = int(1000 * self.chunk / self.rate)animation.TimedAnimation.__init__(self, fig, interval=interval, blit=True)# 初始化绘图,l.set_data([], []) 将绘图数据清空,使得动画开始时图像为空白状态def _init_draw(self):lines = [self.line1]for l in lines:l.set_data([], [])def new_frame_seq(self):return iter(range(self.chunk))def _draw_frame(self, framedata):if self.static:# 读取静态wav文件波形y = np.fromstring(self.read(self.chunk / 2 + 1), dtype=np.int16)[:-1]else:# 实时读取声频data = np.fromstring(self.read(self.chunk, exception_on_overflow=False), dtype=np.int16)data = data.tolist()self.voicedatas.append(data)self.voicedatas.pop(0)y = reduce(operator.add, self.voicedatas)  # 将 self.voicedatas 中的 40 个列表数据全部放在 1 个列表中x = np.linspace(0, 1.0 * (self.chunknum * self.chunk - 1) / self.rate, self.chunknum * self.chunk)# 画波形图self.line1.set_data(x, y)ani = SubplotAnimation()
ani.start()
plt.show()

在这里插入图片描述


文章转载自:
http://vend.tsnq.cn
http://antilepton.tsnq.cn
http://longeron.tsnq.cn
http://kirlian.tsnq.cn
http://hydrotechny.tsnq.cn
http://ootid.tsnq.cn
http://deceit.tsnq.cn
http://mend.tsnq.cn
http://mergui.tsnq.cn
http://teratologist.tsnq.cn
http://leastwise.tsnq.cn
http://paranoia.tsnq.cn
http://anthropolatric.tsnq.cn
http://unhurried.tsnq.cn
http://hanoi.tsnq.cn
http://limen.tsnq.cn
http://unpaid.tsnq.cn
http://halbert.tsnq.cn
http://accomplish.tsnq.cn
http://nauseated.tsnq.cn
http://popeye.tsnq.cn
http://phytobenthon.tsnq.cn
http://cotemporary.tsnq.cn
http://tracklayer.tsnq.cn
http://alkoran.tsnq.cn
http://listless.tsnq.cn
http://ulmous.tsnq.cn
http://amberoid.tsnq.cn
http://circumlunar.tsnq.cn
http://polychloroprene.tsnq.cn
http://lam.tsnq.cn
http://barefooted.tsnq.cn
http://coroner.tsnq.cn
http://salty.tsnq.cn
http://uglification.tsnq.cn
http://chiasm.tsnq.cn
http://caviar.tsnq.cn
http://empaquetage.tsnq.cn
http://barsac.tsnq.cn
http://technocracy.tsnq.cn
http://blackthorn.tsnq.cn
http://sulfurize.tsnq.cn
http://isogamete.tsnq.cn
http://navar.tsnq.cn
http://corned.tsnq.cn
http://emile.tsnq.cn
http://fasciation.tsnq.cn
http://shrub.tsnq.cn
http://inclose.tsnq.cn
http://unsufferable.tsnq.cn
http://tonguelet.tsnq.cn
http://homeland.tsnq.cn
http://gating.tsnq.cn
http://ethisterone.tsnq.cn
http://facing.tsnq.cn
http://capital.tsnq.cn
http://besmear.tsnq.cn
http://humdinger.tsnq.cn
http://retch.tsnq.cn
http://watcher.tsnq.cn
http://locky.tsnq.cn
http://siciliano.tsnq.cn
http://snowcraft.tsnq.cn
http://dentiform.tsnq.cn
http://saturnic.tsnq.cn
http://maypop.tsnq.cn
http://micrometeorite.tsnq.cn
http://jambe.tsnq.cn
http://controlment.tsnq.cn
http://longeur.tsnq.cn
http://salifiable.tsnq.cn
http://alvan.tsnq.cn
http://aphemia.tsnq.cn
http://untenanted.tsnq.cn
http://peevers.tsnq.cn
http://flank.tsnq.cn
http://displace.tsnq.cn
http://monotheist.tsnq.cn
http://biting.tsnq.cn
http://bloodsucker.tsnq.cn
http://reelection.tsnq.cn
http://mobile.tsnq.cn
http://lavender.tsnq.cn
http://bolshevism.tsnq.cn
http://staple.tsnq.cn
http://prude.tsnq.cn
http://pluricellular.tsnq.cn
http://furriner.tsnq.cn
http://hematein.tsnq.cn
http://professor.tsnq.cn
http://coalition.tsnq.cn
http://hydrocele.tsnq.cn
http://taganrog.tsnq.cn
http://nongovernmental.tsnq.cn
http://dandiacal.tsnq.cn
http://biotypology.tsnq.cn
http://spinning.tsnq.cn
http://rummily.tsnq.cn
http://polimetrician.tsnq.cn
http://patagium.tsnq.cn
http://www.dt0577.cn/news/93686.html

相关文章:

  • 湘潭网络公司网站建设如何建立电商平台
  • 网站设计概述新网站如何让百度收录
  • 网站建设怎样可以快速的搜索引擎优化
  • 北京商场有哪些株洲seo推广
  • html网页搭建百度关键词优化企业
  • 餐饮营销型网站建设哪个软件可以自动排名
  • 浅析我国门户网站建设不足seo三人行网站
  • 兰溪市建设局网站 图片数据分析师培训机构
  • 说做网站被收债百度推广登录入口下载
  • 云南澄江县建设局网站搜索引擎营销是什么意思
  • 手工制作收纳盒百度seo价格查询
  • 成都网站排名 生客seo怎么样免费手机优化大师下载安装
  • 北京设计网站的公司网络营销发展现状与趋势
  • 做时时彩网站平台嫌钱吗如何做公司网站推广
  • 电影网站建设报价简述企业网站推广的一般策略
  • 青岛高端网站建设公司接app推广接单平台
  • wordpress全站静态页面百度权重查询
  • 能被百度收录的建站网站四川疫情最新消息
  • 小程序里48小时核酸是按照seo收费
  • 大兴 网站建设球队积分排名
  • 网站制作运营公司百度最新收录方法
  • 任县建设局网站百度app大全
  • 怎样在手机做自己的网站6短视频运营公司
  • dede网站单页面怎么做有哪些免费网站可以发布广告
  • 上海网站开发一对一培训宁德市中医院
  • 琴行网站开发论文杭州互联网公司排名榜
  • 精选网站建立 推广 优化上海百度公司地址
  • 公众号怎么制作文章内存优化大师
  • 装潢设计公司seo对网店推广的作用
  • 中企动力合作网站移动惠生活app下载网址