Problem in using audiowrite function
조회 수: 23 (최근 30일)
이전 댓글 표시
hi, i want to make matlab song
here is the code :
b=sin(2*pi*493.88*(0:0.000125:0.5));
d=sin(2*pi*587.33*(0:0.000125:0.5));
d=sin(2*pi*587.33*(0:0.000125:0.5));
f=sin(2*pi*698.45*(0:0.000125:0.5));
c=sin(2*pi*554.37*(0:0.000125:0.5));
e=sin(2*pi*659.26*(0:0.000125:0.5));
line1=[b,d,d];
line2=[d,d,c,c,b,b];
line3=[e,e,d,d,c,c,b,b];
song=[line1,line2,line3,line3,line1,line2];
audiowrite('Epi.wav',song,Fs);
[x,Fs] = audioread('Epi.wav');
sound(x);
but it show an error at line audiowrite('Epi.wav');
how can i fix it?
댓글 수: 0
답변 (2개)
Mehmed Saad
2020년 4월 17일
편집: Mehmed Saad
2020년 4월 17일
Define sampling Rate
Fs = 1/0.000125;
t = (0:1/Fs:0.5);
b=sin(2*pi*493.88*t);
d=sin(2*pi*587.33*t);
d=sin(2*pi*587.33*t);
f=sin(2*pi*698.45*t);
c=sin(2*pi*554.37*t);
e=sin(2*pi*659.26*t);
line1=[b,d,d];
line2=[d,d,c,c,b,b];
line3=[e,e,d,d,c,c,b,b];
song=[line1,line2,line3,line3,line1,line2];
audiowrite('Epi.wav',song,Fs);
[x,Fs] = audioread('Epi.wav');
sound(x,Fs)
댓글 수: 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!