将音频转换为多声道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