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!