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!