回响干净的声音

时间:2015-08-03 01:12:02

标签: matlab audio signal-processing

我有一个干净的声音样本作为wav文件。我想为那个声音添加混响。我见过freeverbreverberation应用程序,但不确定我是否可以使用它将输出保存到文件。

以前是否有人这样做过?

谢谢,

1 个答案:

答案 0 :(得分:2)

你需要定义一个合适的脉冲响应并用它来卷积原始声音。脉冲响应中的每个尖峰表示原始声音的反射,并且其特征在于其延迟振幅。你应该定义大量的尖峰,以便它们共同作为混响,而不是单个回声。

指数模型通常用于表示延迟衰减(参见例如here)。您应该为参数定义随机值,以使混响听起来真实。下面给出一个简单的模型。

%// Data:
filename = 'file.wav'; %// name of input file. Mono or stereo.
delay_dispersion = .2; %// this defines the amount of reverberation
max_delay = delay_dispersion*4; %// this should be several times the delay dispersion
num_delays = 50; %// number of echoes. Should be large for realistic reverberation

%// Processing:
[x, fs] = audioread(filename); %// read file
delays = round(rand(1,50)*max_delay*fs);
amplitudes = exp(-delays/delay_dispersion/fs); %// exponential profile
amplitudes = .7*amplitudes+.3*rand(size(amplitudes)); %// add some randomness in amplitudes
delays = [1 delays]; %// add clean sound...
amplitudes = [1 amplitudes]; %// ...with unit amplitude
h = zeros(1,ceil(max_delay*fs));
h(delays) = amplitudes;
stem(delays, amplitudes) %// plot impulse response
y = conv2(x,h(:)); %// use conv2 so that it works for mono or stereo x
y = y/max(abs(y(:)));
sound(x(1:min(2*fs,end),:), fs) %// play two seconds of dry sound
pause(2)
sound(y(1:min(2*fs,end),:), fs) %// play two seconds of reverberated sound

可能的改进包括将低通过滤器应用于延迟的副本,或者定义群集中的延迟,以模拟物理上近距离对象组的反射。