이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to input noise during the audio transmission process ?
조회 수: 1 (최근 30일)
이전 댓글 표시
Sisi Misi
2021년 9월 21일
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
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
Sisi Misi
2021년 9월 22일
편집: Sisi Misi
2021년 9월 22일
alright Mr, thank you
But I have another question, when I listen to the results I completely lose the original audio. What if we want to input noise into the audio but the original audio is still heard and can keep the audio in 2 channels, because my original audio is 2 channels?
I'm confused because I'm using lossless compression here
Mathieu NOE
2021년 9월 22일
hello
could you share your wav file ? the amount (amplitude) of noise must be adapted to the amplitude of your sgnal so you must probably do some trials
if you can share your wav file I can further help you;
Sisi Misi
2021년 9월 22일
This is the audio folder Mr
This audio is obtained from the music cloud
This audio consists of two channels, I did a lossless compression process (into a .flac format codec) with variations in bits per sample (24, 16, and 8 bits) and in the transmission process I had to put noise into it. Then decompress it back into a wav file
I want to see the performance of the lossless audio codec how resistant the audio is to noise, because what I read for lossless compression is noise resistance
I hope you can help me because I'm still confused about what I'm doing now
Thank you very much Mr
Mathieu NOE
2021년 9월 22일
hello
I simply reduced the noise amplitude so it's now clearly audible in the flac version , without hiding the audio content. You can still adjust the amplitude (here 0.01) to your needs and play with flac resolution
[y,Fs]=audioread('water.wav');
y = y + 0.01*randn(size(y)); % adjust noise 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);
Sisi Misi
2021년 9월 22일
alright Mr
how to keep the new audio that is saved in two channels?
is there any code to add?
Mathieu NOE
2021년 9월 22일
the output in flac is stereo , I didn't changed anything to the audio size (2 channels)
Sisi Misi
2021년 9월 22일
ok Mr
In matlab 2015b there is an error like this :
but after i tried it in matlab online
everything is fine
I'm sorry Mr
Thank you so much
Image Analyst
2021년 9월 22일
There should be no difference between local and online versions of MATLAB. Can you reproduce this error?
Mathieu NOE
2021년 9월 22일
Maybe my fault
this should avoid any issue now :
replace
y = y./max(abs(y)); % normalize data to avoid saturation (may be depend on output format)
with
y = y./max(abs(y),[],'all'); % normalize data to avoid saturation (may be depend on output format)
Sisi Misi
2021년 9월 23일
I don't know Mr
There is still an error here, when I use
[y,Fs]=audioread('water.wav');
y = y + 0.01*randn(size(y)); % adjust noise amplitude to your needs
y = y./max(abs(y),[],'all');% normalize data to avoid saturation (may be depend on output format)
audiowrite('testing8.flac',y,Fs,'BitsPerSample', 8);
audiowrite('testing8.wav',y,Fs)
so I try another code like this, but still errorr
[y,Fs]=audioread('water.wav');
y = y + 0.01*randn(size(y)); % adjust noise amplitude to your needs
y = y./max(abs(y),[],'omitnan');% normalize data to avoid saturation (may be depend on output format)
audiowrite('testing8.flac',y,Fs,'BitsPerSample', 8);
audiowrite('testing8.wav',y,Fs)
but in matlab online, everything is fine Mr
Mathieu NOE
2021년 9월 23일
hello
I think the older 2015 release is not compatible with the syntax max(abs(y),[],'all');
I use the R2020b with works fine.
in case you stick to R2015 , try this modification :
% normalize data to avoid saturation (may be depend on output format)
% m = max(abs(y),[],'all'); % R2020
m = max(abs(y(:))); % R2015 and below
y = y./m; % normalize data
Sisi Misi
2021년 9월 30일
Hi Mr Mathieu NOE
I want to ask you again
I got instructions again to input noise into the audio when we transmit
it means when we do compression
in the "audiowrite" function and in that function we directly input the noise
can we do that Mr ?
Mathieu NOE
2021년 9월 30일
hello
the compression is done inside the audiowrite function , depending of the format (flac is compressed)
you don't have to do anything in your own code as compression is done by audiowrite function
Sisi Misi
2021년 10월 1일
yes Mr
I mean, we input noise into the compressed audio instead of the original audio
or maybe when we save the compressed audio we input the noise,
the point is that the input noise is not original audio but compressed audio, immediately when we save the compressed audio
do you understand what I mean Mr ?
sorry I'm confused how to convey it, I hope you understand
because really I need your help
thank you Mr
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)