How to input noise during the audio transmission process ?

1 次查看(过去 30 天)
Hello everyone
I do audio compression with bit per sample variations like this:
[y,Fs]=audioread('water.wav');
audiowrite('testing.flac',y,Fs,'BitsPerSample', 8);
Now I also want to input noise into the process
Does anyone know how the code should be used?
thank you

采纳的回答

Mathieu NOE
Mathieu NOE 2021-9-21
hello
if you simply want to add some white noise you can do this
[y,Fs]=audioread('water.wav');
y = y + 0.1*randn(size(y)); % adjust amplitude to your needs
y = y./max(abs(y)); % normalize data to avoid saturation (may be depend on output format)
audiowrite('testing.flac',y,Fs,'BitsPerSample', 8);
you can also add a low or high or bandpass filter on the random noise if you want to have noise in a certain frequency range.
  19 个评论
Mathieu NOE
Mathieu NOE 2021-10-1
hello
so far the code will add the noise to the original audio , not the compressed audio
the compression is done after the noise is added (y = y + 0.01*randn(size(y));) , because as explained above , the compression is done inside audiowrtite when you select a certain type of format (wav and flac are both compressed audio formats)

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by