生成噪音和混响音频文件的工具
maracas的Python项目详细描述
maracas是一个用加法和卷积来破坏音频文件的库。 噪音。它的目标是简化语音处理(主要是增强和asr)的可重复数据集生成。
用法非常简单,并且基于maracas.dataset.Dataset
类。下面是一个简短的示例:
frommaracas.datasetimportDatasetimportnumpyasnp# Make sure this is reproduciblenp.random.seed(42)d=Dataset()# All files can be added one by one or by folder. Adding a folder will add# all speech files inside that folder recursively if recursive=True.d.add_speech_files('/home/jfsantos/data/speech_files/',recursive=True)# When adding noises, you can give a "nickname" to each noise file. If you do not# give it a name, the name will be the file name without the '.wav' extensiond.add_noise_files('/home/jfsantos/data/multichannel_noises/restaurant_ch01.wav',name='restaurant')d.add_noise_files('/home/jfsantos/data/multichannel_noises/cafeteria_ch01.wav',name='cafeteria')d.add_noise_files('/home/jfsantos/data/multichannel_noises/traffic_ch01.wav',name='traffic')# Adding reverb files works like adding noise filesd.add_reverb_files('/home/jfsantos/data/RIR_sim/rir_0.2_1.wav')d.add_reverb_files('/home/jfsantos/data/RIR_sim/rir_0.8_1.wav')# When generating a dataset, you can choose which SNRs will be used and how many# files per condition you want to be generated. d.generate_dataset([-6,-3,0,3,6],'/tmp/noise_plus_reverb_dataset',files_per_condition=5)