When I run plot it doesn't show my figure

조회 수: 1 (최근 30일)
Isida Kaloshi
Isida Kaloshi 2018년 12월 6일
댓글: Isida Kaloshi 2018년 12월 6일
Hello ,
I have perfome amplitude normalization on my audio file.
I wrote the commade plot() to see the result but nothing appreard.
Also I would like to hear the modified audio file but I'm getting an error.
Please find bellow to code.
[samples,fs] = audioread ('LastDance.wav' );
audiowrite('LastDance.wav', samples,fs);
% pre-processing second part downsampling
S1 = resample(fs,22050,44100); % downsample from 44100 to 22050
S1peakvalue= max (abs (S1)) % this commade help us find which is the biggest value on S1
S1_norm = (1/S1peakvalue)*S1 % we normalize audio file
figure
plot(S1_norm);
sound(samples,S1_norm);
  댓글 수: 4
Jan
Jan 2018년 12월 6일
편집: Jan 2018년 12월 6일
What does "don't get a result" mean? Something must happen, so please explain, what it is. Do you see one dot, or a line which is zero? Use the debugger to find out, what the contents of S1 is.
It is not clear why you overwrite the file directly after reading it.
Isida Kaloshi
Isida Kaloshi 2018년 12월 6일
Hello,
Actually when a figure open but containing values on x' axis from 0 to 2 and the same for y however nothing else.
plot.png

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2018년 12월 6일
편집: Jan 2018년 12월 6일
You resample the frequency, which is a scalar value, instead of the signal itself:
S1 = resample(fs, 22050, 44100);
You mean:
S1 = resample(samples, 22050, 44100);
  댓글 수: 1
Isida Kaloshi
Isida Kaloshi 2018년 12월 6일
Hello,
Actually I want to downsample my signal from 44100 to 22050 and then to perform some amplitude normalization.
S1 = resample(fs,22050,44100); % downsample from 44100 to 22050
% S1peakvalue= max (abs (S1))
% S1_norm = (1/S1peakvalue)*S1
Am I doing it worng?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by