没有项目描述

zounds的Python项目详细描述


Build StatusCoverage StatusPyPIDocsLicense: MIT

动机

Zounds是一个处理声音的python库它的主要目标是 致:

音频处理图和机器学习管道使用 featureflow

一个简单的例子

importzoundsResampled=zounds.resampled(resample_to=zounds.SR11025())@zounds.simple_in_memory_settingsclassSound(Resampled):"""
    A simple pipeline that computes a perceptually weighted modified discrete
    cosine transform, and "persists" feature data in an in-memory store.
    """windowed=zounds.ArrayWithUnitsFeature(zounds.SlidingWindow,needs=Resampled.resampled,wscheme=zounds.HalfLapped(),wfunc=zounds.OggVorbisWindowingFunc(),store=True)mdct=zounds.ArrayWithUnitsFeature(zounds.MDCT,needs=windowed)weighted=zounds.ArrayWithUnitsFeature(lambdax:x*zounds.AWeighting(),needs=mdct)if__name__=='__main__':# produce some audio to test our pipeline, and encode it as FLACsynth=zounds.SineSynthesizer(zounds.SR44100())samples=synth.synthesize(zounds.Seconds(5),[220.,440.,880.])encoded=samples.encode(fmt='FLAC')# process the audio, and fetch features from our in-memory store_id=Sound.process(meta=encoded)sound=Sound(_id)# grab all the frequency information, for a subset of the durationstart=zounds.Milliseconds(500)end=start+zounds.Seconds(2)snippet=sound.weighted[start:end,:]# grab a subset of frequency information for the duration of the soundfreq_band=slice(zounds.Hertz(400),zounds.Hertz(500))a440=sound.mdct[:,freq_band]# produce a new set of coefficients where only the 440hz sine wave is# presentfiltered=sound.mdct.zeros_like()filtered[:,freq_band]=a440# apply a geometric scale, which more closely matches human pitch# perception, and apply it to the linear frequency axisscale=zounds.GeometricScale(50,4000,0.05,100)log_coeffs=scale.apply(sound.mdct,zounds.HanningWindowingFunc())# reconstruct audio from the MDCT coefficientsmdct_synth=zounds.MDCTSynthesizer()reconstructed=mdct_synth.synthesize(sound.mdct)filtered_reconstruction=mdct_synth.synthesize(filtered)# start an in-browser REPL that will allow you to listen to and visualize# the variables defined above (and any new ones you create in the session)app=zounds.ZoundsApp(model=Sound,audio_feature=Sound.ogg,visualization_feature=Sound.weighted,globals=globals(),locals=locals())app.start(9999)

examples folder中找到更多灵感, 或者在blog上。

安装

libsndfile问题

安装当前要求您从中生成lbiflac和libsndfile 来源,因为an outstanding issue将 当apt包更新为libsndfile 1.0.26时更正。 下载并运行this script 来处理这一步。

纽比和希比

Python 强烈建议分发

佐恩斯

最后,只要:

pip install zounds

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在AlertDialog builder标题右侧放置图标   安装weblogic server12时发生java获取错误。1在windows 10上   java无法导入:安卓。支持v7。小装置。Android Studio中的RecyclerView   java Android应用程序等待通知奇怪行为   java如何比较ArrayList中的整数元素?   java Quartz属性不会触发Quartz作业   java轻松地将许多JavaFX属性绑定到UINode   Maven插件管理器导致java错误消息的原因是什么?   JAXB解组错误后java文件被阻止   java如何在spark kafka流中创建消费者组并将消费者分配给消费者组   java Gps lat&long随机显示非常不准确的结果   java使用assest文件夹文件在Android上执行shell命令   java如何在客户端使用javascript提取文本   java扩展描述的distincts之和   java重写默认Spring数据REST配置   java SQL未命名参数语法   二进制搜索任务的java真实解决方案   java在一个多模块多数据源项目中,用什么正确的方式来指示将哪个数据源注入我的DAOs?