How to input noise during the audio transmission process ?

1 Ansicht (letzte 30 Tage)
Sisi Misi
Sisi Misi am 21 Sep. 2021
Kommentiert: Sisi Misi am 5 Okt. 2021
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

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 21 Sep. 2021
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 Kommentare
Mathieu NOE
Mathieu NOE am 1 Okt. 2021
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)
Sisi Misi
Sisi Misi am 5 Okt. 2021
Okay Mr, thank you so much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by