将音频转换为多声道MIDI。

audio-to-midi的Python项目详细描述


音频到MIDI

audio-to-midi接收声音文件并将其转换为多声道MIDI文件。它通过在用户指定的时间步对音频数据的所有通道执行fft来实现这一点。然后,它将得到的频率分析分为对应于十二音音阶的等效类;每个类的音量是其组成频率的平均音量。然后,它为midi格式化这些数据并将其写入用户指定的文件。它能够转换soundfile模块支持的任何音频文件格式。运行audio-to-midi之前必须安装libsndfile

安装

> python3 ./setup.py install

用法

> audio-to-midi --help
usage: audio-to-midi [-h][--output OUTPUT][--time-window TIME_WINDOW][--activation-level ACTIVATION_LEVEL][--condense][--single-note][--no-progress]
                     infile

positional arguments:
  infile                The sound file to process.

optional arguments:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        The MIDI file to output. Default: <infile>.mid
  --time-window TIME_WINDOW, -t TIME_WINDOW
                        The time span over which to compute the individual
                        FFTs in milliseconds.
  --activation-level ACTIVATION_LEVEL, -a ACTIVATION_LEVEL
                        The amplitude threshold for notes to be added to the
                        MIDI file. Must be between 0 and 1.
  --condense, -c        Combine contiguous notes at their average amplitude.
  --single-note, -s     Only add the loudest note to the MIDI file for a given
                        time span.
  --no-progress, -n     Don't print the progress bar.

示例

> audio-to-midi ./this_is_a_test.wav --time-window 5 --activation-level 0.0
Converting: ./this_is_a_test.wav
|================================================================================|100.00%
> ls ./*.mid
./this_is_a_test.wav.mid

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

推荐PyPI第三方库


热门话题
java我能在这个程序中更好地使用内存吗?   为什么我的Java while循环迭代了一半   java IntelliJ IDEA不在构建时复制资源   socket仅在Java TCP服务器输出上检查客户端断开连接   java游戏物理摩擦   java片段onClick调用方法   symja数学分析器中无法识别java Abs[x]   java在使用泛型时创建二进制搜索树类的实例?   java在外键约束表上的添加和删除   语法java表达式的含义,如果有条件   java创建内联对象并作为参数传递   是否有相当于Redis排序集(zset)的Java数据结构   java找不到适合的方法(无参数)   音频文件操作给定字节帧的音量Java   Eclipse4不以JavaWebStart启动   java如何使用org在JSON对象中获取嵌套的键元素。json?   java与Jackson的反序列化:“org.codehaus.Jackson.map.JsonMappingException:无法反序列化[projectname]的实例。”   字符串的Java正则表达式   spring集成上的java检测缺火指令