How to input noise during the audio transmission process ?

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Mathieu NOE
Mathieu NOE il 21 Set 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 Commenti
Mathieu NOE
Mathieu NOE il 1 Ott 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)

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by