How could add noise to a music file in a way that after a certain amount of time the music file become noise free?

2 ビュー (過去 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?

回答 (1 件)

Thiago Henrique Gomes Lobato
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 ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by