Problem in using audiowrite function

5 vues (au cours des 30 derniers jours)
NUR HANIS SHAZANA JAMALUDIN
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?

Réponses (2)

Mehmed Saad
Mehmed Saad le 17 Avr 2020
Modifié(e) : Mehmed Saad le 17 Avr 2020
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)

NUR HANIS SHAZANA JAMALUDIN
Thank you.
I want to ask how i can make song in matlab but it sound like piano?

Catégories

En savoir plus sur Audio I/O and Waveform Generation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by