Matlab Piano

Hello. I am a freshman student at mechanical engineering. I try to make a piano on matlab gui for final project but I don't know how I make exactly. Only keybord is enough for my project but I need help. I will appreciate if you help me. Thank you in advance.

댓글 수: 4

Walter Roberson
Walter Roberson 2011년 12월 19일
Whom is this addressed to?
Are you asking about how to make the GUI, or about how to interface a MIDI keyboard, or about how to do sound synthesis in MATLAB?
hckfb
hckfb 2011년 12월 20일
I ask how to interface a MIDI keyboard and how to do sound synthesis in MATLAB
Jan
Jan 2011년 12월 20일
MIDI?! You asked for a GUI ask keyboard at first. MIDI is another story.
hckfb
hckfb 2011년 12월 20일
http://www.mathworks.com/matlabcentral/fileexchange/21262-matlab-piano
I need same thing but it not needed to complex

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

답변 (2개)

Jan
Jan 2011년 12월 19일

0 개 추천

As I've answered in your former question: If you ask Google, you find some very well implementations of piano keyboards in Matlab. You can also search in the FileExchange pages.
I did not post the links directly, to give you a chance to find them by your own.

댓글 수: 8

hckfb
hckfb 2011년 12월 20일
I have already done. There are a few piano but I don't understand exactly. There are only m-file and I don't understand which button is correspond which callback so I don't understand how my piano play sound.
Jan
Jan 2011년 12월 20일
What exactly is your question?
hckfb
hckfb 2011년 12월 20일
I want make a matlab gui but I don't know what I write to callback
Walter Roberson
Walter Roberson 2011년 12월 20일
If you are using GUIDE, the callback function will be created automatically and you will merely (!) need to add the calls to the sound synthesis routines to those callbacks.
If you are not using GUIDE, then when you create the uicontrol, specify the name of a routine in the 'Callback' parameter, such as
blackkey5 = uicontrol('Style','pushbutton','Callback', {@keypushed,'b5'}, 'Position', [....]);
and
function keypushed(src, evt, keyid)
[...]
end
hckfb
hckfb 2011년 12월 20일
I using guide. Yes, the callback function will be created automatically but I don't know what I add the calls to the sound synthesis routines to those callbacks.
Thank you.
Walter Roberson
Walter Roberson 2011년 12월 20일
You could start by creating the GUI and setting the callbacks to things like
pianokey(w11)
and have
function pianokey(keyid)
keyname = keyname(keyid);
note = keynote(keyid);
fprintf(1, 'Pressed key #%d, %s, note %s\n', keyid, keyname, note);
end
This will allow you to get your GUI all nicely arranged and will allow you to test the callbacks to be sure that each pushbutton connects to the proper note.
(You would have to build the keyname() and keynote() functions.)
hckfb
hckfb 2011년 12월 20일
http://www.mathworks.com/matlabcentral/fileexchange/21262-matlab-piano
I need same thing but it not needed to complex
Walter Roberson
Walter Roberson 2011년 12월 20일
Might as well start with your GUI, and use dummy callback routines like I show above.
Sound synthesis is not a small topic; if you want to do it, you will need to research it and figure out what you want to implement. Keeping in mind, of course, that imitating force or velocity sensitive keys, or even just figuring out when a key is released, is going to require some cleverness on your part.

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

Walter Roberson
Walter Roberson 2011년 12월 20일

0 개 추천

댓글 수: 2

hckfb
hckfb 2011년 12월 20일
http://www.mathworks.com/matlabcentral/fileexchange/21262-matlab-piano
I need same thing but it not needed to complex
Jan
Jan 2011년 12월 21일
It is *your* final project. Therefore it is *your* turn, to simplify the program.

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

카테고리

도움말 센터File Exchange에서 Just for fun에 대해 자세히 알아보기

태그

질문:

2011년 12월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by