I need to make MUSIC on matlab

48 ビュー (過去 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 Center および File ExchangeJust for fun についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by