生成波形文件

wavemaker的Python项目详细描述


这个项目位于GitHub

安装

你需要Python3。我现在不想支持Python2。这是纯的 没有其他依赖项的python包。

我建议您安装最新版本 PyPIpip

pip install wavemaker

标准distutils安装也可以工作:

tar xzf wavemaker-*.tar.gz
cd wavemaker-*
python setup.py install

用法

命令行工具称为make_wave。使用方法如下:

make_wave sine-wave.wav

内置了更多帮助:

$ make_wave --help
usage: make_wave [-h] [--waveform {sine}] [--frequency FREQUENCY]
                [--amplitude AMPLITUDE] [--duration DURATION]
                [--sample_rate SAMPLE_RATE] [--sample_size {16}]
                output_path

Generate WAVE files.

positional arguments:
  output_path           The path to the resulting WAVE file

optional arguments:
  -h, --help            show this help message and exit
  --waveform {sine}     The shape of the signal being generated (default:
                        sine)
  --frequency FREQUENCY
                        The oscillating rate of the wave. A non-negative
                        float, in Hz (default: 440.0)
  --amplitude AMPLITUDE
                        The amplitude of the wave. A float between 0.0 and 1.0
                        (default: 1.0)
  --duration DURATION   The time duration of the signal. A non-negative float,
                        in seconds (default: 1.0)
  --sample_rate SAMPLE_RATE
                        The number of samples per second. A non-negative int,
                        in Hz (default: 44100)
  --sample_size {16}    The number of bits used to store each sample (default:
                        16)

API

只有一个公共api函数调用。它采用的参数与 命令行工具用作关键字参数。请参阅docstring了解更多信息:

write_wave_file(output_path, waveform='sine', frequency=440.0, amplitude=1.0,
                duration=1.0, sample_rate=44100, sample_size=16)

基本用法:

import wavemaker
wavemaker.write_wave_file('sine-wave.wav')

更改

v0.1.0-2014年1月4日
  • 第一次释放。

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

推荐PyPI第三方库


热门话题
Java在二维数组中获取所有值的组合   java如何在Heroku上运行Flyway迁移?   当Tomcat作为windows服务启动时,其他计算机无法使用java Tomcat应用程序   java SPNEGO获取用户详细信息   java多线程SaxParser解析多个xml文件   如何将十六进制字符串转换为字节。JAVA   java Android:如何在MapBox中添加自定义标记?   java如何从Android广播UDP数据包?   java驱动程序。executeScript()返回简单javascript的NullPointerException   java我们如何在网站上从系统上传文件?   java在JTextArea中剪切和粘贴   java PrimeFacesRequestContext。getCurrentInstance()。为SelectOne菜单重置   java在安卓中动态存储运行时变量   java如何检测“文本内容中发现无效字符”   Java数据结构:错误“无法访问LinkedList”   java合并排序(根据频率排序单词)   java为什么/如何将整数设置为1使while循环工作?   java Maven编译器插件抱怨“未找到SLF4J提供程序”   jakarta ee java锁定文件   java Hibernate会话。update()与update查询?