Question

I need to listen do re mi fa notes in matlab.Can u help ne about codes?

I need to listen do re mi fa notes in matlab.Can u help ne about codes?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Simple sine waves are not going to sound like music even if you string them together. I'm not a music expert by any stretch of the imagination, but an A played on a piano vs. guitar sounds different (and much richer) because of the harmonic structure.

I have not done the notes in the order you give, but you can easily modify:

Fs=8000;

Ts=1/Fs;

t=[0:Ts:0.3];

F_A = 440; %Frequency of note A is 440 Hz

F_B = 493.88;

F_Csharp = 554.37;

F_D = 587.33;

F_E = 659.26;

F_Fsharp = 739.9;

notes = [F_A ; F_B; F_Csharp; F_D; F_E; F_Fsharp];

x = cos(2*pi*notes*t);

sig = reshape(x',6*length(t),1);

soundsc(sig,1/Ts)

OR I HAVE A BIRTHDAY SONG CODE bt you can modify it according to your requirements.. Hope you like it

% if you know the generation of sine wave, you can compose any tune in the
% matlab
clc;
clear all;
close all;
t = 0:1/8000:0.5;
k = 2; % frequency scale
% music tone frequencies
C4 = sin(2*pi*k*261.6*t);
c4 = sin(2*pi*k*277.2*t);
D4 = sin(2*pi*k*293.7*t);
Eb4 = sin(2*pi*k*311.1*t);
E4 = sin(2*pi*k*329.2*t);
F4 = sin(2*pi*k*349.2*t);
f4 = sin(2*pi*k*370.0*t);
G4 = sin(2*pi*k*292.0*t);
g4 = sin(2*pi*k*415.3*t);
A4 = sin(2*pi*k*440.0*t);
Bb = sin(2*pi*k*466.2*t);
B = sin(2*pi*k*493.9*t);
C5 = sin(2*pi*k*523*t);
% Here the harmony or the order of birthday tunes order
% C4 C4 D4 C4 F4 E4 C4 C4 D4 C4 G4 F4 C4 C4 C5 A4 F4 E4 D4 Bb Bb A4 F4 G4 F4
m = [C4 C4 D4 C4 F4 E4 C4 C4 D4 C4 G4 F4 C4 C4 C5 A4 F4 E4 D4 Bb Bb A4 F4 G4 F4];
m1 = [m m];
sound(m1,8000);
% just run the program and enjoy the brithday song.
Add a comment
Know the answer?
Add Answer to:
I need to listen do re mi fa notes in matlab.Can u help ne about codes?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT