gpt4 book ai didi

matlab - 回响干净的声音

转载 作者:行者123 更新时间:2023-12-03 00:15:45 25 4
gpt4 key购买 nike

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

有人做过吗?

谢谢,

最佳答案

您需要定义适当的冲激响应,并将与原始声音相融合。脉冲响应中的每个尖峰代表原始声音的反射,并以其延迟振幅为特征。您应该定义大量的尖峰,以便将它们统称为混响,而不是单独的回声。

通常采用指数模型来表示振幅随延迟的衰减(例如,参见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

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

关于matlab - 回响干净的声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31778172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com