How could add noise to a music file in a way that after a certain amount of time the music file become noise free?
1 次查看(过去 30 天)
显示 更早的评论
multiplier = 0.1;
noise = randn(length(y),1).*multiplier;
sound_w_noise = y+noise;
sound(sound_w_noise,Fs);
As of now, the noise lasts the entire music file. So far I have tried creating different arrays with different lengths then using that to create the noise, like here.
ys = y(1:57344);
multiplier = 0.1;
noise = randn(length(ys),1).*multiplier;
sound_w_noise = ys+noise;
sound(sound_w_noise,Fs);
But all that has done is cut short the music file itself. What could I do so that the noise only lasts for a certain amount of time of the total music file?
0 个评论
回答(1 个)
Thiago Henrique Gomes Lobato
2020-3-15
You were almost there. The array you have to shorten is the noise one, while, at the same time, adding it only at the initial values of your sound:
LenNoise = 57344;
multiplier = 0.1;
noise = randn(LenNoise,1).*multiplier;
sound_w_noise = y;
sound_w_noise(1:LenNoise) = sound_w_noise(1:LenNoise)+noise;
sound(sound_w_noise,Fs);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!