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?

답변 (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 CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by