I need to make MUSIC on matlab

조회 수: 40 (최근 30일)
Annie
Annie 2013년 11월 3일
댓글: Erdal Yegenaga 2020년 11월 1일
So I have to make a song on matlab and then set up sine waves that correspond to the notes on the scale. The notes are AGGABCFG. can someone help me with this?

답변 (3개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 3일
편집: Azzi Abdelmalek 2013년 11월 3일
Look at these links
For your case
notes={'C' 'C#' 'D' 'Eb' 'E' 'F' 'F#' 'G' 'G#' 'A' 'Bb' 'B'}
freq=[261.6 277.2 293.7 311.1 329.6 349.2...
370.0 392.0 415.3 440.0 466.2 493.9]
song={'A' 'G' 'G' 'A' 'B' 'C' 'F' 'G'} % your song
a=[]
for k=1:numel(song)
note_value=0:0.000125:0.5 % You can change the note duration
a=[a sin(2*pi* freq(strcmp(notes,song{k}))*note_value)];
end
sound(a)
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 4일
[Annie commented]
thank you for you help!
Haripriya K
Haripriya K 2020년 6월 15일
hello can u say at what times these individual notes begin in the song?

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


Dan Po
Dan Po 2016년 10월 17일
OMG I LOVE THIS POST
clear
tic
notes={'C' 'C#' 'D' 'Eb' 'E' 'F' 'F#' 'G' 'G#' 'A' 'Bb' 'B'};
freq=[261.6 277.2 293.7 311.1 329.6 349.2...
370.0 392.0 415.3 440.0 466.2 493.9];
song={'A' 'G' 'G' 'A' 'B' 'C' 'F' 'G'} ; % your song
a=[];
for i=2:70
for k=1:numel(song);
note_value=0:i*0.0001:0.5 ;% You can change the note duration
a=[a sin(2*pi* freq(strcmp(notes,song{k}))*note_value)];
end
end
sound(a);
toc

Erdal Yegenaga
Erdal Yegenaga 2020년 11월 1일
I am doing research for my graduation project, but I could not reach enough code information.I want to assign music notes to computer keys for digital synthesizer. Can you write this code with adsr enveloping please?
  댓글 수: 2
John D'Errico
John D'Errico 2020년 11월 1일
편집: John D'Errico 2020년 11월 1일
This is not an answer to anything, but a direct request for someone to provide code to you to do your task. If this is research, will you give direct credit to the person who did the work for you when you hand in your project? Will their name be listed on front of your project as a direct contributor? Or, would you happily hand in someone else's efforts as your own?
Erdal Yegenaga
Erdal Yegenaga 2020년 11월 1일
You r right. I asked my problem wrong way. Can you help me write to assign computer keys to play music notes?
clear ;
close all;
fs=8500;
t=0:0.000117:3;
note_do= sin(2*pi*261.6*t);
note_re= sin(2*pi*293.7*t);
note_mi= sin(2*pi*329.6*t);
note_fa= sin(2*pi*349.2*t);
note_sol= sin(2*pi*392*t);
note_la= sin(2*pi*440*t);
note_si= sin(2*pi*493.9*t);
note_do1= sin(2*pi*523.5*t);
y=note_do;
A = linspace(0, 0.9, (length(y)*0.10)); %rise 35% of signal
D = linspace(0.9, 0.7,(length(y)*0.05)); %drop of 5% of signal
S = linspace(0.7, 0.7,(length(y)*0.40)); %delay of 40% of signal
R = linspace(0.7, 0,(length(y)*0.20)); %drop of 25% of signal
ADSR = [A D S R] ;
x = zeros(size(y));
x(1:length(ADSR)) = ADSR;
tone=y.* x;
sound(tone,fs);

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

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by